diff --git a/README.md b/README.md index 75d14d4bc12..db182ac2eea 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,11 @@ For frontend, see [vets-website](https://github.com/department-of-veterans-affai **DO NOT commit local Gemfile modifications that remove the `sidekiq-ent` and `sidekiq-pro` gems.** -1. Developers who work with vets-api daily tend to prefer the native setup because they don't have to deal with the abstraction of docker-compose while those who would to spend less time on getting started prefer the docker setup. Docker is also useful when it's necessary to have a setup as close to production as possible. +1. Developers who work with vets-api daily tend to prefer the native setup because they don't have to deal with the abstraction of docker-compose while those who would to spend less time on getting started prefer the docker setup. Docker is also useful when it's necessary to have a setup as close to production as possible. Finally, it's possible to use a hybrid setup where you run vets-api natively, but run the Postgres and Redis dependencies in docker. - [Native setup](docs/setup/native.md) (OSX/Ubuntu) - [Docker setup](docs/setup/docker.md) + - [Hybrid setup](docs/setup/hybrid.md) ## Running the app diff --git a/docker-compose-deps.yml b/docker-compose-deps.yml new file mode 100644 index 00000000000..cbf024558b2 --- /dev/null +++ b/docker-compose-deps.yml @@ -0,0 +1,16 @@ +version: '3.4' +services: + redis: + image: redis:5.0-alpine + ports: + - "63790:6379" + postgres: + image: mdillon/postgis:11-alpine + environment: + POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-password}" + POSTGRES_USER: "${POSTGRES_USER:-postgres}" + volumes: + - ./data:/var/lib/postgresql/data:cached + ports: + - "54320:5432" + diff --git a/docs/setup/hybrid.md b/docs/setup/hybrid.md new file mode 100644 index 00000000000..13bd2df42d9 --- /dev/null +++ b/docs/setup/hybrid.md @@ -0,0 +1,34 @@ +# Developer Setup + +In hybrid mode, you will run vets-api natively, but run Postgres and Redis in Docker. By doing so you avoid any challenges of installing these two software packages and keeping them upgraded to the appropriate version. + + + +## Base Setup + +1. Install Docker as referenced in the [Docker setup instructions](docker.md). + +1. Follow the [Native setup instructions](native.md), but skip any steps related to installing Postgres, Postgis, or Redis. You *will* need to install the other dependencies such as pdftk and clamav. + +1. Configure vets-api to point to the Docker-ized dependencies. Add the following to `config/settings.local.yml`: + +``` +database_url: postgis://postgres:password@localhost:54320/vets_api_development?pool=4 +test_database_url: postgis://postgres:password@localhost:54320/vets_api_test?pool=4 + +redis: + host: localhost + port: 63790 + app_data: + url: redis://localhost:63790 + sidekiq: + url: redis://localhost:63790 +``` + +*Note: If you have local instances of Postgres or Redis that were only for use by vets-api, you can stop them to save system resources.* + +## Running + +1. To start Postgres and Redis: `docker-compose -f docker-compose-deps.yml up` + +1. Start vets-api as per the [native running instructions](running_natively.md).