VERY IMPORTANT FOR macOS to have reasonable speeds when accessing assets in development.
- Install the gems
gem install docker-sync docker-compose
- Install OS specific devDependencies: https://github.com/EugenMayer/docker-sync/wiki/1.-Installation#os-specific
or just if you use MacOS
brew install unison
brew install eugenmayer/dockersync/unox- Build the images following the instructions below
Copy app_variables.env.example to app_variables.env and change the variables to your values.
Create these empty files, they will be replaced with the actual keys by the SWAPI services.
touch swapi-commoncoin-conf/apikey.yaml
touch swapi-santacoin-conf/apikey.yamlBuild the images and run the containers:
docker-compose build
docker-compose up -dCreate the database and run migrations
docker-compose run --rm app rake db:create
docker-compose run --rm app rake db:migrateWe use yarn for managing npm packages, so install it on your machine and run
yarn installdocker-sync-stack start
# CTRL+C to stopThis will take a long time the first time you start.
See https://github.com/EugenMayer/docker-sync/wiki/2.2-sync-stack-commands
Use up and down just to start up/shut down the rails server.
docker-compose up -d
docker-compose downAlternatively, you can use start, stop, restart like this:
docker-compose start
docker-compose stop
docker-compose restartEvery time you modify the Gemfile you have to reinstall the gems and update the Gemfile.lock, then rebuild the docker image of the Rails app, so:
docker-compose run --rm app bundle install
docker-compose build
docker-compose up -dThis will re-create the image so the bundle will take quite some time.
This will recreate only the Rails container from the new image, and not the DB container, that this way persists data.
NOTE: if you use docker-sync, the Gems will be updated on start.
Use docker-compose exec to generate and run migrations while working with docker-sync.
docker-compose exec app rails generate migration YourMigration
docker-compose exec app rails db:migrateFrom this gist.
Find out the Container ID and attach to the container logs
docker ps
docker attach IDWhen done, exit pry by entering exit and detach from the container with Ctrl+P Ctrl+Q. Don't use Ctrl+C because you wuld kill the rails server and so the container itself.
We use translation.io, so write text using _('Free text') and execute this command to push new keys and get new translations (You will need an APY key for this).
docker-compose run --rm app rake translation:syncSee the wiki