Our docker implementation is incomplete and may not work smoothly. Please, kindly report any issues!
These prerequisites assume you're working on an operating system supported by Docker.
Docker is available for many different operating systems. We recommend you follow the Docker CE install guide, which illustrates multiple installation options for each OS.
You're also going to need Docker Compose, to start multiple containers. We recommend you follow the Docker Compose install guide as well.
git clone https://github.com/<your-username>/dev.to.git
Set up your environment variables/secrets
Envfile. This file lists all the
ENVvariables we use and provides a fake default for any missing keys. You'll need to get your own free Algolia credentials to get your development environment running.
For any key that you wish to enter/replace:
config/application.ymlby copying from the provided template (i.e. with bash:
cp config/sample_application.yml config/application.yml). This is a personal file that is ignored in git.
GITHUB_KEY: "SOME_REAL_SECURE_KEY_HERE" GITHUB_SECRET: "ANOTHER_REAL_SECURE_KEY_HERE"
Update the redis url variables by adding the following lines into
REDIS_URL: "redis://redis:6379" REDIS_SESSIONS_URL: "redis://redis:6379"
You do not need "real" keys for basic development. Some features require certain keys, so you may be able to add them as you go.
Docker compose will by default use postgres:9.6 as the database version, should you want to update that set the `POSTGRESVERSION` variable in your environment and start the container again_
docker-compose run web rails db:setup
docker-compose run web yarn
docker-compose run web rails search:setup
DEV provides a
docker-run.sh script which can be used to run the Docker app with custom options.
Please execute the script itself to view all additional options:
Should you experience problems with the Elasticsearch container, try to increase the memory and/or swap allocation for Docker. On macOS this can be done via the GUI:
rails server doesn't start with the following message:
Data update scripts need to be run before you can start the application. Please run rails data_updates:run (RuntimeError)
run the following command:
docker-compose run web rails data_updates:run