From 6b98c91fadfc3930a6d6f00166da196d48ae7196 Mon Sep 17 00:00:00 2001 From: Adarsh Murthy Date: Tue, 11 Apr 2017 11:17:59 -0400 Subject: [PATCH 1/6] Add Dockerfile, Dockerrun.aws.json, config files and .elasticbeanstalk files --- .elasticbeanstalk/config.yml | 12 ++++++ Dockerfile | 78 ++++++++++++++++++++++++++++++++++++ Dockerrun.aws.json | 16 ++++++++ config/nginx.conf | 34 ++++++++++++++++ config/supervisor.conf | 5 +++ config/uwsgi.ini | 22 ++++++++++ 6 files changed, 167 insertions(+) create mode 100644 .elasticbeanstalk/config.yml create mode 100644 Dockerfile create mode 100644 Dockerrun.aws.json create mode 100644 config/nginx.conf create mode 100644 config/supervisor.conf create mode 100644 config/uwsgi.ini diff --git a/.elasticbeanstalk/config.yml b/.elasticbeanstalk/config.yml new file mode 100644 index 0000000..cd558c9 --- /dev/null +++ b/.elasticbeanstalk/config.yml @@ -0,0 +1,12 @@ +branch-defaults: + $GIT_BRANCH: + environment: $EB_ENV +global: + application_name: $EB_APP + default_ec2_keyname: EastCoastBPKey + default_platform: 64bit Amazon Linux 2015.09 v2.0.8 running Docker 1.9.1 + default_region: us-east-1 + profile: null + sc: git +deploy: + artifact: deployment.zip diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d8d1b6b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,78 @@ +# Dockerfile + +# FROM directive instructing base image to build upon +FROM ubuntu:16.10 + +ENV CODEROOT=/home/docker/code + +# Log enironment variables. +ENV NGINXERR=/var/log/nginx.err.log +ENV NGINXREQ=/var/log/nginx.req.log +ENV UWSGIERR=/var/log/uwsgi.err.log +ENV UWSGIREQ=/var/log/uwsgi.req.log + +# Custom environment variables. These change from project to project. +ARG DOMAIN +ENV DOMAIN=${DOMAIN} +ARG NUM_PROCESSES +ENV NUM_PROCESSES=${NUM_PROCESSES} +ARG NUM_THREADS +ENV NUM_THREADS=${NUM_THREADS} + +# Add the nginx reposoitory. We need 1.8 in order to support adding CORS headers to error responses. +RUN apt-get update +RUN apt-get install -y --no-install-recommends software-properties-common +RUN add-apt-repository ppa:nginx/stable + +# Install dependencies. +RUN apt-get update +RUN apt-get install -y --no-install-recommends python3 python3-software-properties python3-dev python3-setuptools python3-pip +RUN apt-get install -y --no-install-recommends nginx supervisor +RUN apt-get install -y --no-install-recommends build-essential git +RUN apt-get install -y --no-install-recommends libpq-dev +RUN apt-get install -y libpcre3 libpcre3-dev +RUN pip3 install uwsgi -I +RUN rm -rf /var/lib/apt/lists/* + +COPY ./requirements.txt $CODEROOT/requirements.txt + +# Install application requirements. +RUN pip3 install -r $CODEROOT/requirements.txt + +# Put the code somewhere. +ADD . $CODEROOT/ + +# Create the www user. +RUN useradd -ms /bin/bash www + +# Create the log files. +RUN \ + touch $NGINXERR && touch $NGINXREQ && \ + touch $UWSGIERR && touch $UWSGIREQ + +RUN \ + replace_vars() { \ + echo "Copying environment variables from $1 to $2."; \ + sed -e "s/\$DOMAIN/$DOMAIN/g" \ + -e "s@\$CODEROOT@$CODEROOT@g" \ + -e "s@\$NUM_PROCESSES@$NUM_PROCESSES@g" \ + -e "s@\$NUM_THREADS@$NUM_THREADS@g" \ + -e "s@\$NGINXERR@$NGINXERR@g" \ + -e "s@\$NGINXREQ@$NGINXREQ@g" \ + -e "s@\$UWSGIERR@$UWSGIERR@g" \ + -e "s@\$UWSGIREQ@$UWSGIREQ@g" $1 > $2; \ + }; \ + replace_vars $CODEROOT/config/nginx.conf /etc/nginx/nginx.conf && \ + replace_vars $CODEROOT/config/supervisor.conf /etc/supervisor/conf.d/supervisor.conf && \ + replace_vars $CODEROOT/config/uwsgi.ini $CODEROOT/uwsgi.ini + +# Make migrations +RUN cd $CODEROOT && python3 manage.py migrate --noinput + +# Collect static files +RUN cd $CODEROOT && python3 manage.py collectstatic --noinput + +# EXPOSE port 80 to allow communication to/from server +EXPOSE 80 + +CMD ["supervisord", "-n"] diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json new file mode 100644 index 0000000..d334d79 --- /dev/null +++ b/Dockerrun.aws.json @@ -0,0 +1,16 @@ +{ + "AWSEBDockerrunVersion": "1", + "Authentication": { + "Bucket": "dockerauth.blocpower.org", + "Key": "$DOCKER_REPO.json" + }, + "Image": { + "Name": "blocp/$DOCKER_REPO" + }, + "Ports": [ + { + "HostPort": "80", + "ContainerPort": "80" + } + ] +} diff --git a/config/nginx.conf b/config/nginx.conf new file mode 100644 index 0000000..cdf6e0e --- /dev/null +++ b/config/nginx.conf @@ -0,0 +1,34 @@ +daemon off; +user www; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + gzip on; + charset utf-8; + client_max_body_size 10M; + + access_log $NGINXREQ; + error_log $NGINXERR; + + server { + listen 80; + listen [::]:80; + server_name $DOMAIN; + + location / { + include uwsgi_params; + uwsgi_pass unix:$CODEROOT/uwsgi.sock; + } + location /static/ { + autoindex on; + root $CODEROOT; + } + } +} diff --git a/config/supervisor.conf b/config/supervisor.conf new file mode 100644 index 0000000..477f24b --- /dev/null +++ b/config/supervisor.conf @@ -0,0 +1,5 @@ +[program:uwsgi] +command = /usr/local/bin/uwsgi --ini $CODEROOT/uwsgi.ini -O 2 + +[program:nginx] +command = /usr/sbin/nginx diff --git a/config/uwsgi.ini b/config/uwsgi.ini new file mode 100644 index 0000000..b6300f5 --- /dev/null +++ b/config/uwsgi.ini @@ -0,0 +1,22 @@ +[uwsgi] +# This is used if no configuration is specified. +ini = :base + +socket = $CODEROOT/uwsgi.sock +# Nginx should be able to find this socket. +chmod-socket = 666 + +master = true +# Number of processes and workers should be determined at build time +# Should be based on the type of instance that it is running on +processes = $NUM_PROCESSES +threads = $NUM_THREADS + +# Set loggers. +req-logger = file:$UWSGIREQ +logger = file:$UWSGIERR + +[base] +# cd into the app directory +chdir = $CODEROOT/ +module = blocnote.wsgi:application -- GitLab From dae5c094a62da5d01e5b27bb0d9ec82a9932f3ca Mon Sep 17 00:00:00 2001 From: Adarsh Murthy Date: Tue, 11 Apr 2017 14:23:37 -0400 Subject: [PATCH 2/6] Update to change url to include building id. Update settings to include building database. Update view to display building address --- blocnote/apps/financialInputs/views.py | 12 ++++++++++-- blocnote/settings.py | 9 +++++++++ blocnote/urls.py | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/blocnote/apps/financialInputs/views.py b/blocnote/apps/financialInputs/views.py index 5c1ddf7..086480d 100644 --- a/blocnote/apps/financialInputs/views.py +++ b/blocnote/apps/financialInputs/views.py @@ -1,6 +1,14 @@ from django.shortcuts import render from django.http import HttpResponse +from django.db import connections -def index(request): - return HttpResponse("Hello, world. You're at the financial-inputs index.") +def index(request, building_id): + cursor = connections['building_db'].cursor() + cursor.execute('SELECT * FROM public.get_building(in_building_id := {})'.format(building_id)) + + columns = [col[0] for col in cursor.description] + row = cursor.fetchone() + building = dict(zip(columns, row)) + context = "The building address is: {0}".format(building['address']) + return HttpResponse(context) diff --git a/blocnote/settings.py b/blocnote/settings.py index 47b7329..4c7f5c4 100644 --- a/blocnote/settings.py +++ b/blocnote/settings.py @@ -41,6 +41,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'blocnote.apps.financialInputs', ] MIDDLEWARE = [ @@ -85,6 +86,14 @@ DATABASES = { 'PASSWORD': config('DB_PASSWORD'), 'HOST': config('DB_HOST'), 'PORT': config('DB_PORT'), + }, + 'building_db': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': config('BUILDING_DB_NAME'), + 'USER': config('BUILDING_DB_USER'), + 'PASSWORD': config('BUILDING_DB_PASSWORD'), + 'HOST': config('BUILDING_DB_HOST'), + 'PORT': config('BUILDING_DB_PORT'), } } diff --git a/blocnote/urls.py b/blocnote/urls.py index 81711c8..c4751c8 100644 --- a/blocnote/urls.py +++ b/blocnote/urls.py @@ -17,6 +17,6 @@ from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ - url(r'^financial-inputs/', include('blocnote.apps.financialInputs.urls')), + url(r'^building/(?P[0-9]+)/', include('blocnote.apps.financialInputs.urls')), url(r'^admin/', admin.site.urls), ] -- GitLab From b3970506bccb4a0cf76f8931c9bb06f89c416d1c Mon Sep 17 00:00:00 2001 From: Adarsh Murthy Date: Tue, 11 Apr 2017 14:55:01 -0400 Subject: [PATCH 3/6] Update .env.default to include building database --- .env.default | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.env.default b/.env.default index c6fe427..c5ef14b 100644 --- a/.env.default +++ b/.env.default @@ -7,3 +7,9 @@ DB_USER=$DB_USER DB_PASSWORD=$DB_PASSWORD DB_HOST=$DB_HOST DB_PORT=$DB_PORT +BUILDING_DB_NAME=$BUILDING_DB_NAME +BUILDING_DB_USER=$BUILDING_DB_USER +BUILDING_DB_PASSWORD=$BUILDING_DB_PASSWORD +BUILDING_DB_HOST=$BUILDING_DB_HOST +BUILDING_DB_PORT=$BUILDING_DB_PORT + -- GitLab From b0bf24e4efce61c5af0b580f6b36ff998557d3bf Mon Sep 17 00:00:00 2001 From: Adarsh Murthy Date: Tue, 11 Apr 2017 17:15:32 -0400 Subject: [PATCH 4/6] Fix url to include /financial-inputs. Include template and static files --- .../static/financialInputs/styles/styles.css | 78 ++++++++++++++++++ .../templates/financialInputs/index.html | 25 ++++++ blocnote/apps/financialInputs/views.py | 4 +- blocnote/settings.py | 2 +- blocnote/static/favicon.ico | Bin 0 -> 32038 bytes blocnote/static/scripts/request.js | 36 ++++++++ blocnote/static/styles/header.css | 13 +++ blocnote/static/svg/logo.svg | 21 +++++ blocnote/templates/base.html | 20 +++++ blocnote/urls.py | 2 +- 10 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 blocnote/apps/financialInputs/static/financialInputs/styles/styles.css create mode 100644 blocnote/apps/financialInputs/templates/financialInputs/index.html create mode 100644 blocnote/static/favicon.ico create mode 100644 blocnote/static/scripts/request.js create mode 100644 blocnote/static/styles/header.css create mode 100644 blocnote/static/svg/logo.svg create mode 100644 blocnote/templates/base.html diff --git a/blocnote/apps/financialInputs/static/financialInputs/styles/styles.css b/blocnote/apps/financialInputs/static/financialInputs/styles/styles.css new file mode 100644 index 0000000..337fb15 --- /dev/null +++ b/blocnote/apps/financialInputs/static/financialInputs/styles/styles.css @@ -0,0 +1,78 @@ +body { + background-color: #fcfcfc; +} + +#toolbar { + padding: 10px; + margin: 0; + border: 1px solid black; + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), + 0 1px 5px 0 rgba(0, 0, 0, 0.12), + 0 3px 1px -2px rgba(0, 0, 0, 0.2); +} + +#scenario-list { + display: inline; + width: 250px; + text-align-last: center; +} + +#space-content { + margin: 0; +} + +#space-scenario-detail { + margin: 0; +} + +#space-sidebar { + height: 76vh; + overflow: scroll; + border-width: 1px 5px 1px 1px; + border-style: solid; + background-color: #fafafa; +} + +#save-btn, +#structure-component-btn { + padding: 10px; + margin-top: 10px; + border-radius: 0; + background: #f1f1f1; + width: 100%; +} + +#space-playground { + height: 76vh; + padding: 0; + border: 1px solid black; + background-color: #fafafa; +} + +.space-circle { + display: block; + height: 150px; + width: 150px; + border-radius: 50%; + border: 1px solid red; +} + +form[name=space-info], +form[name=structure-component] { + margin: 10px 0; + padding: 10px; + border: 1px solid black; + background-color: #f1f1f1; + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), + 0 1px 5px 0 rgba(0, 0, 0, 0.12), + 0 3px 1px -2px rgba(0, 0, 0, 0.2); +} + +form[name=space-info] { + display: none; +} + +form[name=space-info] label, +form[name=structure-component] label { + margin-bottom: 0; +} diff --git a/blocnote/apps/financialInputs/templates/financialInputs/index.html b/blocnote/apps/financialInputs/templates/financialInputs/index.html new file mode 100644 index 0000000..bb05905 --- /dev/null +++ b/blocnote/apps/financialInputs/templates/financialInputs/index.html @@ -0,0 +1,25 @@ +{% extends 'base.html' %} +{% load staticfiles %} + +{% block head %} + +{% endblock %} + +{% block content %} +

