-
-
Notifications
You must be signed in to change notification settings - Fork 25
Dev: Setup on Linux and OS X using Docker
This setup has been tested on Fedora 30.
In order to make it easier to get started and to troubleshoot environment issues, we provide a Dockerized development environment. This is the only supported development configuration; however, people who want to run the application locally can examine the Dockerfile
s to determine what dependencies they need to install. It is also possible to use Docker for Postgres and Elasticsearch, but not for application development; this is, again, not documented below.
Follow the Docker Engine community edition instructions for your operating system.
Follow the docker-compose installation instructions.
The development and test databases need to be initialized. The development database will be pre-configured with an admin
user (see below, in "Development," for the default password).
Run bin/initialize_databases.bash
once to take care of this step.
Some shortcut scripts have been written to ease development.
- To run the development server:
bin/run_dev_server.bash
- To run the full test suite:
bin/run_tests.bash
- To rebuild dependencies:
docker-compose build app
. Usingbundler install
directly inside a container instance will not create persistent changes. - To connect to the running Postgres instance, either:
-
docker-compose exec postgresql psql
to directly run thepsql
command inside the postgresql container - Run
psql
or your client of choice as you would normally, on your host machine:psql -h localhost -U safecast safecast_development
-
- To start the development container and open a shell inside it, so that you can run any command:
bin/run_shell.bash
- To run the development server inside the shell, run
docker_bin/run_dev_server.bash
- To run a single test inside the shell, run
docker_bin/run_test.bash <test identifier>
- To run all tests inside the shell, run
docker_bin/run_test.bash spec
- To run rubocop:
bundle exec rubocop
- To run the development server inside the shell, run
- You can also use
docker exec
to run additional commands in another shell session.docker exec -i <Container ID> bundle exec rails server -b 0.0.0.0
docker exec -i <Container ID> bundle exec rspec spec/models/user_spec.rb
When the development server is running, you can connect to http://localhost:3000 and log in with username [email protected]
and password 111111
.
There appears to be an issue with Docker and terminal history behavior that comes up from time to time; a quick fix is to resize the terminal window, or to follow one of the suggestions in that issue's thread.