WIP.
Todo:
- Update Dockerfiles in master branches of all GIT repo
- Mount CMS frontend
Dockerfiles and docker compose working for DEV machine. This setup is meant for development work, for deploying to production we have a helm repository.
A collection of subrepo's of the main servers of the Openstad application. Currently the branches are on the development branches. Soon we will update all the code to master.
Since this repo is working with subrepo's make sure you pull all of them first time, for instance:
git submodule update --init --recursive
Firstcreate the .env before running docker-compose the first time. On first startup docker compose will create the databases, changes after first startup you have to manually do them by logging into mysql through shell or a db tool like sqlpro, or just destroy the database volumes and start over. This step only makes sure the databases exists, the tables filling the databases are created in the next step.
Create a .env file based upon the .env for development, put it in the root next to docker-compose. This will run the CMS as https://localhost:4444/. Login token will be generated by following env value: AUTH_FIRST_CLIENT_LOGIN_CODE
Start up docker-compose, it will build the images and start the container. The first time building the images might take a while. The argument --d tells docker-compose to run in the background
docker-compose up --d
For now, for dev, the migrations have to be run manually. There are a few settings in the databases that need to be set correctly for it all to work together. This works in combination with above .env values. Any changes in .env values after running the seeds might require database changes.
1.1 Create the api site entries (runs both basic migrations and seeds.). This seed run will empty the tables, so don't use once running.
It will create the database based based upon the definitions of sequalizer, then it will set all migrations to marked.
Any future changes in database can be run run wih node migrate.js.
docker-compose exec api node reset.js
2.1 Create the tables for the Auth server
docker-compose exec auth knex migrate:latest
2.2 Seed the table for the Auth server. This seed run will empty the tables, so don't use once running.
docker-compose exec auth knex seed:run
3.1 Create the tables for the Image server
docker-compose exec image knex migrate:latest
3.2 Seed the tables for the Image server. This seed run will empty the tables, so don't use once running.
docker-compose exec image knex seed:run
There is a basic auth in the CMS login flow, will be removed soon but untill then, credentials are managed by the following env file:
FRONTEND_LOGIN_CSM_BASIC_AUTH_USER=me
FRONTEND_LOGIN_CSM_BASIC_AUTH_PASSWORD=password
Docker compose creates the databases set in .env file on first run. If name is changed you will either have to recreate the mysql volume, or manually change or add the database. Port 3310 is open, so you can access docker database on https://localhost:3310, for instance with sqlpro. Or log into the docker shell: docker-compose exec mysql sh
Everything takes a bit longer, sometimes it takes a while,
docker system prune
docker-compose doesn't always seem to reload env values if you change the .env file.
To force it:
For all containers: docker-compose up --force-recreate
For one container docker-compose up --force-recreate frontend
Sometimes it's necessary to rebuild