The first time you need to build your backend.
docker-compose -f docker-compose.yml -f docker-compose.local.yml build
docker-compose -f docker-compose.yml -f docker-compose.local.yml up
The API will be available on port 8080 The website will be available on port localhost:3000
docker-compose -f docker-compose.yml -f docker-compose.local.yml stop
This is the agressive command, there are more subtle ones.
docker-compose -f docker-compose.yml -f docker-compose.local.yml down
This will keep the data in the data folder. The data folder is kept locally, and not included in git.
The passwords and extra config should be hidden. Therefore, you can have a docker-compose.override.yml file, which is ignored by git.
In the docker-compose.override.yml you must include the endpoint for the api like this
services:
website:
build:
args:
- "REACT_APP_API_DOMAIN=https://api.verkeersdatamonitor.nl"
The first time you need to build your backend.
docker-compose -f docker-compose.yml -f docker-compose.override.yml build
docker-compose -f docker-compose.yml -f docker-compose.override.yml up
docker-compose -f docker-compose.yml -f docker-compose.override.yml stop
This is the agressive command, there are more subtle ones.
docker-compose -f docker-compose.yml -f docker-compose.override.yml down
The development mode depends on the type of service. The config of each service to run in development mode, is in the docker-compose.dev.yml file.
Always make sure you build your images before.
Also note: debugging API service and fetch_data service is difficult at the same time.
You will need to make a docker-compose.override.yml, where local config will be stored.
In development mode, the website is not handled by docker-compose and it must be launch aside.
cd client
npm install
npm start
Config docker-compose.override.yml:
version: "3.4"
services:
api:
ports:
- 8888:8080
- 9229:9229
Running
docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.dev.yml up -f docker-compose.override.yml -d # will start in daemon mode
docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.dev.yml -f docker-compose.override.yml up logs -f --tail=200 # will tail logs
docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.dev.yml -f docker-compose.override.yml restart api # if you want to restart a service, better do it in another terminal
To go and debug this, use chrome and go to
chrome://inspect/#devices
Config docker-compose.override.yml:
version: "3.4"
services:
fetch_data:
ports:
- 8888:8080
- 9229:9229
Running
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.override.yml up -d # will start in daemon mode
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.override.yml up logs -f --tail=200 # will tail logs
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.override.yml restart api # if you want to restart a service, better do it in another terminal
To go and debug this, use chrome and go to
chrome://inspect/#devices
Suppose you want to access the DB directly, you can use a docker-compose.override.yml. This file will keep track of your changes, and won't be commit to git.
version: "3.4"
services:
database:
ports:
- 5432:5432
To take these into account, you can run:
docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.dev.yml -f docker-compose.override.yml up -d # will start in daemon mode
Connect locally from your machine to database (assumes an update docker-compose.override.yml)
psql -h localhost -p 5432 -U <NAME_OF_POSTGRES_USER>