Go to file
Julie Lenaerts 3546e6d4f7
continuous-integration/drone/tag Build is passing Details
update commit reference raponmap
2023-09-20 12:23:05 +02:00
.pgadmin4 various corrections on docker-compose 2022-02-04 15:51:17 +01:00
app update commit reference raponmap 2023-09-20 12:23:05 +02:00
db DX reorganize data files 2023-08-23 12:07:05 +02:00
.drone.yml FEATURE [statistics] activate statistics app 2023-07-04 15:25:25 +02:00
.env.dist change path of webpack options without beginning slash 2023-04-19 11:13:10 +02:00
.gitignore ignore env file 2023-04-18 16:03:50 +02:00
.gitlab-ci.yml Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist 2022-02-04 13:11:06 +00:00
.gitmodules update submodules with new gitea repositories 2023-03-28 16:06:50 +02:00
README.md DX adjust readme and commit ref raponmap 2023-07-13 10:31:04 +02:00
docker-compose.dev.yaml FEATURE [flatpage] add ckeditor instead of plain text field 2023-05-22 12:37:28 +02:00
docker-compose.override.yaml setup everything for deployment 2023-03-23 17:06:49 +01:00
docker-compose.yaml DX [docker] update several files to build image correctly including gis static files 2023-05-11 11:22:01 +02:00

README.md

docker-cartostation

Implementation of CartoStation with docker-compose.

This repo contains a docker-compose file that install cartostation from source and build containers for developping a cartostation app.

Installation

  1. Clone this repo
git clone git@gitlab.com:champs-libres/docker-cartostation.git
cd docker-cartostation
  1. Fetch the submodule, that is, the cartostation repo
git submodule init
git submodule update
  1. Build the container
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up

A pgadmin client already lives at http://localhost:8081/ with UN blop@blop.com and PW blipblop. You should be able to see the "cartostation" database but it will be empty.

Post-installation

Install postgis-loader and raponmap application

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml exec --user root app pip install -e ../../postgis-loader
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml exec --user root app pip install -e ../../raponmap

Execute Django migrations

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml exec app python3 manage.py migrate

Create a Django superuser

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml exec app python3 manage.py createsuperuser

Now you should be able to have access to the admin at http://localhost:8000/admin (maybe restart the containers once).

Build client applications

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml run --rm app-clients npm i
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml run --rm app-clients ./build.sh login dashboard view compose alias embed metadata
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml stop
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up

Voilà, you should have a webpage showing cartostation on http://localhost:8000/.

Working with submodules

On a fresh install, submodules projects (i.e., cartostation and cs-ibge) are fetched from their repo with git submodule init && git submodule update. When modifying these projects, you should cd to these projects and commit there:

cd app/src/carto-station
git pull
git add .
git commit -m ""
git push

NB: For just pulling these submodules, you can either go to each directory as described above and make git pull or do it for all submodules using git submodule foreach git pull.

Architecture

The project is build around dockers containers :

  • some containers are used for running the app & db. They have to run for using the solution.
  • some others are used for processing some punctual tasks. It is possible to use the solution even if they are not running.

The containers that serve the solution are :

  • db : hosting the databases
  • app : hosting and serving the django app
  • pgadmin hosting the tool pgadmin

The containers that process punctual tasks are :

  • app-clients : used to build the clients (typescript applications)

The settings.py file of the Django app is mounted from app/settings.py.dist to the right location in the app sources.

To enter the containers

Example, in the db container, to list all databases in the db

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml exec --user 1000 db bash
bash-5.1$ psql -U postgres
postgres=# \l

Example, in the app container, to execute a migration

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml exec --user root app bash
I have no name!@3b16cdb96881:/src/carto-station/sdi$ python3 manage.py migrate

Example, in the app container, to add a missing Python dependency (a root access is needed)

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml exec --user root app bash
root@3b16cdb96881:/src/carto-station/sdi$ pip install sorl-thumbnail

Exemple, in the app-clients container, to build/watch a client you're working on

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml run --rm app-clients bash
I have no name!@92d42ffb06b0:/src/carto-station/clients$ ./watch.sh view