+ This is finance inputs +

+
+ Building id: {{ id }}
+ Address: {{ address }} +
+{% endblock %} + +{% block scripts %} + + + +{% endblock %} diff --git a/blocnote/apps/financialInputs/views.py b/blocnote/apps/financialInputs/views.py index 086480d..89bc0b7 100644 --- a/blocnote/apps/financialInputs/views.py +++ b/blocnote/apps/financialInputs/views.py @@ -10,5 +10,5 @@ def index(request, building_id): columns = [col[0] for col in cursor.description] row = cursor.fetchone() building = dict(zip(columns, row)) - context = "The building address is: {0}".format(building['address']) - return HttpResponse(context) + context = {'address': building['address'], 'id': building['building_id']} + return render(request, 'financialInputs/index.html', context=context) diff --git a/blocnote/settings.py b/blocnote/settings.py index 4c7f5c4..eef190f 100644 --- a/blocnote/settings.py +++ b/blocnote/settings.py @@ -59,7 +59,7 @@ ROOT_URLCONF = 'blocnote.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [(os.path.join(BASE_DIR, 'blocnote/templates')), ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/blocnote/static/favicon.ico b/blocnote/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..4734fd6c1602259f6c542b50fff102ae6bdf22be GIT binary patch literal 32038 zcmdU&36zx8m4FMHErK)(2qM^xKmc*+L=aT48&o2S3+PeCxFA6wLqM1qBFx)%Tpw_y2Fd z_uY5j`wI?+Ld`-gLSDhKn!QWgsB-?o<8jFkV|ikbs}oVUWAwo)oy3I`_lF@F*-xg5}oJuWgq~|94Pt1~jJrj`hPjIF$0ia5_we z-@vtSeG)9U-c%S1L%@ELjn#+pZqS(iub(wffbqBsjD~CAS$G>h0{6`NBv@{}|Apt^ z1{eeOR{)8|Y%ITL3Q0xXOF+HfgfHO#!1JNH9$5cdFve?(g<#BW1NkW0zYz4<*TA@> zzR|HdooD-d6)uKOpdaLu?9XJz!&|T$($O_h+wbVtePnFt3i;sk&Y>Ng1OEm3dZPJf zBH#Z10vACC$h8=Ahr%=2|J2Lhauo*I`TdIBSU|jD~`#@uhHuqlkI5hU!2lmki zUV&n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0#y z&>qI56JZ4Sy>c=P2j@By^zZY)Hs-g1hDtLUwuIK8&3eON(2xCX#J$xK_JQMJROH>d zwsF5@N{k^t0(EW+2Y};sg2P}U^Z@6a4e>rR0UTf5+*9X65tygVwM#ZcpE(UGpbw~{ zzVvfA8-4|6LVbLT>M4t3Er8QO-4*@f1Xu)*!gvVEc+992)7w($8`G=f4TXomdy4zx zK+sn*DP8DnF&qoAeY?NhYfrIRsJB@*fV2sG5IHs{&{apjc zITN~rKH=ELf`0~m()Ub?{TXxGLr?HtWxR16O#6fOIR=c!nHI-!4(jT;v>zzuyVmNi zErL1mSU=guIlngryh~^f6s1nHaJy=L?$`~x0*VW3c9j6Xn(T(^82r%d0L8H9cM3F4 z@;k+Rs{R$$!6x_&HozKq3XTTtlSodWz&n=T2mb@BVFk>C)1VlVweL&0v9}s(BKW)+ zE&}&VGMPl7^9|YtseL&AB1q=P_fY;V1nr{JFUY?S)MYfplSjz>4x-xy&(6#Fm4bGT zC&}7>OoLI-4Hm|0OkT3~TPVK{CPM|plO<$+2p_@w@b}33TGH3yGB^d?FY)AXGA%b= zo4S9`2k&^p!Mlz2Zw84(mmLN@;dm$mV^u2RUN)v31)iIpA response.json()) + .then(payload => ({ payload })) + .catch(err => ({ err })); +} diff --git a/blocnote/static/styles/header.css b/blocnote/static/styles/header.css new file mode 100644 index 0000000..8be4750 --- /dev/null +++ b/blocnote/static/styles/header.css @@ -0,0 +1,13 @@ +.navbar { + height: 70px; + padding: 0; +} + +.bg-inverse { + background-color: #343434 !important; +} + +.navbar-brand { + border-right: 2px solid #343434; + padding: 0 20px; +} diff --git a/blocnote/static/svg/logo.svg b/blocnote/static/svg/logo.svg new file mode 100644 index 0000000..e869e2b --- /dev/null +++ b/blocnote/static/svg/logo.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + diff --git a/blocnote/templates/base.html b/blocnote/templates/base.html new file mode 100644 index 0000000..3e4727e --- /dev/null +++ b/blocnote/templates/base.html @@ -0,0 +1,20 @@ +{% load staticfiles %} + + + + + + + + + {% block title %}BlocNote{% endblock %} + + + {% block head %}{% endblock %} + + + + {% block content %}{% endblock %} + + + diff --git a/blocnote/urls.py b/blocnote/urls.py index c4751c8..b55bc83 100644 --- a/blocnote/urls.py +++ b/blocnote/urls.py @@ -17,6 +17,6 @@ from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ - url(r'^building/(?P[0-9]+)/', include('blocnote.apps.financialInputs.urls')), + url(r'^building/(?P[0-9]+)/financial-inputs', include('blocnote.apps.financialInputs.urls')), url(r'^admin/', admin.site.urls), ] -- GitLab From 761c0e5cc84f186ae77cabeb6abf594852503de7 Mon Sep 17 00:00:00 2001 From: Adarsh Murthy Date: Tue, 11 Apr 2017 17:18:44 -0400 Subject: [PATCH 5/6] Remove style.css since not used now --- .../static/financialInputs/styles/styles.css | 78 ------------------- 1 file changed, 78 deletions(-) delete mode 100644 blocnote/apps/financialInputs/static/financialInputs/styles/styles.css diff --git a/blocnote/apps/financialInputs/static/financialInputs/styles/styles.css b/blocnote/apps/financialInputs/static/financialInputs/styles/styles.css deleted file mode 100644 index 337fb15..0000000 --- a/blocnote/apps/financialInputs/static/financialInputs/styles/styles.css +++ /dev/null @@ -1,78 +0,0 @@ -body { - background-color: #fcfcfc; -} - -#toolbar { - padding: 10px; - margin: 0; - border: 1px solid black; - box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12), - 0 3px 1px -2px rgba(0, 0, 0, 0.2); -} - -#scenario-list { - display: inline; - width: 250px; - text-align-last: center; -} - -#space-content { - margin: 0; -} - -#space-scenario-detail { - margin: 0; -} - -#space-sidebar { - height: 76vh; - overflow: scroll; - border-width: 1px 5px 1px 1px; - border-style: solid; - background-color: #fafafa; -} - -#save-btn, -#structure-component-btn { - padding: 10px; - margin-top: 10px; - border-radius: 0; - background: #f1f1f1; - width: 100%; -} - -#space-playground { - height: 76vh; - padding: 0; - border: 1px solid black; - background-color: #fafafa; -} - -.space-circle { - display: block; - height: 150px; - width: 150px; - border-radius: 50%; - border: 1px solid red; -} - -form[name=space-info], -form[name=structure-component] { - margin: 10px 0; - padding: 10px; - border: 1px solid black; - background-color: #f1f1f1; - box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12), - 0 3px 1px -2px rgba(0, 0, 0, 0.2); -} - -form[name=space-info] { - display: none; -} - -form[name=space-info] label, -form[name=structure-component] label { - margin-bottom: 0; -} -- GitLab From dd3004594549d706fd39a72e6ca431cd26b3e8b6 Mon Sep 17 00:00:00 2001 From: Adarsh Murthy Date: Tue, 11 Apr 2017 17:20:07 -0400 Subject: [PATCH 6/6] Fix for error in index.html --- .../financialInputs/templates/financialInputs/index.html | 7 ------- 1 file changed, 7 deletions(-) diff --git a/blocnote/apps/financialInputs/templates/financialInputs/index.html b/blocnote/apps/financialInputs/templates/financialInputs/index.html index bb05905..580a3fd 100644 --- a/blocnote/apps/financialInputs/templates/financialInputs/index.html +++ b/blocnote/apps/financialInputs/templates/financialInputs/index.html @@ -1,13 +1,6 @@ {% extends 'base.html' %} {% load staticfiles %} -{% block head %} - -{% endblock %} - {% block content %}

This is finance inputs -- GitLab