summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile13
-rw-r--r--docker/Dockerfile_codeserver19
-rw-r--r--docker/Dockerfile_django23
-rw-r--r--docker/Files/000-default.conf18
-rw-r--r--docker/Files/Docker-script.sh5
-rw-r--r--docker/Files/Start-codeserver.sh7
-rw-r--r--docker/Files/requirements-codeserver.txt6
-rw-r--r--docker/Files/requirements-common.txt9
-rw-r--r--docker/Files/requirements-py2.txt2
-rw-r--r--docker/Files/requirements-py3.txt2
-rw-r--r--docker/Makefile61
-rw-r--r--docker/README.md30
-rw-r--r--docker/docker-compose.yml41
13 files changed, 223 insertions, 13 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
deleted file mode 100644
index cc0fd30..0000000
--- a/docker/Dockerfile
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM ubuntu:16.04
-
-MAINTAINER FOSSEE <pythonsupport@fossee.in>
-
-# Update Packages and Install Python & net-tools
-RUN apt-get update -y && apt-get install git python3-pip vim libmysqlclient-dev sudo -y
-
-RUN apt-get install -y software-properties-common && \
-echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
-add-apt-repository -y ppa:webupd8team/java && \
-apt-get update && \
-apt-get install -y oracle-java8-installer && \
-apt-get install -y python net-tools scilab build-essential python3-numpy python3-scipy ipython3 ipython3-notebook python3-pandas python3-nose
diff --git a/docker/Dockerfile_codeserver b/docker/Dockerfile_codeserver
new file mode 100644
index 0000000..1bc93c2
--- /dev/null
+++ b/docker/Dockerfile_codeserver
@@ -0,0 +1,19 @@
+FROM ubuntu:16.04
+
+MAINTAINER FOSSEE <pythonsupport@fossee.in>
+
+RUN apt-get update -y && apt-get install git python3-pip vim libmysqlclient-dev sudo -y
+
+VOLUME /Sites/online_test
+
+ADD Files/requirements-* /tmp/
+
+RUN pip3 install -r /tmp/requirements-codeserver.txt && mkdir -p /Sites/online_test/yaksh_data/output /Sites/online_test/yaksh_data/data
+
+WORKDIR /Sites/online_test/yaksh_data
+
+ADD Files/Start-codeserver.sh /Sites
+
+EXPOSE 53579
+
+CMD [ "/bin/bash" , "/Sites/Start-codeserver.sh" ]
diff --git a/docker/Dockerfile_django b/docker/Dockerfile_django
new file mode 100644
index 0000000..6b87afb
--- /dev/null
+++ b/docker/Dockerfile_django
@@ -0,0 +1,23 @@
+FROM ubuntu:16.04
+
+MAINTAINER FOSSEE <pythonsupport@fossee.in>
+
+RUN apt-get update -y && apt-get install git python3-pip vim libmysqlclient-dev sudo -y
+
+RUN apt-get install apache2 vim libapache2-mod-wsgi-py3 python3-django -y && mkdir -p /Sites/online_test
+
+VOLUME /Sites/online_test
+
+ADD Files/requirements-* /tmp/
+
+RUN cd /Sites/online_test && pip3 install -r /tmp/requirements-py3.txt
+
+ADD Files/000-default.conf /etc/apache2/sites-enabled/
+
+ADD Files/Docker-script.sh /Sites/Docker-script.sh
+
+EXPOSE 80
+
+WORKDIR /Sites/online_test
+
+CMD [ "/bin/bash" , "/Sites/Docker-script.sh" ]
diff --git a/docker/Files/000-default.conf b/docker/Files/000-default.conf
new file mode 100644
index 0000000..6bcb382
--- /dev/null
+++ b/docker/Files/000-default.conf
@@ -0,0 +1,18 @@
+<VirtualHost *:80>
+ ServerName localhost
+ ServerAdmin webmaster@localhost
+ DocumentRoot /Sites/online_test
+ WSGIDaemonProcess yaksh threads=5 python-path=/usr/local/lib/python3.5/dist-packages home=/Sites/online_test
+ WSGIScriptAlias / /Sites/online_test/online_test/wsgi.py
+ WSGIProcessGroup yaksh
+ Alias /static/ /Sites/online_test/yaksh/static/
+ <Directory /Sites/online_test >
+ WSGIProcessGroup yaksh
+ WSGIApplicationGroup %{GLOBAL}
+ Order deny,allow
+ Allow from all
+ Require all granted
+ </Directory>
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+</VirtualHost>
diff --git a/docker/Files/Docker-script.sh b/docker/Files/Docker-script.sh
new file mode 100644
index 0000000..752a638
--- /dev/null
+++ b/docker/Files/Docker-script.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+chown -R www-data /Sites/online_test
+chmod -R 644 /Sites/online_test
+chmod -R +X /Sites
+/usr/sbin/apache2ctl -D FOREGROUND
diff --git a/docker/Files/Start-codeserver.sh b/docker/Files/Start-codeserver.sh
new file mode 100644
index 0000000..8b6ea96
--- /dev/null
+++ b/docker/Files/Start-codeserver.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+chown -R nobody /Sites/online_test
+chmod -R a+rwX yaksh_data/output
+chmod -R a+rX yaksh_data/data yaksh_data/yaksh
+chmod -R o-w yaksh_data/data yaksh
+chmod -R +X /Sites/online_test/
+/usr/bin/sudo -su nobody python3 -m yaksh.code_server
diff --git a/docker/Files/requirements-codeserver.txt b/docker/Files/requirements-codeserver.txt
new file mode 100644
index 0000000..e9585fa
--- /dev/null
+++ b/docker/Files/requirements-codeserver.txt
@@ -0,0 +1,6 @@
+pytest
+python-decouple
+six
+requests
+tornado
+psutil
diff --git a/docker/Files/requirements-common.txt b/docker/Files/requirements-common.txt
new file mode 100644
index 0000000..b4d2e5b
--- /dev/null
+++ b/docker/Files/requirements-common.txt
@@ -0,0 +1,9 @@
+-r requirements-codeserver.txt
+invoke==0.21.0
+django==1.9.5
+django-taggit==0.18.1
+pytz==2016.4
+python-social-auth==0.2.19
+selenium==2.53.6
+coverage
+ruamel.yaml==0.15.23 \ No newline at end of file
diff --git a/docker/Files/requirements-py2.txt b/docker/Files/requirements-py2.txt
new file mode 100644
index 0000000..38777a1
--- /dev/null
+++ b/docker/Files/requirements-py2.txt
@@ -0,0 +1,2 @@
+-r requirements-common.txt
+mysql-python==1.2.5
diff --git a/docker/Files/requirements-py3.txt b/docker/Files/requirements-py3.txt
new file mode 100644
index 0000000..3d13335
--- /dev/null
+++ b/docker/Files/requirements-py3.txt
@@ -0,0 +1,2 @@
+-r requirements-common.txt
+mysqlclient==1.3.9
diff --git a/docker/Makefile b/docker/Makefile
new file mode 100644
index 0000000..9119601
--- /dev/null
+++ b/docker/Makefile
@@ -0,0 +1,61 @@
+help:
+ @echo "Docker Compose Help for Deploying Yaksh interface"
+ @echo "-----------------------\n"
+ @echo "Clone yaksh online interface from github :"
+ @echo " make clone"
+ @echo ""
+ @echo "Build docker images:"
+ @echo " make build"
+ @echo ""
+ @echo "To run containers:"
+ @echo " make start"
+ @echo ""
+ @echo "You need to create super a user to work with yaksh:"
+ @echo " make createsuperuser"
+ @echo ""
+ @echo "Now Your interface is ready. You can access it using browser just go to http://localhost:8000"
+ @echo ""
+ @echo "Really, really start over:"
+ @echo " make clean"
+ @echo ""
+ @echo "other utilities:restart,tail,status"
+
+begin: migrate fixtures start
+
+clone:
+ @/bin/bash clone-yaksh.sh
+
+start:
+ @docker-compose up -d
+
+stop:
+ @docker-compose stop
+
+status:
+ @docker-compose ps
+
+restart: stop start
+
+clean: stop
+ @docker-compose rm --force
+
+build:
+ @docker-compose build --no-cache
+ @docker pull mariadb:10.2
+
+createsuperuser: migrate superuser
+
+migrate:
+ @docker exec -it yaksh_django python3 manage.py makemigrations
+ @docker exec -it yaksh_django python3 manage.py migrate
+
+superuser:
+ @docker exec -it yaksh_django python3 manage.py createsuperuser
+ @docker exec -it yaksh_django python3 manage.py add_group
+ @docker exec -it yaksh_django python3 manage.py collectstatic
+ @echo "You can access it using browser, just go to http://localhost:8000"
+
+tail:
+ @docker-compose logs -f
+
+.PHONY: start stop status restart clean build migrate tail clone superuser createsuperuser
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 0000000..34e30da
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,30 @@
+#### Pre-Requisites
+
+ 1. Install Docker https://docs.docker.com/engine/installation/
+ 2. Install Docker Compose https://docs.docker.com/compose/install/#install-compose
+ 3. install git
+
+
+#### Help for deploying Yaksh interface.
+
+ - To get help while deployment
+ $ make help
+
+ - Clone yaksh form github:
+ $ make clone
+
+ - Build docker images:
+ $ make build
+
+ - To run containers:
+ $ make start
+
+ - You need to create super a user to work with yaksh:
+ $ make createsuperuser
+
+ - Now Your interface is ready. You can access it using browser just go to http://localhost:8000
+
+ - Clean your docker containers:
+ $ make clean
+
+ - other utilities like restart, tail, status
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
new file mode 100644
index 0000000..747cbda
--- /dev/null
+++ b/docker/docker-compose.yml
@@ -0,0 +1,41 @@
+version: '2'
+services:
+ yaksh-django:
+ build:
+ context: .
+ dockerfile: Dockerfile_django
+ image: yaksh.django
+ container_name: yaksh_django
+ volumes:
+ - ../.:/Sites/online_test
+ depends_on:
+ - yaksh-db
+ - yaksh-codeserver
+ links:
+ - yaksh-db
+ - yaksh-codeserver
+ ports:
+ - 8000:80
+ restart: always
+
+
+ yaksh-codeserver:
+ build:
+ context: .
+ dockerfile: Dockerfile_codeserver
+ image: yaksh.codeserver
+ container_name: yaksh_codeserver
+ volumes:
+ - ../yaksh_data:/Sites/online_test/yaksh_data
+ restart: always
+
+
+ yaksh-db:
+ image: mariadb:10.2
+ container_name: yaksh_db
+ volumes:
+ - ./mysql:/var/lib/mysql
+ environment:
+ MYSQL_ROOT_PASSWORD: root
+ MYSQL_DATABASE: yaksh
+ restart: always