]> git.parisson.com Git - timeside.git/commitdiff
Add Dockerfile and deploy conf files docker
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 1 Oct 2014 02:11:10 +0000 (04:11 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 1 Oct 2014 02:11:10 +0000 (04:11 +0200)
Dockerfile [new file with mode: 0644]
README.rst
deploy/apt-app.list [new file with mode: 0644]
deploy/nginx-app.conf [new file with mode: 0644]
deploy/supervisor-app.conf [new file with mode: 0644]
timeside/server/sandbox/settings.py
timeside/server/sandbox/uwsgi.ini [new file with mode: 0644]
timeside/server/sandbox/wsgi.py

diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..afd3beb
--- /dev/null
@@ -0,0 +1,49 @@
+# Copyright 2013 Thatcher Peskens
+# Copyright 2014 Guillaume Pellerin
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from debian:stable
+
+maintainer Guillaume Pellerin <yomguy@parisson.com>
+
+add ./deploy/apt-app.list /etc/apt/sources.list.d/
+run apt-get update
+run apt-get install -y build-essential vim
+run apt-get install -y python python-dev python-pip
+run apt-get -y -t wheezy-backports dist-upgrade
+run apt-get install -y --force-yes -t wheezy-backports nginx supervisor python-timeside git python-tables python-django python-traits python-networkx
+run apt-get clean
+
+# install uwsgi now because it takes a little while
+run pip install uwsgi
+
+# clone app
+add . /opt/TimeSide
+
+# setup all the configfiles
+run echo "daemon off;" >> /etc/nginx/nginx.conf
+run rm /etc/nginx/sites-enabled/default
+run ln -s /opt/TimeSide/deploy/nginx-app.conf /etc/nginx/sites-enabled/
+run ln -s /opt/TimeSide/deploy/supervisor-app.conf /etc/supervisor/conf.d/
+
+# run pip install
+run pip install -e /opt/TimeSide
+
+# sandbox setup
+run /opt/TimeSide/timeside/server/sandbox/manage.py syncdb --noinput
+run /opt/TimeSide/timeside/server/sandbox/manage.py migrate --noinput
+run /opt/TimeSide/timeside/server/sandbox/manage.py collectstatic --noinput
+
+expose 80
+cmd ["supervisord", "-n"]
index 4c195bd4dec0eacb96525768a40af796f3d740ee..f1dd89568c9732a7cd454fedcd933da77afa0c33 100644 (file)
@@ -450,10 +450,11 @@ To start the web server through the container::
 
 Then browse http://localhost:9000/api/
 
-To start a development process, it is advised to checkout the dev branch::
+To start a new development, it is advised to checkout the dev branch and build your own container::
 
-  cd /root/apps/TimeSide
+  cd TimeSide
   git checkout dev
+  sudo docker build .
 
 
 Sponsors and Partners
diff --git a/deploy/apt-app.list b/deploy/apt-app.list
new file mode 100644 (file)
index 0000000..647b260
--- /dev/null
@@ -0,0 +1,10 @@
+deb http://ftp.debian.org/debian/ wheezy-backports main contrib non-free
+deb-src http://ftp.debian.org/debian/ wheezy-backports main contrib non-free
+
+deb http://security.debian.org/ wheezy/updates main
+deb-src http://security.debian.org/ wheezy/updates main
+
+deb http://debian.parisson.com/debian/ wheezy main
+deb-src http://debian.parisson.com/debian wheezy main
+
+deb ftp://ftp.igh.cnrs.fr/pub/debian-multimedia stable main
\ No newline at end of file
diff --git a/deploy/nginx-app.conf b/deploy/nginx-app.conf
new file mode 100644 (file)
index 0000000..fe04fac
--- /dev/null
@@ -0,0 +1,37 @@
+# mysite_nginx.conf
+
+# the upstream component nginx needs to connect to
+upstream django {
+    server unix:/opt/TimeSide/timeside/server/sandbox/app.sock; # for a file socket
+    # server 127.0.0.1:8001; # for a web port socket (we'll use this first)
+    }
+
+# configuration of the server
+server {
+    # the port your site will be served on, default_server indicates that this server block
+    # is the block to use if no blocks match the server_name
+    listen      80 default_server;
+
+    # the domain name it will serve for
+    server_name .example.com; # substitute your machine's IP address or FQDN
+    charset     utf-8;
+
+    # max upload size
+    client_max_body_size 75M;   # adjust to taste
+
+    # Django media
+    location /media  {
+        alias /opt/TimeSide/timeside/server/sandbox/media;  # your Django project's media files - amend as required
+    }
+
+    # Uncomment in production!
+    location /static {
+        alias /var/www/static; # your Django project's static files - amend as required
+    }
+
+    # Finally, send all non-media requests to the Django server.
+    location / {
+        uwsgi_pass  django;
+        include     /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
+        }
+    }
diff --git a/deploy/supervisor-app.conf b/deploy/supervisor-app.conf
new file mode 100644 (file)
index 0000000..6138d61
--- /dev/null
@@ -0,0 +1,5 @@
+[program:app-uwsgi]
+command = /usr/local/bin/uwsgi --ini /opt/TimeSide/timeside/server/sandbox/uwsgi.ini
+
+[program:nginx-app]
+command = /usr/sbin/nginx
index 1cd5c1066a8d392ee9799ea54aa46c422bba52ce..2890b1f090db5a900b20fdd007b17d0e8a36143a 100644 (file)
@@ -60,13 +60,13 @@ MEDIA_ROOT = PROJECT_ROOT + '/media/'
 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
 # trailing slash.
 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
-MEDIA_URL = ''
+MEDIA_URL = '/media/'
 
 # Absolute path to the directory static files should be collected to.
 # Don't put anything in this directory yourself; store your static files
 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
 # Example: "/home/media/media.lawrence.com/static/"
-STATIC_ROOT = ''
+STATIC_ROOT = '/var/www/static'
 
 # URL prefix for static files.
 # Example: "http://media.lawrence.com/static/"
diff --git a/timeside/server/sandbox/uwsgi.ini b/timeside/server/sandbox/uwsgi.ini
new file mode 100644 (file)
index 0000000..94bd251
--- /dev/null
@@ -0,0 +1,31 @@
+[uwsgi]
+# this config will be loaded if nothing specific is specified
+# load base config from below
+ini = :base
+
+# %d is the dir this configuration file is in
+socket = %dapp.sock
+master = true
+processes = 4
+
+[dev]
+ini = :base
+# socket (uwsgi) is not the same as http, nor http-socket
+socket = :8001
+
+
+[local]
+ini = :base
+http = :8000
+# set the virtual env to use
+home=/home/me/.virtualenv
+
+
+[base]
+# chdir to the folder of this config file, plus app/website
+chdir = %d
+# load the module from wsgi.py, it is a python path from
+# the directory above.
+module=wsgi
+# allow anyone to connect to the socket. This is very permissive
+chmod-socket=666
index c4d2c7481453bbe3316b0bb50e1ca45828bbfb17..cf8e7eb5243e1ab0ca1f1c533d720a92d0d16f9f 100644 (file)
@@ -15,7 +15,7 @@ framework.
 """
 import os
 
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sandbox.settings")
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
 
 # This application object is used by any WSGI server configured to use this
 # file. This includes Django's development server, if the WSGI_APPLICATION