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

SPCgeonode #4024

Merged
merged 8 commits into from
Nov 19, 2018
Merged
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
159 changes: 159 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
version: 2.1

jobs:
build:

docker:
- image: circleci/buildpack-deps:trusty

parameters:
load_docker_cache:
type: boolean
save_docker_cache:
type: boolean
test_suite:
type: string
default: ""

steps:

- checkout

- setup_remote_docker

- when:
condition: <<parameters.load_docker_cache>>
steps:
- restore_cache:
keys:
- v1-docker-images-{{ .Branch }}
- run:
name: Load Docker layers cache
command: |
docker load -i ~/docker-layers-cache.tar || true

- run:
name: Build the stack
command: docker-compose -f docker-compose.yml build
working_directory: scripts/spcgeonode/

- when:
condition: <<parameters.save_docker_cache>>
steps:
- run:
name: Save Docker layers cache
command: |
rm -f ~/docker-layers-cache.tar
docker save -o ~/docker-layers-cache.tar $(docker images -a --format "{{.ID}}")
when: always
- save_cache:
key: v1-docker-images-{{ .Branch }}-{{ epoch }}
paths:
- ~/docker-layers-cache.tar
when: always

- run:
name: Start the stack
command: docker-compose -f docker-compose.yml up -d --build
working_directory: scripts/spcgeonode/

- run:
name: Wait for everything to start...
command: |
n=1
m=60
until [ $n -gt $m ]
do
sleep 60
DJANGO_STATUS=$(docker inspect --format="{{json .State.Health.Status}}" spcgeonode_django_1)
GEOSERVER_STATUS=$(docker inspect --format="{{json .State.Health.Status}}" spcgeonode_geoserver_1)
echo ""
echo "Waited $n min (out of $m min)"
if [[ $DJANGO_STATUS == '"healthy"' ]] && [[ $GEOSERVER_STATUS == '"healthy"' ]]; then
break
fi
echo "Not healthy yet..."
docker ps
n=$[$n+1]
done
[[ $DJANGO_STATUS == '"healthy"' ]] && [[ $GEOSERVER_STATUS == '"healthy"' ]];

- run:
name: Show state (debug)
command: docker ps
when: on_fail

- run:
name: Geoserver logs (debug)
command: docker logs spcgeonode_geoserver_1 --tail 500
when: on_fail

- run:
name: Django logs (debug)
command: docker logs spcgeonode_django_1 --tail 500
when: on_fail

- when:
condition: <<parameters.test_suite>>
steps:
- run:
name: Run test suite
command: |
docker-compose -f docker-compose.yml exec django bash -c 'echo "Running <<parameters.test_suite>>"'
docker-compose -f docker-compose.yml exec postgres psql -U postgres -c 'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid();'
docker-compose -f docker-compose.yml exec postgres createdb -U postgres -T postgres test_postgres
docker-compose -f docker-compose.yml run --rm django bash -c 'ASYNC_SIGNALS=False python manage.py test -v 3 --keepdb <<parameters.test_suite>>'
working_directory: scripts/spcgeonode/

workflows:

commit:
jobs:
- build:
name: setup
load_docker_cache: true
save_docker_cache: true
test_suite: 'geonode.tests.smoke'
- build:
name: tests_integration
load_docker_cache: true
save_docker_cache: false
test_suite: 'geonode.tests.integration'
requires:
- setup
- build:
name: tests_core
load_docker_cache: true
save_docker_cache: false
test_suite: $(python -c "import sys;from geonode import settings;sys.stdout.write('\'' '\''.join([a+'\''.tests'\'' for a in settings.GEONODE_CORE_APPS]))")
requires:
- setup
- build:
name: tests_internal
load_docker_cache: true
save_docker_cache: false
test_suite: $(python -c "import sys;from geonode import settings;sys.stdout.write('\'' '\''.join([a+'\''.tests'\'' for a in settings.GEONODE_INTERNAL_APPS]))")
requires:
- setup
- build:
name: tests_contrib
load_docker_cache: true
save_docker_cache: false
test_suite: $(python -c "import sys;from geonode import settings;sys.stdout.write('\'' '\''.join([a+'\''.tests'\'' for a in settings.GEONODE_CONTRIB_APPS]))")
requires:
- setup

nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- spcgeonode-release
- spcgeonode
jobs:
- build:
load_docker_cache: false
save_docker_cache: true
test_suite: geonode.tests.smoke geonode.tests.integration $(python -c "import sys;from geonode import settings;sys.stdout.write('\'' '\''.join([a+'\''.tests'\'' for a in settings.GEONODE_APPS]))")
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ geonode/static/node_modules
docs
.coverage
.celerybeat-*

scripts/spcgeonode/_volume_*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@ geonode\.tests\.bdd\.e2e\.test_login/

/celerybeat.pid
/celerybeat-schedule

scripts/spcgeonode/_volume_*
7 changes: 7 additions & 0 deletions scripts/spcgeonode/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.pyc
Thumbs.db
_volume_*
_service_*
*~
celerybeat-schedule
celeryev.pid
49 changes: 49 additions & 0 deletions scripts/spcgeonode/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
##############################################################
# #
# 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=spcgeonode

# 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=super
ADMIN_PASSWORD=duper
[email protected]

# 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=Pacific/Fiji

# 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=
109 changes: 109 additions & 0 deletions scripts/spcgeonode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Changelog

## Version 2.x

### 2.10rc4.1

- use env var instead of secrets (small benefit in terms of security not worth complexity)
- hardcode rclone S3 configuration (other provider would have to be hardcoded too)
- complete CI tests

### 2.10rc4.0

- adopted Geonode's versions number (with an additionnal level for subreleases)
- moved the setup to the main Geonode repo under `scripts/spcgeonode`, this makes it easier to use as developement setup for Geonode
- use CircleCI (mostly to avoid interfering with existing travis setup)

## Version 0.1.x (Geonode 2.10)

**WARNING** YOU CANNOT UPGRADE FROM 0.0.x to 0.1.x
YOU NEED TO DO A FRESH INSTALL AND MANUALLY TRANSFER THE DATA

### 0.1.1

- improved nginx config (gzip and expiration header)

### 0.1.0

- targetting future 2.10
- removed elastic search container (it was unused anyways)
- removed postgres login hack and using instead Geonode-Geoserver OAuth mecanism
- prebuilt geodatadir used again and master password procedure simplified
- added django healthcheck
- if https is enabled, force redirection to https host (as geonode doesn't support multiple domain names/relative installs)
- django secret generated automatically

## Version 0.0.x (Geonode 2.6)

### 0.0.25

- undo admin users disabled again
- revert using 2.6.x branch (because of side effect - login taking ages)

### 0.0.24

- use Geonode's Geoserver .war build instead of starting from vanilla
- fix thumbnail generation (uses a custom release of Geonode)
- django admin users are again disabled on restart (so we can keep only 1 superuser)
- added travis integration test (try to deploy django then tries to create an user, upload a layer, get the thumbnail and get a tile of the layer)
- changed rclone configuration (you must now provide rclone conf file)
- removed syncthings
- make http(s) ports parametrable in case a port is already busy

### 0.0.23

- various fixes (broken pip dependencies, wrong fix for geoserver proxy, ssl certificate refreshing)

### 0.0.22

- siteurl set using HTTPS_HOST or HTTP_HOST (instead of "/" which isn't supported)

### 0.0.21

- use custom build of geonode (with some fixes not upstreamed yet)

### 0.0.18

- geoserver master password reset is cleaner (programmatically reset the password from initial datadir before first launch)
- support empty HTTP_HOST or HTTPS_HOST
- geosever 2.12.1 => 2.12.2
- cleaned up env vars
- upgrade should work

### 0.0.17

- improve nginx<->letsencrypt (nginx can work without letsencrypt service)

### 0.0.16

- put django in main directory (so it's more clear for deploy builds)

### 0.0.15

- removed rancher template from repo
- removed entryponts and command from django image to prevent what looks like a bug in rancher where empty entrypoint in docker-compose isn't taken into account

### 0.0.11

- added a second backup service using RClone (the idea is to test both syncthings and rclone then choose one)

### 0.0.10

- we don't rely on an initial geodatadir anymore, instead we start from scratch, launch geoserver once, then do our modifications
- added a backup service using Syncthings

### 0.0.9

- fix bug with rancher resolver on rancher

### 0.0.8

- allow to disable/test let's encrypt using env variables
- we use geonode users/groups table directly for geoserver's authentication

### 0.0.7

- have ssl working online
- use env variables / secrets where applicable
- publish on git and autobuild images
- make docker deploy work again
Loading