forked from Children-in-Families/oscar-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (51 loc) · 2.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Forces a rebild of the app image for example to update dependencies in the image
build_app:
docker-compose build app sidekiq
# Just start the Rails app, webpack dev server and Postgres DB
start_core:
docker-compose up --no-deps app db mongo webpack redis sidekiq
start_mongo:
docker-compose up mongo
# Start up all services (beware if you running this on a computer with less than 16GB RAM!)
start_all:
docker-compose up
stop_all:
docker-compose down
# Starts up a bash terminal in the app container
bash_console:
docker exec -it app bash
# Starts up a rails console in the app container
rails_console:
docker exec -it app rails c
# Use this to attach to the running rails app terminal for use with Pry for example
rails_attach:
docker attach $(shell docker-compose ps -q app)
# Starts up a guard console in the app container
guard_console:
docker exec -it app guard
rspec:
docker-compose exec -T app rspec spec
# Starts up a mongo console in the mongo container
mongo_console:
docker exec -it mongo mongo -u oscar -p 123456789 oscar_history_development
# Starts up a psql console in the db container
psql_console:
docker exec -it db psql -U oscar oscar_development
# Drop the postgres database (if error retry as db service needs to start first)
db_drop:
docker-compose run --entrypoint "rake db:drop" app db
# Run migrations against the database
db_migrate:
docker-compose run --entrypoint "rake db:migrate" app db
yarn_install:
docker exec -it app yarn install --check-files
# Create test database (run `make start_core` at least first!)
db_create_test:
# docker-compose run --no-deps -e RAILS_ENV=test --entrypoint "rake db:drop" app
docker-compose run --no-deps -e RAILS_ENV=test --entrypoint "rake db:create" app
docker-compose run --no-deps -e RAILS_ENV=test --entrypoint "rake db:schema:load" app
# docker exec -it mongo mongo --authenticationDatabase admin --host localhost -u mongo -p 123456789 oscar_history_test --eval "db.dropUser('oscar'); db.createUser({user: 'oscar', pwd: '123456789', roles: [{role: 'readWrite', db: 'oscar_history_test'}]});"
docker-compose exec -T mongo mongo --authenticationDatabase admin --host localhost -u mongo -p 123456789 oscar_history_test --eval "db.dropUser('oscar'); db.createUser({user: 'oscar', pwd: '123456789', roles: [{role: 'readWrite', db: 'oscar_history_test'}]});"
# If the container is NOT running and you want to get a bash terminal then run this command
run_image_bash:
docker run -it --rm -v $(shell pwd):/app -w /app --entrypoint bash oscar-web_app:latest