From 923a0bb4dcc5a5e2ddad70faf6b16df13e3f89fc Mon Sep 17 00:00:00 2001 From: Adar Nimrod Date: Sun, 18 Jul 2021 22:42:20 +0300 Subject: [PATCH] Dump of previous work. --- .env.example | 9 --------- .gitignore | 5 +---- Dockerfile | 9 +++++++++ Procfile | 1 - README.rst | 7 ++----- Vagrantfile | 11 ----------- docker-compose.yml | 25 +++++++++++++++++++++++++ fabfile.py | 12 ------------ requirements.txt | 2 -- 9 files changed, 37 insertions(+), 44 deletions(-) delete mode 100644 .env.example create mode 100644 Dockerfile delete mode 100644 Procfile delete mode 100644 Vagrantfile create mode 100644 docker-compose.yml delete mode 100755 fabfile.py diff --git a/.env.example b/.env.example deleted file mode 100644 index 463e650..0000000 --- a/.env.example +++ /dev/null @@ -1,9 +0,0 @@ -SECRET_KEY='7t^^#zw41ol8v*to-ti*jx7)iq@-=l9jquq1!5f!e02o!j2xyu' -DEBUG="True" -ALLOWED_HOSTS="*" -DB_NAME="realestate" -DB_USER="realestate" -DB_PASSWORD="password" -DB_HOST="localhost" -APP_HOST="localhost" -#SECURE_COOKIES="False" diff --git a/.gitignore b/.gitignore index bf41971..e37e8c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ -*.swp -*.swo +*.sw[p|o] *~ ~* *.pyc -.vagrant -.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c3acbb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM debian:jessie +ENV DEBIAN_FRONTEND noninteractive +RUN apt-get update && \ + apt-get install -y python3 python3-dev python3-pip python3-psycopg2 && \ + apt-get clean +COPY ./ /app +WORKDIR /app +RUN pip3 install --requirement requirements.txt +CMD [ "gunicorn" ] diff --git a/Procfile b/Procfile deleted file mode 100644 index fe5d7eb..0000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -app: gunicorn diff --git a/README.rst b/README.rst index dcd8fab..f80224a 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ django-realestate -***************** +################# A Django application for managing real estate listings. This is also an exercise in building a 12-factor application. @@ -15,7 +15,4 @@ Usage TODO ---- -- Provisioning (Fabric for DB hosts, App hosts, maybe Cache hosts, using - environment variables, SystemD service for App with setting under - /etc/default). -- Investigate default environment in Honcho. +- Better workflow with Docker Compose (for example, migrations and testing). diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 5cb3287..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,11 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure(2) do |config| - config.vm.box = "debian/jessie64" - config.vm.synced_folder ".", "/vagrant", disabled: true - config.vm.provision "shell", inline: <<-SHELL - sudo apt-get update - sudo apt-get install -yf postgresql redis-server - SHELL -end diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..47b7b82 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +app: + build: . + ports: + - 80:80 + environment: + SECRET_KEY: '7t^^#zw41ol8v*to-ti*jx7)iq@-=l9jquq1!5f!e02o!j2xyu' + DEBUG: True + ALLOWED_HOSTS: * + DB_NAME: realestate + DB_USER: realestate + DB_PASSWORD: password + DB_HOST: localhost + APP_HOST: localhost + volumes: + - ./:/app + links: + - db + - redis +db: + image: postgres + environment: + POSTGRES_PASSWORD: password + POSTGRES_USER: realestate + POSTGRES_DB: realestate +redis: diff --git a/fabfile.py b/fabfile.py deleted file mode 100755 index 254bd52..0000000 --- a/fabfile.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -from fabric.api import env, task, hosts -import os - - -env.use_ssh_config = True - - -@task -@hosts(os.environ['APP_HOST']) -def deploy(): - raise NotImplemented diff --git a/requirements.txt b/requirements.txt index 4ab59e7..0a2e686 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,2 @@ Django>=1.8 gunicorn -honcho -fabric -- GitLab