Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metabase, upgrade postgis #274

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ dockerize/media
dockerize/logs
.editorconfig

# dotenv
.env

# test cache
qgis-app/*/tests/*/cache
qgis-app/api/tests/*/
Expand Down
1 change: 1 addition & 0 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ feedparser==5.1.3
lxml==4.6.5
opml==0.5
psycopg2==2.5.1
psycopg2-binary==2.8
python-ldap==2.4.19
# RPC4DJANGO
git+https://github.com/davidfischer/rpc4django.git
Expand Down
6 changes: 6 additions & 0 deletions dockerize/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DATABASE_NAME=gis
DATABASE_USERNAME=docker
DATABASE_PASSWORD=docker
DATABASE_HOST=db
DJANGO_SETTINGS_MODULE=settings_docker
RABBITMQ_HOST=rabbitmq
4 changes: 2 additions & 2 deletions dockerize/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ dbrestore:
@echo "dropping gis"
@docker exec -t $(PROJECT_ID)-db su - postgres -c "dropdb gis"
@echo "creating gis"
@docker exec -t $(PROJECT_ID)-db su - postgres -c "createdb -O docker -T template_postgis gis"
@docker exec -t $(PROJECT_ID)-db su - postgres -c "createdb -O docker gis"
@echo "restoring gis"
@# Because we pipe from one docker command to another and we are going
@# to execute this Make command from a remote server at times, we need to using use interactive mode (-i)
@# in the first command and not use terminal (-t) in the second. Please do not change these!
@docker exec -t $(PROJECT_ID)-db pg_restore /backups/latest.dmp | docker exec -i $(PROJECT_ID)-db su - postgres -c "psql gis"
@docker exec -t $(PROJECT_ID)-db pg_restore -d gis /backups/latest.dmp
@docker-compose -p $(PROJECT_ID) start web
@echo "starting web container"

Expand Down
240 changes: 128 additions & 112 deletions dockerize/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,117 +1,133 @@
db:
container_name: qgis-plugins-db
image: kartoza/postgis:9.6-2.4
environment:
- ALLOW_IP_RANGE=0.0.0.0/0
- POSTGRES_USER=docker
- POSTGRES_PASS=docker
volumes:
- ./backups:/backups
restart: unless-stopped
version: '3.8'
services:
db:
container_name: qgis-plugins-db
image: kartoza/postgis:15-3.3
environment:
- ALLOW_IP_RANGE=0.0.0.0/0
- POSTGRES_USER=${POSTGRES_USER:-docker}
- POSTGRES_PASS=${POSTGRES_PASS:-docker}
- POSTGRES_DBNAME=${DATABASE_NAME:-gis},${METABASE_DATABASE_NAME:-metabase}
volumes:
- ./backups:/backups
restart: unless-stopped

web:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-web
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- DEBUG=False
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
- worker:worker
restart: unless-stopped
user: root
command: uwsgi --ini /uwsgi.conf
web:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-web
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=${DATABASE_NAME:-gis}
- DATABASE_USERNAME=${DATABASE_USERNAME:-docker}
- DATABASE_PASSWORD=${DATABASE_USERNAME:-docker}
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-settings_docker}
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=${RABBITMQ_HOST:-rabbitmq}
- DEBUG=False
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
depends_on:
- worker
- metabase
restart: unless-stopped
user: root
command: uwsgi --ini /uwsgi.conf

devweb:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-devweb
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
- worker:worker
restart: unless-stopped
user: root
ports:
# for django test server
- "62202:8080"
# for ssh
- "62203:22"
devweb:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-devweb
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=${DATABASE_NAME:-gis}
- DATABASE_USERNAME=${DATABASE_USERNAME:-docker}
- DATABASE_PASSWORD=${DATABASE_USERNAME:-docker}
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-settings_docker}
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=${RABBITMQ_HOST:-rabbitmq}
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
depends_on:
- worker
restart: unless-stopped
user: root
ports:
# for django test server
- "62202:8080"
# for ssh
- "62203:22"

rabbitmq:
image: library/rabbitmq:3.6
hostname: rabbitmq
environment:
- RABBIT_PASSWORD=rabbit_test_password
- USER=rabbit_user
- RABBITMQ_NODENAME=rabbit
restart: unless-stopped
rabbitmq:
image: library/rabbitmq:3.6
hostname: rabbitmq
environment:
- RABBIT_PASSWORD=rabbit_test_password
- USER=rabbit_user
- RABBITMQ_NODENAME=rabbit
restart: unless-stopped

worker:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-worker
build: docker
hostname: uwsgi
working_dir: /home/web/django_project
command: celery -A plugins worker -l info
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
worker:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-worker
build: docker
hostname: uwsgi
working_dir: /home/web/django_project
command: celery -A plugins worker -l info
environment:
- DATABASE_NAME=${DATABASE_NAME:-gis}
- DATABASE_USERNAME=${DATABASE_USERNAME:-docker}
- DATABASE_PASSWORD=${DATABASE_USERNAME:-docker}
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-settings_docker}
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=${RABBITMQ_HOST:-rabbitmq}
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
depends_on:
- db
- rabbitmq

nginx:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-nginx
image: nginx
hostname: nginx
volumes:
- ./sites-enabled:/etc/nginx/conf.d:ro
# I dont use volumes_from as I want to use the ro modifier
- ./static:/home/web/static:ro
- ./static:/home/web/media:ro
- ./logs:/var/log/nginx
links:
- web:uwsgi
ports:
- "62201:8080"
restart: unless-stopped
nginx:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-nginx
image: nginx
hostname: nginx
volumes:
- ./sites-enabled:/etc/nginx/conf.d:ro
# I dont use volumes_from as I want to use the ro modifier
- ./static:/home/web/static:ro
- ./static:/home/web/media:ro
- ./logs:/var/log/nginx
links:
- web:uwsgi
ports:
- "62201:8080"
restart: unless-stopped

metabase:
container_name: metabase
image: metabase/metabase:${METABASE_TAG:-latest}
environment:
- MB_DB_TYPE=postgres
- MB_DB_DBNAME=${METABASE_DATABASE_NAME:-metabase}
- MB_DB_PORT=5432
- MB_DB_USER=${DATABASE_USERNAME:-docker}
- MB_DB_PASS=${DATABASE_PASSWORD:-docker}
- MB_DB_HOST=db
ports:
- "3000:3000"
depends_on:
- db
restart: unless-stopped