continuous-integration/drone/tag Build is passing
Details
|
||
---|---|---|
.pgadmin4 | ||
app | ||
db | ||
.drone.yml | ||
.env.dist | ||
.gitignore | ||
.gitlab-ci.yml | ||
.gitmodules | ||
README.md | ||
docker-compose.dev.yaml | ||
docker-compose.override.yaml | ||
docker-compose.yaml |
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
- Clone this repo
git clone git@gitlab.com:champs-libres/docker-cartostation.git
cd docker-cartostation
- Fetch the submodule, that is, the cartostation repo
git submodule init
git submodule update
- 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 databasesapp
: hosting and serving the django apppgadmin
hosting the toolpgadmin
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