Docker images setup and docker-compose for rancher

This commit is contained in:
Dimas committed 2017-09-22 14:48:00 +07:00
1 parent 4c48bad9dc
commit db6c8be2b3
15 files changed
+167 -36

No files matched your search

-8
View File
@@ -53,14 +53,6 @@ geoserver:
@curl --user tomcat:tomcat http://0.0.0.0:33308/manager/text/stop?path=/geoserver
@curl --user tomcat:tomcat http://0.0.0.0:33308/manager/text/start?path=/geoserver
django:
@echo
@echo "------------------------------------------------------------------"
@echo "Building django container"
@echo "------------------------------------------------------------------"
@docker-compose -p $(PROJECT_ID) build django-app
@docker-compose -p $(PROJECT_ID) up -d django-app
web:
@echo
@echo "------------------------------------------------------------------"
-24
View File
@@ -34,30 +34,6 @@ services:
restart: on-failure
network_mode: "bridge"
django-app:
build: docker-django
hostname: django
environment:
- DATABASE_URL=postgres://docker:docker@postgis:5432/gis
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=postgis
- RABBITMQ_HOST=rabbitmq
- DJANGO_SETTINGS_MODULE=core.settings.prod_docker
- VIRTUAL_HOST=haitidata.com
- VIRTUAL_PORT=8080
# Ensure to change these based on server domain
- SITEURL=http://0.0.0.0:33300/ # change this to ip or domain location
- GEOSERVER_BASE_URL=http://0.0.0.0:33308/geoserver/ # change this to ip or domain geoserver
volumes:
- ./static:/home/web/static:rw
- ./media:/home/web/media:rw
- ./reports:/home/web/reports
- ./logs:/var/log/
user: root
network_mode: "bridge"
uwsgi-base:
# Note you cannot scale if you use conteiner_name
build: ./docker
@@ -1,4 +0,0 @@
#Acquire::http { Proxy "http://192.168.0.106:3142"; };
#Acquire::http { Proxy "http://192.168.2.9:3142"; };
#Acquire::http { Proxy "http://192.168.0.131:3142"; };
#Acquire::http { Proxy "http://192.168.1.13:3142"; };
+12
View File
@@ -0,0 +1,12 @@
SHELL := /bin/bash
build-nginx:
@cd nginx && ./build.sh
build-django:
@cd django_haitidata && ./build.sh
build-db:
@cd db && ./build.sh
build-all: build-db build-nginx build-django
@@ -0,0 +1,13 @@
FROM kartoza/geonode_db
MAINTAINER Kartoza
ENV POSTGRES_USER=docker
ENV POSTGRES_PASS=docker
RUN mkdir -p /fresh-backups/
COPY fresh-database.dmp /fresh-backups/fresh-database.dmp
#RUN su - postgres -c "dropdb --if-exists gis"
#RUN su - postgres -c "dropdb --if-exists geonode_data"
#RUN su - postgres -c "createdb -O docker -T template_postgis gis"
#RUN su - postgres -c "createdb -O docker -T template_postgis geonode_data"
#RUN pg_restore /fresh-backups/fresh-database.dmp | su - postgres -c "psql gis"
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
IMAGE_NAME=haitidata_db
TAG_NAME=latest
docker build -t dimasciput/${IMAGE_NAME} .
docker tag dimasciput/${IMAGE_NAME}:latest dimasciput/${IMAGE_NAME}:${TAG_NAME}
docker push dimasciput/${IMAGE_NAME}:${TAG_NAME}
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
IMAGE_NAME=haitidata_django
TAG_NAME=latest
docker build -t dimasciput/${IMAGE_NAME} .
docker tag dimasciput/${IMAGE_NAME}:latest dimasciput/${IMAGE_NAME}:${TAG_NAME}
docker push dimasciput/${IMAGE_NAME}:${TAG_NAME}
@@ -0,0 +1,52 @@
version: '2'
services:
geoserver:
image: dimasciput/haitidata_geoserver:2.10.x
stdin_open: true
external_links:
- postgis:postgis
tty: true
ports:
- 32208:8080/tcp
labels:
io.rancher.container.pull_image: always
django:
image: dimasciput/haitidata_django
environment:
DATABASE_HOST: postgis
DATABASE_NAME: gis
DJANGO_SETTINGS_MODULE: core.settings.prod_docker
GEOSERVER_PUBLIC_LOCATION: http://88.99.166.60/api/geoserver/
LC_ALL: en_US.UTF-8
RABBITMQ_HOST: rabbitmq
GEOSERVER_BASE_URL: http://88.99.166.60:32208/geoserver/
SITEURL: http://88.99.166.60/
stdin_open: true
volumes:
- django-static-data:/home/web/static:rw
- django-media-data:/home/web/media:rw
tty: true
links:
- postgis:postgis
- geoserver:geoserver
labels:
io.rancher.container.pull_image: always
nginx:
image: dimasciput/haitidata_nginx
stdin_open: true
volumes:
- django-static-data:/home/web/static:ro
- django-media-data:/home/web/media:ro
tty: true
links:
- django:django
- geoserver:geoserver
ports:
- 33303:8080/tcp
labels:
io.rancher.container.pull_image: always
postgis:
image: dimasciput/haitidata_db
environment:
POSTGRES_USER: docker
POSTGRES_PASS: docker
@@ -0,0 +1,3 @@
FROM nginx
ADD sites-enabled/default.conf /etc/nginx/conf.d/default.conf
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
IMAGE_NAME=haitidata_nginx
TAG_NAME=latest
docker build -t dimasciput/${IMAGE_NAME} .
docker tag dimasciput/${IMAGE_NAME}:latest dimasciput/${IMAGE_NAME}:${TAG_NAME}
docker push dimasciput/${IMAGE_NAME}:${TAG_NAME}
@@ -0,0 +1,69 @@
# Define connection details for connecting to django running in
# a docker container.
upstream uwsgi {
server uwsgi:8080;
}
upstream geoserver {
server geoserver:8080;
}
server {
# OTF gzip compression
gzip on;
gzip_min_length 860;
gzip_comp_level 5;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/xml application/x-javascript text/xml text/css application/json;
gzip_disable “MSIE [1-6].(?!.*SV1)”;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# the port your site will be served on
listen 8080;
# the domain name it will serve for
# server_name staging.foss4g-africa.org;
charset utf-8;
# max upload size, adjust to taste
client_max_body_size 500M;
# Django media
location /media {
# your Django project's media files - amend as required
alias /home/web/media;
expires 21d; # cache for 71 days
}
location /static {
# your Django project's static files - amend as required
alias /home/web/static;
expires 21d; # cache for 21 days
}
location /api/geoserver/ {
proxy_pass http://geoserver/geoserver/;
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass uwsgi;
# the uwsgi_params file you installed needs to be passed with each
# request.
# the uwsgi_params need to be passed with each uwsgi request
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
}
}