Skip to content

Commit

Permalink
- Moved secrets to .env file
Browse files Browse the repository at this point in the history
- Added missing trailing slash for pygeoapi, on apache configuration
- Updated README

In addition, the local images were pushed to docker hub, with the exception of mapstore that is not working.
  • Loading branch information
doublebyte1 committed Jul 11, 2022
1 parent 3f5d3eb commit daae0ac
Show file tree
Hide file tree
Showing 10 changed files with 4,498 additions and 4,380 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
66 changes: 33 additions & 33 deletions ES/data/activity_level_ldn.geojson

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions ES/data/cardivasular_disease_ldn.geojson

Large diffs are not rendered by default.

8,566 changes: 4,283 additions & 4,283 deletions ES/data/tweet_count_sample.geojson

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ And then:
docker-compose -f docker-compose-local.yml up -d
```

After building images locally with ```docker-compose-local.yml```, you can push them to docker hub:

```
docker tag openapi-sdi_elastic_search emotionalcities/openapi-sdi_elastic_search
docker tag openapi-sdi_metadata_logstash emotionalcities/openapi-sdi_metadata_logstash
docker tag openapi-sdi_geopackage_pusher emotionalcities/openapi-sdi_geopackage_pusher
docker tag openapi-sdi_postgis emotionalcities/sdi-template-postgis
docker push emotionalcities/openapi-sdi_elastic_search
docker push emotionalcities/openapi-sdi_metadata_logstash
docker push emotionalcities/openapi-sdi_geopackage_pusher
docker push emotionalcities/sdi-template-postgis
```

The `docker-compose.yml` is designed for production and it includes a web server. Launch it with:

```
Expand All @@ -99,6 +112,21 @@ You can read more about docker-compose on this [link](https://docs.docker.com/co

Regardless the composition you choosen, when all goes well, pygeoapi will be available at port 80 of the host: http://localhost.

## Environment Variables

This compositions read secrets from an environment file on this folder: ```.env```.

Create this file with the following format, replacing "SOMEPASSWORD" by reasonable values.

```
POSTGRES_PASSWORD="SOMEPASSWORD"
POSTGRES_DB="SOMEPASSWORD"
POSTGRES_USER="SOMEPASSWORD"
MINIO_ROOT_USER="SOMEPASSWORD"
MINIO_ROOT_PASSWORD="SOMEPASSWORD"
```


## Troubleshooting

If you cannot launch the docker-composition due to permission errors, try this:
Expand Down
4 changes: 2 additions & 2 deletions apache-httpd/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -567,5 +567,5 @@ ProxyPassReverse /mapstore http://mapstore:8080/mapstore
ProxyPass /dashboard http://kibana:5601 Keepalive=On
ProxyPassReverse /dashboard http://kibana:5601

ProxyPass / http://pygeoapi_es:80 Keepalive=On
ProxyPassReverse / http://pygeoapi_es:80
ProxyPass / http://pygeoapi_es:80/ Keepalive=On
ProxyPassReverse / http://pygeoapi_es:80/
14 changes: 9 additions & 5 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ services:
postgis:
build: ./postgis/
environment:
POSTGRES_PASSWORD: G1rlP0w3r
POSTGRES_DB: geodb
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
env_file:
- .env # path to your .env file
expose:
- 5432
volumes:
Expand All @@ -138,10 +140,12 @@ services:
DB_BACKEND: POSTGRES
HOST: postgis
POSTGRES_PORT: 5432
POSTGRES_DB: geodb
POSTGRES_USER: postgres
POSTGRES_PASS: G1rlP0w3r
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASS: ${POSTGRES_PASSWORD}
GEOSERVER_DATA_DIR: /var/local/geoserver
env_file:
- .env # path to your .env file
volumes:
- ./geoserver/data_geoserver:/var/local/geoserver
- ./geoserver/data_geoserver/gwc:/var/local/geoserver-gwc
Expand Down
6 changes: 4 additions & 2 deletions docker-compose-minio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ services:
- 9000:9000
- 9001:9001
environment:
MINIO_ROOT_USER: pygeoapi
MINIO_ROOT_PASSWORD: pygeoapi
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
env_file:
- .env # path to your .env file
networks:
- minioNet
volumes:
Expand Down
113 changes: 96 additions & 17 deletions docker-compose-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,49 +37,53 @@ services:
container_name: pygeoapi_es
entrypoint:
- /es-entrypoint.sh
ports:
- 80:80
networks:
- proxynet
- default
volumes:
- ./pygeoapi/docker.config.local.yml:/pygeoapi/local.config.yml
#- ./pygeoapi/docker.config.yml:/pygeoapi/local.config-orig.yml
- ./pygeoapi/docker.config.yml:/pygeoapi/local.config.yml
- ./pygeoapi/es-entrypoint.sh:/es-entrypoint.sh
- ./pygeoapi/wait-for-elasticsearch.sh:/wait-for-elasticsearch.sh
- ./ES/data:/data
networks:
- proxynet
- default
links:
- elastic_search

depends_on:
- elastic_search

elastic_search:
image: emotionalcities/openapi-sdi_elastic_search
container_name: elastic
environment:
- "discovery.type=single-node"
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.type=single-node"
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "logger.level=WARN"
ulimits:
memlock:
soft: -1
hard: -1

memlock:
soft: -1
hard: -1
ports:
- 9300:9300
- 9200:9200
volumes:
- elastic_search_data:/usr/share/elasticsearch/data
- ./ES/data:/in
networks:
- default

kib01:
image: docker.elastic.co/kibana/kibana:7.5.1
container_name: kibana
ports:
- 5601:5601
environment:
ELASTICSEARCH_URL: http://elastic:9200
ELASTICSEARCH_HOSTS: '["http://elastic:9200"]'
SERVER_BASEPATH: /dashboard
#SERVER_HOST: emotional.byteroad.net
networks:
- default

metadata_logstash:
image: emotionalcities/openapi-sdi_metadata_logstash
Expand All @@ -88,10 +92,13 @@ services:
ELASTICSEARCH_URL: http://elastic:9200
ELASTICSEARCH_HOSTS: '["http://elastic:9200"]'
XPACK_MONITORING_ENABLED: 'false'
LOG_LEVEL: 'error'
links:
- elastic_search
depends_on:
- elastic_search
networks:
- default

geopackage_pusher:
image: emotionalcities/openapi-sdi_geopackage_pusher
Expand All @@ -104,15 +111,87 @@ services:
depends_on:
- elastic_search
command: bash -c "/docker-entrypoint.sh"
networks:
- default

postgis:
#build: ./postgis/
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
env_file:
- .env # path to your .env file
expose:
- 5432
volumes:
- postgis_data:/var/lib/postgresql/data
ports:
- "5432:5432"
container_name: postgis
image: emotionalcities/sdi-template-postgis

geoserver:
#build: ./geoserver/
expose:
- 8009
environment:
DB_BACKEND: POSTGRES
HOST: postgis
POSTGRES_PORT: 5432
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASS: ${POSTGRES_PASSWORD}
GEOSERVER_DATA_DIR: /var/local/geoserver
env_file:
- .env # path to your .env file
volumes:
- ./geoserver/data_geoserver:/var/local/geoserver
- ./geoserver/data_geoserver/gwc:/var/local/geoserver-gwc
- ./geoserver/ec_data/geopackage:/home/tomcat/ec_data/geopackage
container_name: geoserver
image: emotionalcities/geoserver

mapstore:
#build: ./mapstore/
expose:
- 8080
environment:
- "JAVA_OPTS=-Dgeostore-ovr=file:///usr/local/tomcat/conf/geostore-datasource-ovr.properties "
volumes:
- ./mapstore/geostore-datasource-ovr.properties:/usr/local/tomcat/conf/geostore-datasource-ovr.properties
depends_on:
- postgis
container_name: mapstore
image: emotionalcities/sdi-template-mapstore

apache-httpd:
image: httpd:2.4
depends_on:
- pygeoapi
- mapstore
- geoserver
volumes:
- "/etc/letsencrypt/archive/emotional.byteroad.net/fullchain1.pem:/usr/local/apache2/conf/emotional/fullchain1.pem"
- "/etc/letsencrypt/archive/emotional.byteroad.net/privkey1.pem:/usr/local/apache2/conf/emotional/privkey1.pem"
- "/etc/letsencrypt/archive/oldskool.byteroad.net/fullchain1.pem:/usr/local/apache2/conf/oldskool/fullchain1.pem"
- "/etc/letsencrypt/archive/oldskool.byteroad.net/privkey1.pem:/usr/local/apache2/conf/oldskool/privkey1.pem"
- ./apache-httpd/httpd-ssl.conf:/usr/local/apache2/conf/httpd.conf
ports:
- "80:80"
- "443:443"
container_name: apache-httpd

volumes:
elastic_search_data: {}
geoserver_data:
driver: local
geoserver_gwc_data:
driver: local
postgis_data:
driver: local

networks:
default:
driver: bridge
proxynet:
name: minioNet # Minio's network

#NOTE: Host requires changes in configuration to run ES
#sudo sysctl -w vm.max_map_count=262144
14 changes: 9 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ services:
postgis:
#build: ./postgis/
environment:
POSTGRES_PASSWORD: G1rlP0w3r
POSTGRES_DB: geodb
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
env_file:
- .env # path to your .env file
expose:
- 5432
volumes:
Expand All @@ -148,10 +150,12 @@ services:
DB_BACKEND: POSTGRES
HOST: postgis
POSTGRES_PORT: 5432
POSTGRES_DB: geodb
POSTGRES_USER: postgres
POSTGRES_PASS: G1rlP0w3r
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASS: ${POSTGRES_PASSWORD}
GEOSERVER_DATA_DIR: /var/local/geoserver
env_file:
- .env # path to your .env file
volumes:
- ./geoserver/data_geoserver:/var/local/geoserver
- ./geoserver/data_geoserver/gwc:/var/local/geoserver-gwc
Expand Down

0 comments on commit daae0ac

Please sign in to comment.