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

Site branding update #392

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f7a37c6
Upgrade the stack from Django 2.2 to 3.2 (#233)
Gustry Aug 21, 2022
d4c8550
Update docker compose (#256)
dimasciput Aug 21, 2022
4a2431a
Fix docker-compose and dockerfile
Xpirix Nov 22, 2023
ada9b42
Merge branch 'master' of github.com:Xpirix/QGIS-Django into update_dj…
Xpirix Nov 22, 2023
a8349fd
Init starting docker dev environment
Xpirix Nov 22, 2023
ee066d2
Fixing docker container conflict, updating whoosh
Xpirix Nov 23, 2023
303bad8
Update testfiles and feedback test
Xpirix Nov 23, 2023
8559721
Update dockerfile for dev and prod
Xpirix Nov 23, 2023
8c46fed
Merge branch 'master' into update_django
Xpirix Feb 12, 2024
04c5ffe
Use main branch for whoosh in requirements
Xpirix Feb 13, 2024
a947f26
Merge branch 'master' of github.com:Xpirix/QGIS-Django into new_host_…
Xpirix Mar 20, 2024
16434e4
Django 4 update: Requirements, dockerfile and docker-compose
Xpirix Mar 21, 2024
c93fac6
Django 4 update: fixes for ifequal, ugettext_lazy, django.conf.urls.u…
Xpirix Mar 21, 2024
6e50f73
Django 4 update: Fix deprecated readfp
Xpirix Mar 21, 2024
63cfd3e
Django 4 update: update dbrestore in Makefile
Xpirix Mar 21, 2024
9d250fc
Django 4 update: Get static, media and backup volumes from the enviro…
Xpirix Mar 21, 2024
9dfbd35
Django 4 update: Use solr thumbnail default engine
Xpirix Mar 21, 2024
bd64930
Django 4 update: Fix Django warnings
Xpirix Mar 21, 2024
56f0ca8
Django 4 update: fix depecated tests, new migrations
Xpirix Mar 22, 2024
f0119d5
Django 4 update: Update django unit tests
Xpirix Mar 22, 2024
ecf9d40
Django 4 update: Add email environment variables
Xpirix Mar 22, 2024
e488644
Django 4 update: Nginx and uwsgi updates
Xpirix Mar 22, 2024
26de6e1
Django 4 update: Refactoring dockerfile
Xpirix Mar 22, 2024
1921119
Update makefile to use new docker compose
Xpirix Mar 27, 2024
c112431
Django 4 update: Specify devweb container_name, fix typo
Xpirix Mar 27, 2024
4466e94
Use existing nginx configuration
Xpirix Mar 27, 2024
d5483dd
Add DEFAULT_PLUGINS_SITE to environment variables
Xpirix Mar 28, 2024
ce76edc
Add nginx dev and prod configuration files
Xpirix Apr 2, 2024
9abe60f
Django 4 update: Generate a .env file in GH actions
Xpirix Apr 2, 2024
d6a7b2b
Django 4 update: Fix typo in Makefile
Xpirix Apr 2, 2024
fe4dd07
Django 4 update: Use updated docker compose in test.yaml
Xpirix Apr 2, 2024
0529d52
Django 4 update: Certbot service and SSL configuration
Xpirix Apr 5, 2024
b660449
Add a http configuration for Nginx
Xpirix Apr 16, 2024
68fc44e
Django 4 update: add SSL cert renewal script
Xpirix Apr 23, 2024
5042052
Implement webpack and bulma in the project
Xpirix Apr 25, 2024
f6e67f3
Fix second navigation bar
Xpirix Apr 26, 2024
7cc4f1b
Init footer implementation
Xpirix Apr 26, 2024
528e20d
New design for footer
Xpirix May 2, 2024
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dockerize/postgres_data
20 changes: 14 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,23 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Run docker-compose build
run: docker-compose build
- name: Generate the .env file
run: cp .env.template .env

- name: Run the containers
run: docker-compose up -d db devweb
- name: Run docker compose build
run: docker compose build devweb

- name: Run docker compose services
working-directory: dockerize
run: |
cp docker-compose.override.test.yml docker-compose.override.yml
make devweb-test
make wait-db
make create-test-db

- name: Run Coverage test
run: |
cat << EOF | docker-compose exec -T devweb bash
cat << EOF | docker compose exec -T devweb bash
pip install coverage
python manage.py makemigrations
python manage.py migrate
Expand All @@ -64,7 +72,7 @@ jobs:
EOF

- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ static_media
dockerize/static
dockerize/media
dockerize/logs
dockerize/certbot-etc
dockerize/webroot
.editorconfig

# test cache
Expand All @@ -51,3 +53,11 @@ qgis-app/api/tests/*/

# whoosh_index
qgis-app/whoosh_index/
docker-compose.override.yml
.env

# Webpack
qgis-app/node_modules/
qgis-app/package-lock.json
qgis-app/webpack-stats.json
qgis-app/static/webpack-bundles
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"files.associations": {
"**/*.html": "html",
"**/templates/*/*.html": "django-html",
"**/templates/*": "django-txt",
"**/requirements{/**,*}.{txt,in}": "pip-requirements"
},

"emmet.includeLanguages": {
"django-html": "html"
},
"beautify.language": {
"html": [
"htm",
"html",
"django-html"
]
}
}
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ $ make dbrestore

