From 90e9a2f18f6c04b4daa3cbdc588f0d4d07347a23 Mon Sep 17 00:00:00 2001 From: Bea Date: Fri, 7 Jan 2022 23:25:03 +0000 Subject: [PATCH 1/2] #40 - ci: Docker configuration --- .dockerignore | 1 + Dockerfile | 18 +++++++ decide/local_settings_docker.py | 90 +++++++++++++++++++++++++++++++++ docker-compose.yml | 19 ++++++- init-mongo.sh | 14 ++--- 5 files changed, 134 insertions(+), 8 deletions(-) create mode 100755 .dockerignore create mode 100755 Dockerfile create mode 100755 decide/local_settings_docker.py mode change 100644 => 100755 docker-compose.yml mode change 100644 => 100755 init-mongo.sh diff --git a/.dockerignore b/.dockerignore new file mode 100755 index 0000000..600e365 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +**/node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..7798175 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1 +FROM node:14 as build +COPY ./decide/administration/frontend /src +WORKDIR /src +RUN npm i -y +RUN npm run build + +FROM python:3 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +WORKDIR /code + +RUN apt-get update +RUN apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY ./decide . +COPY --from=build /src/build ./administration/build diff --git a/decide/local_settings_docker.py b/decide/local_settings_docker.py new file mode 100755 index 0000000..8801df5 --- /dev/null +++ b/decide/local_settings_docker.py @@ -0,0 +1,90 @@ + +import ldap +from django_auth_ldap.config import LDAPSearch, GroupOfNamesType +import os + +# dev env CORS SETTINGS +BASEURL = 'http://localhost:8000' +FE_BASEURL = 'http://localhost:3000' + +CORS_ALLOW_CREDENTIALS = True +CORS_ORIGIN_ALLOW_ALL = False +CORS_ORIGIN_WHITELIST = ( + BASEURL, FE_BASEURL +) +CSRF_TRUSTED_ORIGINS = [ + BASEURL, FE_BASEURL +] + + +# Modules in use, commented modules that you won't use +MODULES = [ + 'administration', + 'authentication', + 'base', + 'booth', + 'census', + 'mixnet', + 'postproc', + 'store', + 'visualizer', + 'voting', +] + + +APIS = { + 'administration': BASEURL, + 'authentication': BASEURL, + 'base': BASEURL, + 'booth': BASEURL, + 'census': BASEURL, + 'mixnet': BASEURL, + 'postproc': BASEURL, + 'store': BASEURL, + 'visualizer': BASEURL, + 'voting': BASEURL, +} + +DATABASES = { + 'default': { + 'ENGINE': 'djongo', + 'NAME': 'db', + 'CLIENT': { + 'username': os.environ.get('MONGO_USER'), + 'password': os.environ.get('MONGO_PASSWORD'), + 'host': os.environ.get('MONGO_HOST'), + 'port': int(os.environ.get('MONGO_PORT')), + 'authSource': os.environ.get('MONGO_NAME'), + 'authMechanism': 'SCRAM-SHA-1' + } + } +} + +# number of bits for the key, all auths should use the same number of bits +KEYBITS = 256 + +# Baseline configuration. +AUTH_LDAP_SERVER_URI = 'ldap://:389' + +AUTH_LDAP_BIND_DN = 'cn=admin,dc=decide,dc=org' +AUTH_LDAP_BIND_PASSWORD = 'decide' +AUTH_LDAP_USER_SEARCH = LDAPSearch( + 'ou=people,dc=decide,dc=org', + ldap.SCOPE_SUBTREE, + '(uid=%(user)s)', +) + +# Populate the Django user from the LDAP directory. +AUTH_LDAP_USER_ATTR_MAP = { + 'first_name': 'cn', + 'last_name': 'sn', + 'email': 'mail', +} + +# Keep ModelBackend around for per-user permissions and maybe a local +# superuser. + +AUTHENTICATION_BACKENDS = [ + 'django.contrib.auth.backends.ModelBackend', + 'django_auth_ldap.backend.LDAPBackend', +] diff --git a/docker-compose.yml b/docker-compose.yml old mode 100644 new mode 100755 index 259f35d..94e10a1 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,10 +7,27 @@ services: - MONGO_INITDB_ROOT_USERNAME=root - MONGO_INITDB_ROOT_PASSWORD=root - MONGO_INITDB_USER=mongo - - MONGO_INITDB_PD=mongo + - MONGO_INITDB_PWD=mongo volumes: - ./init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh - mongo_decide_data:/data/db + ports: + - 27017:27017 + decide: + build: . + command: python manage.py runserver 0.0.0.0:8000 + volumes: + - ./decide:/code + ports: + - "8000:8000" + environment: + - MONGO_NAME=db + - MONGO_USER=mongo + - MONGO_HOST=mongo-decide + - MONGO_PASSWORD=mongo + - MONGO_PORT=27017 + depends_on: + - mongo-decide volumes: mongo_decide_data: {} diff --git a/init-mongo.sh b/init-mongo.sh old mode 100644 new mode 100755 index f2031fe..fd39bc7 --- a/init-mongo.sh +++ b/init-mongo.sh @@ -3,12 +3,12 @@ set -e mongo < Date: Sun, 9 Jan 2022 21:32:38 +0100 Subject: [PATCH 2/2] #40-fix: Decide docker-compose --- Dockerfile | 18 ---- docker-admin/Dockerfile | 17 ++++ .../docker-compose.yml | 2 +- docker-admin/docker-settings.py | 90 +++++++++++++++++++ init-mongo.sh => docker-admin/init-mongo.sh | 0 docker/Dockerfile | 23 ----- docker/Dockerfile-nginx | 3 - docker/docker-compose.yml | 54 ----------- docker/docker-nginx.conf | 24 ----- docker/docker-settings.py | 44 --------- vagrant/Vagrantfile | 80 ----------------- vagrant/database.yml | 16 ---- vagrant/django.yml | 21 ----- vagrant/files.yml | 21 ----- vagrant/files/decide.service | 13 --- vagrant/files/nginx.conf | 24 ----- vagrant/files/settings.py | 45 ---------- vagrant/packages.yml | 22 ----- vagrant/playbook.yml | 17 ---- vagrant/python.yml | 24 ----- vagrant/services.yml | 12 --- vagrant/user.yml | 7 -- 22 files changed, 108 insertions(+), 469 deletions(-) delete mode 100755 Dockerfile create mode 100755 docker-admin/Dockerfile rename docker-compose.yml => docker-admin/docker-compose.yml (84%) create mode 100755 docker-admin/docker-settings.py rename init-mongo.sh => docker-admin/init-mongo.sh (100%) delete mode 100644 docker/Dockerfile delete mode 100644 docker/Dockerfile-nginx delete mode 100644 docker/docker-compose.yml delete mode 100644 docker/docker-nginx.conf delete mode 100644 docker/docker-settings.py delete mode 100644 vagrant/Vagrantfile delete mode 100644 vagrant/database.yml delete mode 100644 vagrant/django.yml delete mode 100644 vagrant/files.yml delete mode 100644 vagrant/files/decide.service delete mode 100644 vagrant/files/nginx.conf delete mode 100644 vagrant/files/settings.py delete mode 100644 vagrant/packages.yml delete mode 100644 vagrant/playbook.yml delete mode 100644 vagrant/python.yml delete mode 100644 vagrant/services.yml delete mode 100644 vagrant/user.yml diff --git a/Dockerfile b/Dockerfile deleted file mode 100755 index 7798175..0000000 --- a/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -# syntax=docker/dockerfile:1 -FROM node:14 as build -COPY ./decide/administration/frontend /src -WORKDIR /src -RUN npm i -y -RUN npm run build - -FROM python:3 -ENV PYTHONDONTWRITEBYTECODE=1 -ENV PYTHONUNBUFFERED=1 -WORKDIR /code - -RUN apt-get update -RUN apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev -COPY requirements.txt . -RUN pip install -r requirements.txt -COPY ./decide . -COPY --from=build /src/build ./administration/build diff --git a/docker-admin/Dockerfile b/docker-admin/Dockerfile new file mode 100755 index 0000000..9bd166e --- /dev/null +++ b/docker-admin/Dockerfile @@ -0,0 +1,17 @@ +# syntax=docker/dockerfile:1 +FROM python:3 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +WORKDIR /app + +RUN apt-get update +RUN apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev + +RUN git clone https://github.com/Full-Tortuga/decide-full-tortuga-admin.git . +RUN pip3 install -r requirements.txt + +WORKDIR /app/decide + +# local settings.py +ADD docker-settings.py /app/decide/local_settings.py +ADD .env /app/decide/.env diff --git a/docker-compose.yml b/docker-admin/docker-compose.yml similarity index 84% rename from docker-compose.yml rename to docker-admin/docker-compose.yml index 94e10a1..ea437db 100755 --- a/docker-compose.yml +++ b/docker-admin/docker-compose.yml @@ -15,7 +15,7 @@ services: - 27017:27017 decide: build: . - command: python manage.py runserver 0.0.0.0:8000 + command: bash -c "python manage.py makemigrations && python manage.py migrate && python manage.py runserver 0.0.0.0:8000" volumes: - ./decide:/code ports: diff --git a/docker-admin/docker-settings.py b/docker-admin/docker-settings.py new file mode 100755 index 0000000..8801df5 --- /dev/null +++ b/docker-admin/docker-settings.py @@ -0,0 +1,90 @@ + +import ldap +from django_auth_ldap.config import LDAPSearch, GroupOfNamesType +import os + +# dev env CORS SETTINGS +BASEURL = 'http://localhost:8000' +FE_BASEURL = 'http://localhost:3000' + +CORS_ALLOW_CREDENTIALS = True +CORS_ORIGIN_ALLOW_ALL = False +CORS_ORIGIN_WHITELIST = ( + BASEURL, FE_BASEURL +) +CSRF_TRUSTED_ORIGINS = [ + BASEURL, FE_BASEURL +] + + +# Modules in use, commented modules that you won't use +MODULES = [ + 'administration', + 'authentication', + 'base', + 'booth', + 'census', + 'mixnet', + 'postproc', + 'store', + 'visualizer', + 'voting', +] + + +APIS = { + 'administration': BASEURL, + 'authentication': BASEURL, + 'base': BASEURL, + 'booth': BASEURL, + 'census': BASEURL, + 'mixnet': BASEURL, + 'postproc': BASEURL, + 'store': BASEURL, + 'visualizer': BASEURL, + 'voting': BASEURL, +} + +DATABASES = { + 'default': { + 'ENGINE': 'djongo', + 'NAME': 'db', + 'CLIENT': { + 'username': os.environ.get('MONGO_USER'), + 'password': os.environ.get('MONGO_PASSWORD'), + 'host': os.environ.get('MONGO_HOST'), + 'port': int(os.environ.get('MONGO_PORT')), + 'authSource': os.environ.get('MONGO_NAME'), + 'authMechanism': 'SCRAM-SHA-1' + } + } +} + +# number of bits for the key, all auths should use the same number of bits +KEYBITS = 256 + +# Baseline configuration. +AUTH_LDAP_SERVER_URI = 'ldap://:389' + +AUTH_LDAP_BIND_DN = 'cn=admin,dc=decide,dc=org' +AUTH_LDAP_BIND_PASSWORD = 'decide' +AUTH_LDAP_USER_SEARCH = LDAPSearch( + 'ou=people,dc=decide,dc=org', + ldap.SCOPE_SUBTREE, + '(uid=%(user)s)', +) + +# Populate the Django user from the LDAP directory. +AUTH_LDAP_USER_ATTR_MAP = { + 'first_name': 'cn', + 'last_name': 'sn', + 'email': 'mail', +} + +# Keep ModelBackend around for per-user permissions and maybe a local +# superuser. + +AUTHENTICATION_BACKENDS = [ + 'django.contrib.auth.backends.ModelBackend', + 'django_auth_ldap.backend.LDAPBackend', +] diff --git a/init-mongo.sh b/docker-admin/init-mongo.sh similarity index 100% rename from init-mongo.sh rename to docker-admin/init-mongo.sh diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 032eed2..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -from python:alpine - -RUN apk add --no-cache git postgresql-dev gcc libc-dev -RUN apk add --no-cache gcc g++ make libffi-dev python3-dev build-base - -RUN pip install gunicorn -RUN pip install psycopg2 -RUN pip install ipdb -RUN pip install ipython - -WORKDIR /app - -RUN git clone https://github.com/wadobo/decide.git . -RUN pip install -r requirements.txt - -WORKDIR /app/decide - -# local settings.py -ADD docker-settings.py /app/decide/local_settings.py - -RUN ./manage.py collectstatic - -#CMD ["gunicorn", "-w 5", "decide.wsgi", "--timeout=500", "-b 0.0.0.0:5000"] diff --git a/docker/Dockerfile-nginx b/docker/Dockerfile-nginx deleted file mode 100644 index 0d991ce..0000000 --- a/docker/Dockerfile-nginx +++ /dev/null @@ -1,3 +0,0 @@ -from nginx:alpine - -ADD docker-nginx.conf /etc/nginx/conf.d/default.conf diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index 095583e..0000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: '3.4' - -services: - db: - restart: always - container_name: decide_db - image: postgres:alpine - volumes: - - db:/var/lib/postgresql/data - networks: - - decide - web: - restart: always - container_name: decide_web - image: decide_web:latest - build: . - command: ash -c "python manage.py migrate && gunicorn -w 5 decide.wsgi --timeout=500 -b 0.0.0.0:5000" - expose: - - "5000" - volumes: - - static:/app/static - depends_on: - - db - networks: - - decide - nginx: - restart: always - container_name: decide_nginx - image: decide_nginx:latest - build: - context: . - dockerfile: Dockerfile-nginx - volumes: - - static:/app/static - ports: - - "8000:80" - depends_on: - - web - networks: - - decide - -volumes: - static: - name: decide_static - db: - name: decide_db - -networks: - decide: - driver: bridge - ipam: - driver: default - config: - - subnet: 10.5.0.0/16 diff --git a/docker/docker-nginx.conf b/docker/docker-nginx.conf deleted file mode 100644 index 2c6e246..0000000 --- a/docker/docker-nginx.conf +++ /dev/null @@ -1,24 +0,0 @@ -server { - listen 80; - - server_name localhost; - root /app; - - location / { - include fastcgi_params; - proxy_pass http://web:5000; - proxy_redirect off; - - proxy_connect_timeout 500; - proxy_read_timeout 500; - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - - location /static { - autoindex on; - alias /app/static; - } -} diff --git a/docker/docker-settings.py b/docker/docker-settings.py deleted file mode 100644 index 4962663..0000000 --- a/docker/docker-settings.py +++ /dev/null @@ -1,44 +0,0 @@ -DEBUG = True - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'postgres', - 'USER': 'postgres', - 'HOST': 'db', - 'PORT': 5432, - } -} - -STATIC_ROOT = '/app/static/' -MEDIA_ROOT = '/app/static/media/' -ALLOWED_HOSTS = ['*'] - -# Modules in use, commented modules that you won't use -MODULES = [ - 'administration', - 'authentication', - 'base', - 'booth', - 'census', - 'mixnet', - 'postproc', - 'store', - 'visualizer', - 'voting', -] - -BASEURL = 'http://10.5.0.1:8000' - -APIS = { - 'administration': 'http://10.5.0.1:8000', - 'authentication': 'http://10.5.0.1:8000', - 'base': 'http://10.5.0.1:8000', - 'booth': 'http://10.5.0.1:8000', - 'census': 'http://10.5.0.1:8000', - 'mixnet': 'http://10.5.0.1:8000', - 'postproc': 'http://10.5.0.1:8000', - 'store': 'http://10.5.0.1:8000', - 'visualizer': 'http://10.5.0.1:8000', - 'voting': 'http://10.5.0.1:8000', -} diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile deleted file mode 100644 index 87c50e7..0000000 --- a/vagrant/Vagrantfile +++ /dev/null @@ -1,80 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# All Vagrant configuration is done below. The "2" in Vagrant.configure -# configures the configuration version (we support older styles for -# backwards compatibility). Please don't change it unless you know what -# you're doing. -Vagrant.configure("2") do |config| - # The most common configuration options are documented and commented below. - # For a complete reference, please see the online documentation at - # https://docs.vagrantup.com. - - # Every Vagrant development environment requires a box. You can search for - # boxes at https://vagrantcloud.com/search. - config.vm.box = "ubuntu/bionic64" - - # Disable automatic box update checking. If you disable this, then - # boxes will only be checked for updates when the user runs - # `vagrant box outdated`. This is not recommended. - # config.vm.box_check_update = false - - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine. In the example below, - # accessing "localhost:8080" will access port 80 on the guest machine. - # NOTE: This will enable public access to the opened port - config.vm.network "forwarded_port", guest: 80, host: 8080 - - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine and only allow access - # via 127.0.0.1 to disable public access - # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" - - # Create a private network, which allows host-only access to the machine - # using a specific IP. - # config.vm.network "private_network", ip: "192.168.33.10" - - # Create a public network, which generally matched to bridged network. - # Bridged networks make the machine appear as another physical device on - # your network. - # config.vm.network "public_network" - - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - # config.vm.synced_folder "../data", "/vagrant_data" - - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # - # config.vm.provider "virtualbox" do |vb| - # # Display the VirtualBox GUI when booting the machine - # vb.gui = true - # - # # Customize the amount of memory on the VM: - # vb.memory = "1024" - # end - - config.vm.provider "virtualbox" do |v| - v.memory = 512 - v.cpus = 1 - end - - # View the documentation for the provider you are using for more - # information on available options. - - # Enable provisioning with a shell script. Additional provisioners such as - # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the - # documentation for more information about their specific syntax and use. - # config.vm.provision "shell", inline: <<-SHELL - # apt-get update - # apt-get install -y apache2 - # SHELL - config.vm.provision "ansible" do |ansible| - ansible.compatibility_mode = '2.0' - ansible.playbook = "playbook.yml" - ansible.extra_vars = { ansible_python_interpreter:"/usr/bin/python3" } - end -end diff --git a/vagrant/database.yml b/vagrant/database.yml deleted file mode 100644 index 13cc476..0000000 --- a/vagrant/database.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: Database - become: true - become_user: postgres - postgresql_db: - name: decide - -- name: Database user - become: true - become_user: postgres - postgresql_user: - db: decide - name: decide - password: decide - priv: ALL - diff --git a/vagrant/django.yml b/vagrant/django.yml deleted file mode 100644 index 4405a29..0000000 --- a/vagrant/django.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Collect static - become: yes - become_user: decide - shell: ~/venv/bin/python manage.py collectstatic --noinput - args: - chdir: /home/decide/decide/decide - -- name: Database migration - become: yes - become_user: decide - shell: ~/venv/bin/python manage.py migrate --noinput - args: - chdir: /home/decide/decide/decide - -- name: Admin superuser - become: yes - become_user: decide - shell: ~/venv/bin/python manage.py shell -c "from django.contrib.auth.models import User; User.objects.filter(username='admin') or User.objects.create_superuser('admin', 'admin@example.com', 'admin')" - args: - chdir: /home/decide/decide/decide diff --git a/vagrant/files.yml b/vagrant/files.yml deleted file mode 100644 index 0ce3739..0000000 --- a/vagrant/files.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: decide sysmtemd service - become: yes - become_user: root - copy: - src: files/decide.service - dest: /etc/systemd/system/decide.service - -- name: nginx.conf file - become: yes - become_user: root - copy: - src: files/nginx.conf - dest: /etc/nginx/conf.d/default.conf - -- name: django local_settings.py - become: yes - become_user: decide - copy: - src: files/settings.py - dest: /home/decide/decide/decide/local_settings.py diff --git a/vagrant/files/decide.service b/vagrant/files/decide.service deleted file mode 100644 index 1e0f042..0000000 --- a/vagrant/files/decide.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=decide - -[Service] -User=decide -Type=simple -PIDFile=/var/run/decide.pid -WorkingDirectory=/home/decide/decide/decide -ExecStart=/home/decide/venv/bin/gunicorn -w 5 decide.wsgi --timeout=500 -b 0.0.0.0:8000 -Restart=always - -[Install] -WantedBy=multi-user.target diff --git a/vagrant/files/nginx.conf b/vagrant/files/nginx.conf deleted file mode 100644 index d9a242f..0000000 --- a/vagrant/files/nginx.conf +++ /dev/null @@ -1,24 +0,0 @@ -server { - listen 80; - - server_name localhost; - root /home/decide/; - - location / { - include fastcgi_params; - proxy_pass http://localhost:8000; - proxy_redirect off; - - proxy_connect_timeout 500; - proxy_read_timeout 500; - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - - location /static { - autoindex on; - alias /home/decide/static; - } -} diff --git a/vagrant/files/settings.py b/vagrant/files/settings.py deleted file mode 100644 index 8acaf79..0000000 --- a/vagrant/files/settings.py +++ /dev/null @@ -1,45 +0,0 @@ -DEBUG = True - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'decide', - 'USER': 'decide', - 'PASSWORD': 'decide', - 'HOST': 'localhost', - 'PORT': 5432, - } -} - -STATIC_ROOT = '/home/decide/static/' -MEDIA_ROOT = '/home/decide/static/media/' -ALLOWED_HOSTS = ['*'] - -# Modules in use, commented modules that you won't use -MODULES = [ - 'administration', - 'authentication', - 'base', - 'booth', - 'census', - 'mixnet', - 'postproc', - 'store', - 'visualizer', - 'voting', -] - -BASEURL = 'http://localhost:8000' - -APIS = { - 'administration': 'http://localhost:8000', - 'authentication': 'http://localhost:8000', - 'base': 'http://localhost:8000', - 'booth': 'http://localhost:8000', - 'census': 'http://localhost:8000', - 'mixnet': 'http://localhost:8000', - 'postproc': 'http://localhost:8000', - 'store': 'http://localhost:8000', - 'visualizer': 'http://localhost:8000', - 'voting': 'http://localhost:8000', -} diff --git a/vagrant/packages.yml b/vagrant/packages.yml deleted file mode 100644 index dc53d18..0000000 --- a/vagrant/packages.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: Install packages - become: true - apt: - name: "{{ packages }}" - update_cache: yes - vars: - packages: - - git - - postgresql - - python3 - - python3-pip - - python3-psycopg2 - - python3-virtualenv - - virtualenv - - nginx - - libpq-dev - - python-setuptools - - build-essential - - python-dev - - make - - m4 diff --git a/vagrant/playbook.yml b/vagrant/playbook.yml deleted file mode 100644 index fc07fd7..0000000 --- a/vagrant/playbook.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- hosts: all - - tasks: - - include: packages.yml - tags: ["packages"] - - include: user.yml - - include: python.yml - tags: ["app"] - - include: files.yml - tags: ["files"] - - include: database.yml - tags: ["database"] - - include: django.yml - tags: ["django"] - - include: services.yml - tags: ["services"] diff --git a/vagrant/python.yml b/vagrant/python.yml deleted file mode 100644 index 3828a12..0000000 --- a/vagrant/python.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Git clone - become: yes - become_user: decide - git: - repo: 'https://github.com/wadobo/decide.git' - dest: /home/decide/decide - version: master - -- name: Python virtualenv - become: yes - become_user: decide - pip: - name: "gunicorn" - virtualenv: /home/decide/venv - virtualenv_python: python3 - -- name: Requirements - become: yes - become_user: decide - pip: - requirements: /home/decide/decide/requirements.txt - virtualenv: /home/decide/venv - virtualenv_python: python3 diff --git a/vagrant/services.yml b/vagrant/services.yml deleted file mode 100644 index 18cbe3d..0000000 --- a/vagrant/services.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Starting services - become: yes - become_user: root - systemd: - state: restarted - enabled: yes - name: "{{ item }}" - loop: - - postgresql - - nginx - - decide diff --git a/vagrant/user.yml b/vagrant/user.yml deleted file mode 100644 index 87c8a19..0000000 --- a/vagrant/user.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Create decide user - become: true - user: - name: decide - comment: Decide app user - state: present