aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorAlex Franco <alejandro.franco@linux.intel.com>2015-08-31 22:16:34 +0000
committerPaul Eggleton <paul.eggleton@linux.intel.com>2015-10-07 11:34:34 +0100
commit4daaf718db4650002e98ffd3819d2d6164e80404 (patch)
tree758212e60f893c8a072d825e90c06de7dba5dc13 /docker
parent8da2194bb62af9bf88647d8e96eacf977ba77218 (diff)
downloadopenembedded-core-contrib-4daaf718db4650002e98ffd3819d2d6164e80404.tar.gz
Docker based environment setup
Replicate production setup in Docker containers [YOCTO #7575] Signed-off-by: Alex Franco <alejandro.franco@linux.intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'docker')
-rw-r--r--docker/.gitconfig11
-rw-r--r--docker/README26
-rwxr-xr-xdocker/git-proxy12
-rwxr-xr-xdocker/migrate.sh2
-rw-r--r--docker/nginx.conf47
-rwxr-xr-xdocker/updatelayers.sh9
6 files changed, 107 insertions, 0 deletions
diff --git a/docker/.gitconfig b/docker/.gitconfig
new file mode 100644
index 0000000000..f3ab3722cf
--- /dev/null
+++ b/docker/.gitconfig
@@ -0,0 +1,11 @@
+# This .gitconfig file resides in /root/ in the "layersapp" container
+# add any settings you'd like to have in there, such as proxy servers
+[http]
+ #proxy = http://your.proxy.server:port
+[https]
+ #proxy = https://your.proxy.server:port
+[core]
+ # Optional: uncomment this line if you want to use a proxy script
+ #gitproxy = /opt/bin/git-proxy
+[socks]
+ #proxy = your.socks.proxy:port
diff --git a/docker/README b/docker/README
new file mode 100644
index 0000000000..14bc392fd9
--- /dev/null
+++ b/docker/README
@@ -0,0 +1,26 @@
+## This is set up to make a cluster of three containers. First we build two from the root of the repo.
+docker build -t halstead/layerindex-app .
+docker build -t halstead/layerindex-web -f Dockerfile.web .
+
+## Start a database server. We use MariaDB in production.
+## In order to configure your settings.py file to use this database server, use:
+## 'ENGINE': 'django.db.backends.mysql',
+## 'NAME': 'layersdb',
+## 'USER': 'root',
+## 'PASSWORD': 'testingpw',
+## 'HOST': 'layersdb',
+## 'PORT': '',
+docker run -d --name layerdb -e MYSQL_ROOT_PASSWORD=testingpw -e MYSQL_DATABASE=layersdb mariadb
+
+## If you have a copy of the the production data now is the time to insert it.
+## If not you can skip the next step for a clean install.
+xzcat ./layerdb.sql.xz | docker run -i --link layerdb:layersdb --rm mariadb sh -c 'exec mysql -hlayersdb -uroot -p"testingpw" layersdb'
+
+docker run -d --link layerdb:layersdb --name layersapp halstead/layerindex-app
+docker run -d --link layersapp:layersapp --name layersweb -p 49153:80 halstead/layerindex-web
+
+## To apply layerindex migration
+docker run --rm --link layerdb:layersdb halstead/layerindex-app /opt/migrate.sh
+
+## To update the layer info we can run the job in a temporary container.
+docker run --rm --link layerdb:layersdb halstead/layerindex-app /opt/updatelayers.sh
diff --git a/docker/git-proxy b/docker/git-proxy
new file mode 100755
index 0000000000..9fd844e981
--- /dev/null
+++ b/docker/git-proxy
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# This simple proxy script (for git) resides at /opt/bin in the layersapp
+# container. If you use it, uncomment the appropriate line in .gitproxy
+# this method has been tested using a socks proxy
+PROXY=your.proxy.server
+PORT=portnumber
+
+METHOD="-X 5 -x ${PROXY}:${PORT}"
+
+# BSD netcat is used to connect
+/bin/nc $METHOD $*
diff --git a/docker/migrate.sh b/docker/migrate.sh
new file mode 100755
index 0000000000..ea394c339b
--- /dev/null
+++ b/docker/migrate.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+python /opt/layerindex/manage.py migrate layerindex
diff --git a/docker/nginx.conf b/docker/nginx.conf
new file mode 100644
index 0000000000..7afc3a80b9
--- /dev/null
+++ b/docker/nginx.conf
@@ -0,0 +1,47 @@
+#daemon off; ##Included in CMD
+error_log /dev/stdout info;
+worker_processes 1;
+
+# user nobody nogroup;
+pid /tmp/nginx.pid;
+
+events {
+ worker_connections 1024;
+ accept_mutex off;
+}
+
+http {
+ include mime.types;
+ default_type application/octet-stream;
+ access_log /dev/stdout combined;
+ sendfile on;
+
+ upstream app_server {
+ # For a TCP configuration:
+ server layersapp:5000 fail_timeout=0;
+ }
+
+ server {
+ listen 80 default;
+ client_max_body_size 4G;
+ server_name _;
+
+ keepalive_timeout 5;
+
+ # path for static files
+ root /usr/share/nginx/html;
+
+ location / {
+ try_files $uri @proxy_to_app;
+ }
+
+ location @proxy_to_app {
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header Host $http_host;
+ proxy_redirect off;
+
+ proxy_pass http://app_server;
+ }
+
+ }
+}
diff --git a/docker/updatelayers.sh b/docker/updatelayers.sh
new file mode 100755
index 0000000000..50c73bfbd4
--- /dev/null
+++ b/docker/updatelayers.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+update=/opt/layerindex/layerindex/update.py
+$update -q -r
+$update -b jethro -x -r -q
+$update -b fido -x -r -q
+$update -b dizzy -x -r -q
+$update -b daisy -x -r -q
+$update -b dora -x -r -q
+$update -b dylan -x -r -q