Skip to content

Commit

Permalink
[Release] Version 1.0.0 : #320 from kartoza/develop
Browse files Browse the repository at this point in the history
Version 1.0.0
  • Loading branch information
meomancer authored Jan 18, 2021
2 parents 3e72451 + 6a5d859 commit ae37c3b
Show file tree
Hide file tree
Showing 98 changed files with 7,938 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.idea/
*__pycache__/
*logs/
deployment/static/
deployment/media/
deployment/volumes/
celery.log
django_project/worker.state
django_project/celerybeat-schedule
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "django_project/gwml2"]
path = django_project/gwml2
url = https://github.com/kartoza/gwml2.git
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
# IGRAC-GGIS
# IGRAC-GGIS

## QUICK INSTALLATION GUIDE
```
git clone https://github.com/kartoza/IGRAC-GGIS.git
cd IGRAC-GGIS/deployment
make build
make up
make collectstatic
```

The web will be available at `http://localhost/`

To stop containers:
```
make kill
```

To stop and delete containers:
```
make rm
```
65 changes: 65 additions & 0 deletions deployment/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
##############################################################
# #
# SPCgeonode Settings #
# #
# The defauts settings are suited for testing on localhost. #
# If you're deploying SPCgeonode for production, you need to #
# adapt the following settings #
# #
# DO NOT FORGET to also modify values in _secrets ! #
# #
##############################################################

# Name of the setup (you only need to change this if you run several instances of the stack)
COMPOSE_PROJECT_NAME=igrac

# IP or domain name and port where the server can be reached on HTTPS (leave HOST empty if you want to use HTTP only)
HTTPS_HOST=
HTTPS_PORT=443

# IP or domain name and port where the server can be reached on HTTP (leave HOST empty if you want to use HTTPS only)
HTTP_HOST=127.0.0.1
HTTP_PORT=80

# Email where alters should be sent. This will be used by let's encrypt and as the django admin email.
ADMIN_USERNAME=admin
ADMIN_PASSWORD=kartoza_pass
ADMIN_EMAIL=admin@example.com

# Database environment
POSTGRES_USER=postgres
## PostgreSQL superuser password (to be set if PostgreSQL is exposed)
POSTGRES_PASSWORD=postgres
## geonode specific variables
## the standart geonode django database with non-spatial data
## the db name and username are identical by design
GEONODE_DATABASE=geonode
GEONODE_DATABASE_USER=geonode
GEONODE_DATABASE_PASSWORD=geonode
## the spatial geonode django postigs database for data ingestion
## the db name and username are identical by design
GEONODE_GEODATABASE=geonode_data
GEONODE_GEODATABASE_USER=geonode_data
GEONODE_GEODATABASE_PASSWORD=geonode

# Django secret key (replace this by any complex and random string)
SECRET_KEY=1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ

# Let's Encrypt certificates for https encryption. You must have a domain name as HTTPS_HOST (doesn't work
# with an ip) and it must be reachable from the outside. This can be one of the following :
# disabled : we do not get a certificate at all (a placeholder certificate will be used)
# staging : we get staging certificates (are invalid, but allow to test the process completely and have much higher limit rates)
# production : we get a normal certificate (default)
LETSENCRYPT_MODE=disabled

# Choose from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TIME_ZONE=UTC

# Whether users should be able to create accounts themselves
REGISTRATION_OPEN=True

# Rclone backup configuration for Amazon S3 (leave empty if you don't want to use S3)
S3_ACCESS_KEY=
S3_SECRET_KEY=
S3_REGION=
S3_BUCKET=
154 changes: 154 additions & 0 deletions deployment/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
PROJECT_ID := igrac

SHELL := /bin/bash

# ----------------------------------------------------------------------------
# P R O D U C T I O N C O M M A N D S
# ----------------------------------------------------------------------------
default: web
run: build web collectstatic

deploy: run
@echo
@echo "------------------------------------------------------------------"
@echo "Bringing up fresh instance "
@echo "You can access it on http://localhost"
@echo "------------------------------------------------------------------"

web:
@echo
@echo "------------------------------------------------------------------"
@echo "Running in production mode"
@echo "------------------------------------------------------------------"
@# Dont confuse this with the dbbackup make command below
@# This one runs the postgis-backup cron container
@# We add --no-recreate so that it does not destroy & recreate the db container
@docker-compose up -d

dev:
@echo
@echo "------------------------------------------------------------------"
@echo "Running in dev mode"
@echo "------------------------------------------------------------------"
@docker-compose ${ARGS} up -d dev

build:
@echo
@echo "------------------------------------------------------------------"
@echo "Building in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) build

dev-shell:
@echo
@echo "------------------------------------------------------------------"
@echo "Shelling in in dev mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) exec dev /bin/bash

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

nginx:
@echo
@echo "------------------------------------------------------------------"
@echo "Running nginx in production mode"
@echo "Normally you should use this only for testing"
@echo "In a production environment you will typically use nginx running"
@echo "on the host rather if you have a multi-site host."
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) up -d nginx
@echo "Site should now be available at http://localhost"

up: web

status:
@echo
@echo "------------------------------------------------------------------"
@echo "Show status for all containers"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) ps

kill:
@echo
@echo "------------------------------------------------------------------"
@echo "Killing in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) stop

rm: kill
@echo
@echo "------------------------------------------------------------------"
@echo "Removing production instance!!! "
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) down

shell:
@echo
@echo "------------------------------------------------------------------"
@echo "Shelling in in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) exec django /bin/bash

db-bash:
@echo
@echo "------------------------------------------------------------------"
@echo "Entering DB Bash in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) exec db sh

db-shell:
@echo
@echo "------------------------------------------------------------------"
@echo "Entering PostgreSQL Shell in production mode"
@echo "------------------------------------------------------------------"
docker-compose -p $(PROJECT_ID) exec db su - postgres -c "psql"

geoserver-shell:
@echo
@echo "------------------------------------------------------------------"
@echo "Entering Geoserver Shell in in production mode"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) exec geoserver sh

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

reload:
@echo
@echo "------------------------------------------------------------------"
@echo "Reload django project in production mode"
@echo "------------------------------------------------------------------"
# no -it flag so we can run over remote shell
@docker exec $(PROJECT_ID)_django_1 django --reload /tmp/django.pid

migrate:
@echo
@echo "------------------------------------------------------------------"
@echo "Running migrate static in production mode"
@echo "------------------------------------------------------------------"
@docker-compose exec django python manage.py migrate

# --------------- help --------------------------------

help:
@echo "* **build** - builds all required containers."
@echo "* **up** - runs all required containers."
@echo "* **kill** - kills all running containers. Does not remove them."
@echo "* **logs** - view the logs of all running containers. Note that you can also view individual logs in the deployment/logs directory."
@echo "* **nginx** - builds and runs the nginx container."
@echo "* **permissions** - Update the permissions of shared volumes. Note this will destroy any existing permissions you have in place."
@echo "* **rm** - remove all containers."
@echo "* **shell-frontend-mapstore** - open a bash shell in the frontend mapstore (where django runs) container."
Loading

0 comments on commit ae37c3b

Please sign in to comment.