## Deploy Update with Rancher

**TO BE DEPRECATED**

- Go to [https://rancher.qgis.org](https://rancher.qgis.org)
- Click the home icon in the top left corner, and choose the environment: `plugins.qgis.org`
- You will be redirected to User Stacks page, choose the plugins stack by clicking on `plugins` link
Expand Down
18 changes: 12 additions & 6 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
Django==2.2.25
Django==3.2.11

# Currently broken with 'no module named defaults' error
#Feedjack==0.9.18
# So use George's fork rather
# git+https://github.com/Erve1879/feedjack.git
# George's is also broken: use my fork (django 1.8 ready)
git+https://github.com/elpaso/feedjack.git
# George's is also broken: use elpaso fork (django 1.8 ready)
# git+https://github.com/elpaso/feedjack.git
# His is also broken, use dimasciput (django 3.2 ready)
git+https://github.com/dimasciput/feedjack.git

Markdown==2.3.1
#PIL==1.1.7
Pillow
Pygments==2.7.4

# Updates for Django 2 & Python 3.7
git+https://github.com/Xpirix/whoosh.git@a306553
git+https://github.com/Xpirix/whoosh.git@main
pickle5==0.0.12
django-haystack==3.2.1

Expand All @@ -21,16 +25,18 @@ argparse==1.2.1
django-annoying==0.7.7
django-auth-ldap==1.2.6
django-autoslug==1.7.1
django-debug-toolbar==1.11.1
django-debug-toolbar==3.2.4
django-endless-pagination==2.0
django-extensions==1.2.0
django-generic-aggregation==0.3.2
#django-olwidget==0.61.0 unmaintained, use this fork
git+https://github.com/Christophe31/olwidget.git
django-pagination==1.0.7

# Unmaintained!
#django-ratings==0.3.7
git+https://github.com/enikesha/django-ratings.git
git+https://github.com/gelo-zhukov/django-ratings.git

django-simple-ratings==0.3.2
# SIMPLEMENU
git+https://github.com/elpaso/django-simplemenu.git
Expand Down
31 changes: 31 additions & 0 deletions dockerize/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# RabbitMQ host
RABBITMQ_HOST=rabbitmq

# Database variables
DATABASE_NAME=gis
DATABASE_USERNAME=docker
DATABASE_PASSWORD=docker
DATABASE_HOST=db

# Django settings
DJANGO_SETTINGS_MODULE=settings_docker
DEBUG=False

# Docker volumes
QGISPLUGINS_STATIC_VOLUME=static-data
QGISPLUGINS_MEDIA_VOLUME=media-data
QGISPLUGINS_BACKUP_VOLUME=backups-data

# Email variables
EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST=''
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=''
EMAIL_HOST_PASSWORD=''

# URL
DEFAULT_PLUGINS_SITE='https://plugins.qgis.org/'

# ENV: debug or prod
QGISPLUGINS_ENV=debug
110 changes: 83 additions & 27 deletions dockerize/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,70 @@ build:
@echo "------------------------------------------------------------------"
@echo "Building in production and development mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) build
@docker compose -p $(PROJECT_ID) build

build-dev:
@echo
@echo "------------------------------------------------------------------"
@echo "Building in development mode only"
@echo "------------------------------------------------------------------"
@docker compose -p $(PROJECT_ID) build devweb

db:
@echo
@echo "------------------------------------------------------------------"
@echo "Running db in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) up -d db
@docker compose -p $(PROJECT_ID) up -d db

metabase: db
@echo
@echo "------------------------------------------------------------------"
@echo "Running metabase in production mode"
@echo "------------------------------------------------------------------"
@docker compose -p $(PROJECT_ID) up -d metabase

web: db
@echo
@echo "------------------------------------------------------------------"
@echo "Running in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) up -d web
@docker compose -p $(PROJECT_ID) up -d uwsgi web worker beat

dbbackups: db
@echo
@echo "------------------------------------------------------------------"
@echo "Running dbbackups in production mode"
@echo "------------------------------------------------------------------"
@docker compose -p $(PROJECT_ID) up -d dbbackups

certbot: web
@echo
@echo "------------------------------------------------------------------"
@echo "Running cerbot in production mode"
@echo "------------------------------------------------------------------"
@docker compose -p $(PROJECT_ID) up -d certbot

devweb-test: db
@echo
@echo "------------------------------------------------------------------"
@echo "Running in TESTING mode"
@echo "------------------------------------------------------------------"
@docker compose up --no-deps -d devweb

devweb: db
@echo
@echo "------------------------------------------------------------------"
@echo "Running in DEVELOPMENT mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) up --no-deps -d devweb
@docker compose -p $(PROJECT_ID) up --no-deps -d rabbitmq worker beat

devweb-runserver: devweb
@echo
@echo "------------------------------------------------------------------"
@echo "Running in DEVELOPMENT mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) exec devweb python manage.py runserver 0.0.0.0:8080
@docker compose -p $(PROJECT_ID) up devweb webpack

migrate:
@echo
Expand All @@ -54,26 +89,26 @@ migrate:
@# We add the '-' prefix to the next line as the migration may fail
@# but we want to continue anyway.
@#We need to migrate accounts first as it has a reference to user model
-@docker-compose -p $(PROJECT_ID) exec web python manage.py migrate auth
@docker-compose -p $(PROJECT_ID) exec web python manage.py migrate
-@docker compose -p $(PROJECT_ID) exec uwsgi python manage.py migrate auth
@docker compose -p $(PROJECT_ID) exec uwsgi python manage.py migrate

update-migrations:
@echo
@echo "------------------------------------------------------------------"
@echo "Running update migrations in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) exec web python manage.py makemigrations
@docker compose -p $(PROJECT_ID) exec uwsgi python manage.py makemigrations

collectstatic:
@echo
@echo "------------------------------------------------------------------"
@echo "Collecting static in production mode"
@echo "------------------------------------------------------------------"
#@docker-compose -p $(PROJECT_ID) run uwsgi python manage.py collectstatic --noinput
@docker compose -p $(PROJECT_ID) run uwsgi python manage.py collectstatic --noinput
#We need to run collect static in the same context as the running
# uwsgi container it seems so I use docker exec here
# no -it flag so we can run over remote shell
@docker exec $(PROJECT_ID)-web python manage.py collectstatic --noinput
# @docker exec $(PROJECT_ID)-web python manage.py collectstatic --noinput

reload:
@echo
Expand All @@ -89,7 +124,7 @@ kill:
@echo "------------------------------------------------------------------"
@echo "Killing in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) kill
@docker compose -p $(PROJECT_ID) kill

rm: rm-only

Expand All @@ -98,38 +133,59 @@ rm-only: kill
@echo "------------------------------------------------------------------"
@echo "Removing production instance!!! "
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) rm
@docker compose -p $(PROJECT_ID) rm

