-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slim setup & python 2to3 & upgrade requirements
- Loading branch information
Iago Veloso
committed
Oct 28, 2018
1 parent
a4369e4
commit 0e37809
Showing
118 changed files
with
913 additions
and
1,154 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"allow_root": true, | ||
"directory" : "radioco/apps/radioco/static/bower" | ||
"directory" : "tmp_bower" | ||
} |
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
[paths] | ||
source = | ||
radioco/ | ||
/radioco/radioco/ | ||
/radioco/radioco/ | ||
[run] | ||
source = | ||
radioco |
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,13 @@ | ||
**/node_modules | ||
**/__pycache__ | ||
**/.cache | ||
test_reports/ | ||
venv/ | ||
env/ | ||
**/.pyc | ||
**/.kdbx | ||
**/.ipynb | ||
**/db.sqlite3 | ||
**/.vscode | ||
radioco/static/ | ||
radioco/apps/radioco/static/bower/ |
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
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 @@ | ||
LANG=C.UTF-8 | ||
COMPOSE_PROJECT_NAME=radioco | ||
|
||
SECRET_KEY=REPLACE_ME | ||
DJANGO_LOG_LEVEL=ERROR | ||
TIME_ZONE=Europe/Madrid | ||
DISQUS_API_KEY= | ||
DISQUS_WEBSITE_SHORTNAME= | ||
|
||
PORT_BACKEND=8000 |
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
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
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,16 @@ | ||
version: '3.4' | ||
services: | ||
|
||
|
||
# Backend server ------------------------------------------------------------- | ||
|
||
django: | ||
environment: | ||
- DEBUG=True | ||
volumes: | ||
- ./:/radioco/ | ||
ports: | ||
- ${PORT_BACKEND}:8000 | ||
command: /bin/sh -c "cd /radioco && ./docker/scripts/launch_dev_server.sh" | ||
#stdin_open: true | ||
#tty: true # ERROR: An HTTP request took too long to complete. https://github.com/docker/compose/issues/3633 |
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,31 @@ | ||
version: '3.4' | ||
services: | ||
|
||
|
||
# Backend server ------------------------------------------------------------- | ||
|
||
django: | ||
environment: | ||
- DEBUG=False | ||
volumes: | ||
- ./radioco/static/:/radioco/radioco/static/ | ||
command: /bin/sh -c "cd /radioco && ./docker/scripts/launch_server.sh" | ||
|
||
nginx: | ||
image: nginx:1.13.1-alpine | ||
restart: always | ||
volumes: | ||
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro | ||
- ./radioco/static:/static:ro | ||
- ./radioco/media:/media:ro | ||
ports: | ||
- ${PORT_BACKEND}:8000 | ||
env_file: | ||
- .env | ||
command: /bin/sh -c "nginx -g 'daemon off;'" | ||
links: | ||
- django | ||
|
||
memcached: | ||
image: memcached:1.4.37-alpine | ||
command: memcached -m 512m |
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
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 |
---|---|---|
@@ -1,24 +1,30 @@ | ||
FROM python:2.7 | ||
FROM python:3.6-jessie | ||
|
||
|
||
# Installing libraries | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
python-setuptools \ | ||
python-pip \ | ||
RUN apt-get update && apt-get install -yq --fix-missing --no-install-recommends \ | ||
libmysqlclient-dev \ | ||
mysql-client \ | ||
python3-setuptools \ | ||
python3-pip \ | ||
git-core \ | ||
netcat \ | ||
nodejs-legacy \ | ||
npm \ | ||
gettext \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN npm install -g bower | ||
# Installing libraries | ||
|
||
RUN npm install -g bower | ||
|
||
# Install pip dependencies | ||
RUN pip3 install --upgrade pip setuptools virtualenv | ||
|
||
COPY .bowerrc bower.json / | ||
RUN bower install | ||
|
||
COPY requirements.txt / | ||
RUN pip3 install -r requirements.txt | ||
|
||
RUN pip install --upgrade pip setuptools virtualenv | ||
COPY ./ /radioco/ | ||
|
||
COPY requirements.txt requirements.txt | ||
RUN pip install --upgrade pip | ||
RUN pip install -r requirements.txt | ||
WORKDIR /radioco/ |
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,129 @@ | ||
worker_processes 1; | ||
events { | ||
worker_connections 1024; | ||
} | ||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
|
||
# Hide nginx version information. | ||
server_tokens off; | ||
|
||
# Compression | ||
gunzip on; | ||
gzip on; | ||
gzip_comp_level 2; | ||
gzip_proxied any; | ||
gzip_types | ||
image/svg+xml | ||
image/x-icon | ||
text/x-component | ||
text/css | ||
text/javascript | ||
text/xml | ||
text/plain | ||
application/javascript | ||
application/x-javascript | ||
application/json | ||
application/atom+xml | ||
application/rss+xml | ||
application/xhtml+xml; | ||
|
||
uwsgi_cache_path /tmp/cache1 levels=1:2 keys_zone=web:1m max_size=1g inactive=8h use_temp_path=off; | ||
uwsgi_cache_path /tmp/cache2 levels=1:2 keys_zone=api:10m max_size=1g inactive=24h use_temp_path=off; | ||
|
||
upstream django { | ||
server django:8000; | ||
} | ||
server { | ||
listen 8000; | ||
charset utf-8; | ||
|
||
include /etc/nginx/uwsgi_params; | ||
|
||
uwsgi_param Host $host; | ||
uwsgi_param X-Real-IP $remote_addr; | ||
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for; | ||
uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto; | ||
|
||
# server cache | ||
uwsgi_cache_key "$scheme$host$uri$is_args$args"; | ||
uwsgi_cache_methods GET HEAD; | ||
|
||
# cache debug info | ||
#add_header X-uWSGI-Cache $upstream_cache_status; | ||
#add_header X-uWSGI-Cache-Key "$scheme$host$uri$is_args$args"; | ||
|
||
location /static/ { | ||
alias /static/; | ||
expires 1d; | ||
log_not_found off; | ||
access_log off; | ||
} | ||
|
||
location /media/ { | ||
alias /media/; | ||
expires 1d; | ||
log_not_found off; | ||
access_log off; | ||
} | ||
|
||
location /admin/ { | ||
# disable any cache | ||
expires 0; | ||
uwsgi_no_cache 1; | ||
uwsgi_pass django; | ||
} | ||
|
||
location / { | ||
# client cache | ||
expires 10m; | ||
|
||
# server cache | ||
uwsgi_cache web; | ||
uwsgi_cache_valid 200 5m; | ||
|
||
uwsgi_pass django; | ||
} | ||
|
||
location ~ /rss/$ { | ||
# client cache | ||
expires 1h; | ||
|
||
# server cache | ||
uwsgi_cache web; | ||
uwsgi_cache_valid 200 45m; | ||
|
||
uwsgi_pass django; | ||
} | ||
|
||
location /api/ { | ||
# disable client cache | ||
expires 0; | ||
|
||
# server cache except for authenticated users (calendar manager) | ||
uwsgi_cache api; | ||
uwsgi_cache_valid 200 30m; | ||
uwsgi_no_cache $cookie_sessionid; | ||
|
||
uwsgi_pass django; | ||
} | ||
|
||
location ~ ^/api/2/(radiocom/)?transmissions/now { | ||
# same as before but cache for a shorter period | ||
expires 0; | ||
|
||
uwsgi_cache api; | ||
uwsgi_cache_valid 200 1m; | ||
|
||
uwsgi_pass django; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
} |
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,8 @@ | ||
#!/bin/bash -x | ||
|
||
script_full_path=$(dirname "$0") | ||
$script_full_path/wait_for.sh postgres 5432 | ||
|
||
mv -f /tmp_bower /radioco/radioco/apps/radioco/static/bower | ||
python3 manage.py migrate | ||
python3 manage.py runserver 0.0.0.0:8000 |
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
#!/bin/bash -x | ||
${MANAGE_PY} runserver 0.0.0.0:8000 | ||
|
||
script_full_path=$(dirname "$0") | ||
$script_full_path/wait_for.sh postgres 5432 | ||
|
||
mv -f /tmp_bower /radioco/radioco/apps/radioco/static/bower | ||
python3 manage.py migrate | ||
python3 manage.py collectstatic --noinput | ||
uwsgi --socket 0.0.0.0:8000 --module radioco.configs.base.wsgi --master --processes 2 --threads 1 |
Oops, something went wrong.