2015-04-26 15:20:05 +02:00
|
|
|
# Foodsoft on Docker
|
|
|
|
|
2015-05-02 14:26:15 +02:00
|
|
|
This document explains setting up and using Foodsoft with Docker.
|
2015-04-26 15:20:05 +02:00
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
2016-02-06 15:52:23 +01:00
|
|
|
* Docker (=> 1.9.1)
|
|
|
|
* Docker Compose (=> 1.4)
|
2015-04-26 15:20:05 +02:00
|
|
|
* Nothing more, no ruby, mysql, redis etc!
|
|
|
|
|
|
|
|
For installing instructions see https://docs.docker.com/installation/.
|
|
|
|
Docker runs on every modern linux kernel, but also with a little help on MacOS
|
|
|
|
and Windows!
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
Create docker volume for mysql data:
|
|
|
|
|
|
|
|
mkdir -p ~/.docker-volumes/foodsoft/mysql
|
|
|
|
|
|
|
|
Setup foodsoft development data: (This will take some time, containers needs
|
|
|
|
to be pulled from docker registry and a lot dependencies needs to be installed.)
|
|
|
|
|
|
|
|
docker-compose run app rake foodsoft:setup_development
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Start containers (in foreground, stop them with `CTRL-C`)
|
|
|
|
|
|
|
|
docker-compose up
|
|
|
|
|
|
|
|
Run a rails/rake command
|
|
|
|
|
|
|
|
docker-compose run app rake db:migrate
|
|
|
|
|
|
|
|
Open a rails console
|
|
|
|
|
|
|
|
docker-compose run app rails c
|
|
|
|
|
2015-05-02 14:26:15 +02:00
|
|
|
Setup the test database
|
|
|
|
|
|
|
|
docker-compose run app rake db:setup RAILS_ENV=test DATABASE_URL=mysql2://root:secret@mysql/test
|
|
|
|
|
2015-04-26 15:20:05 +02:00
|
|
|
Run the tests
|
|
|
|
|
|
|
|
docker-compose run app ./bin/test
|
|
|
|
|
|
|
|
Jump in a running container for debugging.
|
|
|
|
|
|
|
|
docker exec -ti foodsoft_app_1 bash
|
|
|
|
|
2016-02-06 15:52:23 +01:00
|
|
|
Receiving mails
|
|
|
|
|
|
|
|
Go to http://localhost:1080.
|
|
|
|
|
2015-04-26 15:20:05 +02:00
|
|
|
## Notes
|
|
|
|
|
|
|
|
### Gemfile updates
|
|
|
|
|
2016-02-06 15:52:23 +01:00
|
|
|
As we use a special container (`bundle`, see `docker-compose.yml`) you only
|
|
|
|
have to run the bundle command as normally: `docker-compose run app bundle`
|
2015-04-26 15:20:05 +02:00
|
|
|
|
|
|
|
### Database configuration
|
|
|
|
|
2015-05-02 14:26:15 +02:00
|
|
|
To make this easier we use the environment variable `DATABASE_URL`
|
|
|
|
(and `TEST_DATABASE_URL` when using the testing script).
|