maillogs:
@echo
@echo "------------------------------------------------------------------"
@echo "Showing smtp logs in production mode"
@echo "------------------------------------------------------------------"
@docker compose exec smtp tail -f /var/log/mail.log

mailerrorlogs:
@echo
@echo "------------------------------------------------------------------"
@echo "Showing smtp error logs in production mode"
@echo "------------------------------------------------------------------"
@docker compose exec smtp tail -f /var/log/mail.err

dbrestore:
@echo
@echo "------------------------------------------------------------------"
@echo "Restore dump from backups/latest.dmp in production mode"
@echo "------------------------------------------------------------------"
@# - prefix causes command to continue even if it fails
@echo "stopping web container"
@docker-compose -p $(PROJECT_ID) stop web
@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"
@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-compose -p $(PROJECT_ID) start web
@echo "starting web container"
@echo "stopping uwsgi container"
@docker compose -p $(PROJECT_ID) stop uwsgi
@echo "Dropping the gis and metabase databases"
-@docker compose -p $(PROJECT_ID) exec db su - postgres -c "dropdb --force gis"
-@docker compose -p $(PROJECT_ID) exec db su - postgres -c "dropdb --force metabase"
@echo "Creating the gis and metabase databases"
-@docker compose -p $(PROJECT_ID) exec db su - postgres -c "createdb -O docker -T template1 gis"
-@docker compose -p $(PROJECT_ID) exec db su - postgres -c "createdb -O docker -T template1 metabase"
@echo "Restore database from backups/latest-gis.dmp"
-@docker compose -p $(PROJECT_ID) exec db su - postgres -c "pg_restore -c /backups/latest-gis.dmp -d gis"
-@docker compose -p $(PROJECT_ID) exec db su - postgres -c "pg_restore -c /backups/latest-metabase.dmp -d metabase"
@echo "starting uwsgi container"
@docker compose -p $(PROJECT_ID) up -d uwsgi

wait-db:
@docker compose -p $(PROJECT_ID) exec db su - postgres -c "until pg_isready; do sleep 5; done"

create-test-db:
@docker compose -p $(PROJECT_ID) exec db su - postgres -c "psql -c 'create database test_db;'"
@docker compose -p $(PROJECT_ID) exec db su - postgres -c "psql -d test_db -c 'create extension postgis;'"

dbseed:
@echo
@echo "------------------------------------------------------------------"
@echo "Seed db with JSON data from /fixtures/*.json"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) exec devweb bash -c 'python manage.py loaddata fixtures/*.json'
@docker compose -p $(PROJECT_ID) exec devweb bash -c 'python manage.py loaddata fixtures/*.json'

rebuild_index:
@echo
@echo "------------------------------------------------------------------"
@echo "Rebuild search index in PRODUCTION mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) exec web bash -c 'python manage.py rebuild_index'
@docker compose -p $(PROJECT_ID) exec uwsgi bash -c 'python manage.py rebuild_index'
Loading
Loading