-
Notifications
You must be signed in to change notification settings - Fork 0
Instructions for Local Setup with Docker
Brad Bergeron edited this page Jul 18, 2017
·
8 revisions
- Download docker.dmg Download Docker for Mac
- Double-click Docker.dmg to open the installer, then drag Moby the whale to the Applications folder.
- Double-click Docker.app in the Applications folder to start Docker. 4.Make sure Docker has installed properly by running following commands in terminal. $ docker --version $ docker-compose --version
- Download Docker MSI Download docker for Windows
- Double-click Install Docker.msi to run the installer.
- Follow the install wizard to accept the license, authorize the installer, and proceed with the install.
- Click Finish on the setup complete dialog to launch Docker.
$ mkdir docker-dev
$ cd docker-dev
$ git clone https://github.com/Service-Alliance/Service_Phase_1.git
$ mv docker-compose.yml Dockerfile Service_Phase_1
4. After completion of above 3 steps docker-dev/Service_Phase_1 directory should be looking like below. List the files.
$ ls -lahg
5. By default, Rails expects a database to be running on localhost - so you need to point it at the db container instead. You also need to change the database and username to align with the defaults set by the Postgres image by deleting the text config/database.yml and pasting in the code in its place.
default: &default
adapter: postgresql
encoding: unicode
pool: 5
development:
<<: *default
database: development
username: postgres
# password: password
host: db
port: 5432
$ docker-compose up -d
6. With these settings in place,finally create and set up the database by running following command in another terminal.
$ docker-compose run web rake db:create db:setup
- After completion of above steps You should be able to access the application via a web browser by visiting the http://localhost:3000
$ docker-compose down
2. You can also stop the application with Ctrl-C in the same shell in which you executed the docker-compose up. If you stop the app this way, and attempt to restart it, you might get the following error:
web_1 | A server is already running.
- To resolve this, delete the file tmp/pids/server.pid (from within project folder), and then re-start the application with $ rm –Rf tmp/pids/server.pid $ docker-compose up
$ docker-compose up
$ docker-compose run web rake db:create
When you make changes to Either the Gemfile or docker-compose file to try out some different configurations or when developing new features, you must follow these steps.
'$ docker-compose down'
`$ docker-compose run web bundle install` (synchronizes changes in the **Gemfile.lock** to the host)
`$ docker-compose up --build`
When not introducing a new gem or making more subtle changes can simply run docker-compose up --build
Note : If you are passing any AWS access credentials, Please declare them in docker-compose.yml file as show in below
environment:
- AWS_ACCESS_KEY=#########
- AWS_SECRET_KEY=##########