Files
Okupa_mi_coche_-_Spring_boo…/docker

Okupa mi coche - Docker containers for the backend

Guide for seting up a local development environment for the backend.

Setup

  1. Install Docker in local machine
  2. Add following line to /etc/hosts
127.0.0.1       okupamicoche-keycloak okupamicoche-synapse
  1. Run dockerized Keycloak
cd docker/keycloak
docker run --name okupamicoche-keycloak -p 8080:8080 -p 8443:8443 -v $(pwd)/https:/etc/x509/https \
-e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin --network=okupamicoche \
-e KEYCLOAK_IMPORT=/tmp/realm.json -v $(pwd)/okupamicoche-realm-export.json:/tmp/realm.json quay.io/keycloak/keycloak:12.0.4
  1. Go to https://localhost:8443/auth/admin/master/console and login with user=admin pass=admin
  2. In Clients -> synapse -> Credentials push Regenerate Secret and copy the secret
  3. Open docker/synapse/data/homeserver.yaml and paste the secret to client_secret variable (inside oidc_providers section)
  4. Build Synapse container
cd docker/synape
docker build -t okupamicoche-synapse .
  1. Generate data folder for Synapse
docker run -it --rm \
    --mount type=volume,src=synapse-data,dst=/data \
    -e SYNAPSE_SERVER_NAME=okupamicoche-synapse \
    -e SYNAPSE_REPORT_STATS=no \
    okupamicoche-synapse generate
  1. Run dockerized Synapse
docker run --name okupamicoche-synapse -p 8008:8008 --mount type=volume,src=synapse-data,dst=/data \
-e SYNAPSE_CONFIG_PATH=/homeserver.yaml \
-v $(pwd)/homeserver.yaml:/homeserver.yaml -v $(pwd)/okupamicoche-appservice.yaml:/okupamicoche-appservice.yaml \
--network=okupamicoche okupamicoche-synapse
  1. (Optional) Add keycloak certificate to local machine Some clients (Quaternion, Nheko) fail with self-signed certificates. You can install the root certificate (docker/synape/keycloak-root.crt) in you local machine. For example, in Linux:
sudo cp docker/synape/keycloak-root.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

Run

docker start okupamicoche-keycloak docker start okupamicoche-synapse

Inspect containter

docker exec -t -i okupamicoche-synapse /bin/bash