-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
barebones experimental version, coded under pressure in the lcd codin…
…g night #1
- Loading branch information
0 parents
commit 847d5af
Showing
39 changed files
with
1,332 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# linux temporary files | ||
*~ | ||
|
||
# emacs temporary files | ||
\#*\# | ||
|
||
# ignore itself | ||
.dockerignore | ||
|
||
# ignore Dockerfile | ||
Dockerfile | ||
|
||
# ignore docker compose file | ||
docker-compose.yml | ||
|
||
# ignore git | ||
.git | ||
.gitignore | ||
.gitmodules | ||
|
||
# ignore coverage files | ||
.coverage | ||
.cover | ||
|
||
# ignore static files | ||
# except default | ||
lcd/api/static | ||
!lcd/api/static/media/default_400x400.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# linux temporary files | ||
*~ | ||
|
||
# emacs temporary files | ||
\#*\# | ||
|
||
# ignore coverage files | ||
.coverage | ||
cover | ||
|
||
# python cache | ||
__pycache__ | ||
|
||
# ignore static files | ||
lcdmarket/api/static/ | ||
|
||
# sqlite3 database | ||
*.sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Use this as a base image | ||
FROM ubuntu:14.04 | ||
|
||
# Maintainer Info | ||
MAINTAINER Ricardo Lobo <[email protected]> | ||
|
||
# set default environment | ||
ENV APP_IN_PRODUCTION=false | ||
|
||
# update repos and install | ||
# pip3, supervisor, nginx | ||
# python postgres adapter | ||
RUN apt-get update && \ | ||
apt-get -y install \ | ||
python3-pip \ | ||
supervisor \ | ||
nginx \ | ||
python3-psycopg2 | ||
|
||
# install Pillow dependencies | ||
RUN apt-get -y install \ | ||
libtiff5-dev \ | ||
libjpeg8-dev \ | ||
zlib1g-dev \ | ||
libfreetype6-dev \ | ||
liblcms2-dev \ | ||
libwebp-dev \ | ||
tcl8.6-dev \ | ||
tk8.6-dev \ | ||
python-tk | ||
|
||
# development dependencies | ||
RUN apt-get -y install nano | ||
|
||
# copy code to image | ||
COPY . /var/www/ | ||
|
||
# set the working directory | ||
WORKDIR /var/www/ | ||
|
||
# install django and django dependencies using pip3 | ||
RUN pip3 install -r /var/www/dist/requirements.txt | ||
|
||
# make init script executable | ||
RUN chmod ug+x /var/www/dist/initialize.sh | ||
|
||
# set locale | ||
RUN locale-gen pt_PT.UTF-8 | ||
|
||
# remove nginx default site | ||
RUN rm /etc/nginx/sites-enabled/default | ||
|
||
# copy supervisor configuration | ||
COPY ./dist/lcdmarket.conf /etc/supervisor/conf.d/lcdmarket.conf | ||
|
||
# default command | ||
CMD ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# copy and enable lcd site api virtual server | ||
cp ./dist/lcdmarket /etc/nginx/sites-available/ | ||
ln -s /etc/nginx/sites-available/lcdmarket /etc/nginx/sites-enabled/lcdmarket | ||
|
||
# in development mode | ||
if [ "$APP_IN_PRODUCTION" != "true" ]; then | ||
# migrations are automatic | ||
python3 /var/www/manage.py migrate --noinput | ||
# static files are collected on container init | ||
python3 /var/www/manage.py collectstatic --noinput | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
server { | ||
listen 80; | ||
|
||
# traffic related to static files are nginx responsability | ||
location /static/ { | ||
alias /var/www/lcdmarket/api/static/; | ||
} | ||
|
||
# remaining traffic is passed to gunicorn that is listening | ||
# on port 8001, we are adding some headers here to the original | ||
# request | ||
location / { | ||
proxy_pass http://127.0.0.1:8000; | ||
proxy_set_header X-Forwarded-Host $server_name; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header Host $http_host; | ||
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:initialize] | ||
command=/bin/bash /var/www/dist/initialize.sh | ||
exitcodes=0 | ||
startsecs=0 | ||
priority=10 | ||
|
||
[program:nginx] | ||
command=/usr/sbin/nginx -g "daemon off;" | ||
autostart=true | ||
autorestart=true | ||
priority=20 | ||
|
||
[program:gunicorn] | ||
directory=/var/www/ | ||
command=/usr/local/bin/gunicorn -b 127.0.0.1:8000 -w 4 lcdmarket.wsgi | ||
autostart=true | ||
autorestart=true | ||
priority=20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
gunicorn | ||
django | ||
djangorestframework | ||
django-cors-headers | ||
django-filter | ||
djangorestframework-jwt | ||
django-nose | ||
coverage | ||
Pillow | ||
drf-nested-routers |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ApiConfig(AppConfig): | ||
name = 'api' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.2 on 2016-02-08 19:27 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Account', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('password', models.CharField(max_length=128, verbose_name='password')), | ||
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), | ||
('email', models.EmailField(max_length=254, unique=True)), | ||
('first_name', models.CharField(max_length=40)), | ||
('last_name', models.CharField(max_length=40)), | ||
('certification_name', models.CharField(blank=True, max_length=255, null=True)), | ||
('is_superuser', models.BooleanField(default=False)), | ||
('is_active', models.BooleanField(default=True)), | ||
('is_staff', models.BooleanField(default=False)), | ||
('is_public', models.BooleanField(default=False)), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('updated', models.DateTimeField(auto_now=True)), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
] |
110 changes: 110 additions & 0 deletions
110
lcdmarket/api/migrations/0001_squashed_0011_auto_20160211_2005.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.2 on 2016-02-12 22:17 | ||
from __future__ import unicode_literals | ||
|
||
from django.conf import settings | ||
import django.core.validators | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
replaces = [('api', '0001_initial'), ('api', '0002_tag'), ('api', '0003_project'), ('api', '0004_auto_20160211_1115'), ('api', '0005_auto_20160211_1639'), ('api', '0006_auto_20160211_1640'), ('api', '0007_auto_20160211_1641'), ('api', '0008_auto_20160211_1641'), ('api', '0009_auto_20160211_1642'), ('api', '0010_auto_20160211_2003'), ('api', '0011_auto_20160211_2005')] | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Account', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('password', models.CharField(max_length=128, verbose_name='password')), | ||
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), | ||
('email', models.EmailField(max_length=254, unique=True)), | ||
('first_name', models.CharField(max_length=40)), | ||
('last_name', models.CharField(max_length=40)), | ||
('certification_name', models.CharField(blank=True, max_length=255, null=True)), | ||
('is_superuser', models.BooleanField(default=False)), | ||
('is_active', models.BooleanField(default=True)), | ||
('is_staff', models.BooleanField(default=False)), | ||
('is_public', models.BooleanField(default=False)), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('updated', models.DateTimeField(auto_now=True)), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='Tag', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=50, unique=True, validators=[django.core.validators.RegexValidator('^[a-z0-9_ \\-]*$', message='Use only lowercase letters, and numbers, - or _.'), django.core.validators.MinLengthValidator(3, message='Mininum Length of 3 chars.')])), | ||
('created', models.DateTimeField(auto_now_add=True, null=True)), | ||
('updated', models.DateTimeField(auto_now=True, null=True)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Project', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=75, validators=[django.core.validators.MinLengthValidator(2)])), | ||
('deleted', models.BooleanField(default=False)), | ||
('public', models.BooleanField(default=False)), | ||
('cover', models.ImageField(default='default_400x400.png', upload_to='')), | ||
('state', models.IntegerField(default=1)), | ||
('slug', models.SlugField(max_length=75, unique=True)), | ||
('description', models.TextField(blank=True, null=True)), | ||
('goals', models.TextField(blank=True, null=True)), | ||
('requirements', models.TextField(blank=True, null=True)), | ||
('assets', models.TextField(blank=True, null=True)), | ||
('start_date', models.DateTimeField(null=True)), | ||
('end_date', models.DateTimeField(null=True)), | ||
('order', models.PositiveSmallIntegerField()), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='ProjectAreas', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('updated', models.DateTimeField(auto_now=True)), | ||
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Project')), | ||
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Tag')), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='project', | ||
name='areas', | ||
field=models.ManyToManyField(through='api.ProjectAreas', to='api.Tag'), | ||
), | ||
migrations.CreateModel( | ||
name='ProjectContributors', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('is_manager', models.BooleanField(default=False)), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('updated', models.DateTimeField(auto_now=True)), | ||
('contributor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Tag')), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='projectcontributors', | ||
name='project', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Project'), | ||
), | ||
migrations.AddField( | ||
model_name='project', | ||
name='contributors', | ||
field=models.ManyToManyField(through='api.ProjectContributors', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='projectcontributors', | ||
name='contributor', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.2 on 2016-02-17 18:25 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0001_squashed_0011_auto_20160211_2005'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='account', | ||
name='avatar', | ||
field=models.ImageField(default='default_avatar_200x200.png', upload_to=''), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.2 on 2016-02-08 21:32 | ||
from __future__ import unicode_literals | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Tag', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=50, unique=True, validators=[django.core.validators.RegexValidator('^[a-z0-9_ \\-]*$', message='Use only lowercase letters, and numbers, - or _.'), django.core.validators.MinLengthValidator(3, message='Mininum Length of 3 chars.')])), | ||
('created', models.DateTimeField(auto_now_add=True, null=True)), | ||
('updated', models.DateTimeField(auto_now=True, null=True)), | ||
], | ||
), | ||
] |
Oops, something went wrong.