Skip to content

Commit 084f4dc

Browse files
committed
Site is now deployed to Fly
- Use the provided Dockerfile
1 parent 8a5dd0e commit 084f4dc

File tree

5 files changed

+214
-2
lines changed

5 files changed

+214
-2
lines changed

.dockerignore

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# flyctl launch added from .gitignore
2+
# Taken from https://github.com/github/gitignore/blob/master/Python.gitignore
3+
4+
# Byte-compiled / optimized / DLL files
5+
**/__pycache__
6+
**/*.py[cod]
7+
**/*$py.class
8+
9+
# C extensions
10+
**/*.so
11+
12+
# Distribution / packaging
13+
**/.Python
14+
**/build
15+
**/develop-eggs
16+
**/dist
17+
**/downloads
18+
**/eggs
19+
**/.eggs
20+
**/lib
21+
**/lib64
22+
**/parts
23+
**/sdist
24+
**/var
25+
**/wheels
26+
**/pip-wheel-metadata
27+
**/share/python-wheels
28+
**/*.egg-info
29+
**/.installed.cfg
30+
**/*.egg
31+
**/MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
**/*.manifest
37+
**/*.spec
38+
39+
# Installer logs
40+
**/pip-log.txt
41+
**/pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
**/htmlcov
45+
**/.tox
46+
**/.nox
47+
**/.coverage
48+
**/.coverage.*
49+
**/.cache
50+
**/nosetests.xml
51+
**/coverage.xml
52+
**/*.cover
53+
**/*.py,cover
54+
**/.hypothesis
55+
**/.pytest_cache
56+
57+
# Translations
58+
**/*.mo
59+
**/*.pot
60+
61+
# Django stuff:
62+
**/*.log
63+
**/local_settings.py
64+
**/db.sqlite3
65+
**/db.sqlite3-journal
66+
67+
# Flask stuff:
68+
**/instance
69+
**/.webassets-cache
70+
71+
# Scrapy stuff:
72+
**/.scrapy
73+
74+
# Sphinx documentation
75+
**/docs/_build
76+
77+
# PyBuilder
78+
**/target
79+
80+
# Jupyter Notebook
81+
**/.ipynb_checkpoints
82+
83+
# IPython
84+
**/profile_default
85+
**/ipython_config.py
86+
87+
# pyenv
88+
**/.python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# celery beat schedule file
98+
**/celerybeat-schedule
99+
100+
# SageMath parsed files
101+
**/*.sage.py
102+
103+
# Environments
104+
**/.env
105+
**/.venv
106+
**/env
107+
**/venv
108+
**/ENV
109+
**/env.bak
110+
**/venv.bak
111+
112+
# Spyder project settings
113+
**/.spyderproject
114+
**/.spyproject
115+
116+
# Rope project settings
117+
**/.ropeproject
118+
119+
# mkdocs documentation
120+
site
121+
122+
# mypy
123+
**/.mypy_cache
124+
**/.dmypy.json
125+
**/dmypy.json
126+
127+
# Pyre type checker
128+
**/.pyre
129+
130+
############################################
131+
# Site specific ignores
132+
############################################
133+
node_modules
134+
pythonsd/media
135+
pythonsd/static/css

Dockerfile

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
ARG PYTHON_VERSION=3.10-slim-buster
2+
3+
FROM python:${PYTHON_VERSION}
4+
5+
ENV PYTHONDONTWRITEBYTECODE 1
6+
ENV PYTHONUNBUFFERED 1
7+
8+
9+
RUN apt-get update
10+
RUN apt-get install -y --no-install-recommends \
11+
nodejs npm \
12+
make \
13+
build-essential \
14+
g++
15+
16+
RUN mkdir -p /code
17+
18+
WORKDIR /code
19+
20+
COPY . /code/
21+
22+
RUN set -ex && \
23+
pip install --upgrade pip && \
24+
pip install -r /code/requirements.txt && \
25+
pip install -r /code/requirements/local.txt && \
26+
rm -rf /root/.cache/
27+
28+
# Build static assets
29+
RUN npm install
30+
RUN npm run build
31+
32+
RUN python manage.py collectstatic --noinput
33+
34+
EXPOSE 8000
35+
36+
# Increase the timeout since these PDFs take a long time to generate
37+
CMD ["waitress-serve", "--port=8000", "config.wsgi:application"]

config/settings/prod.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"www.pythonsd.com",
2525
"sandiegopython.org",
2626
"www.sandiegopython.org",
27-
"pythonsd.herokuapp.com",
27+
"pythonsd.herokuapp.com", # RIP
28+
"pythonsd-django.fly.dev",
2829
]
2930

3031

fly.toml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# fly.toml file generated for pythonsd-django on 2022-11-23T12:12:43-08:00
2+
3+
app = "pythonsd-django"
4+
kill_signal = "SIGINT"
5+
kill_timeout = 5
6+
processes = []
7+
8+
[env]
9+
PORT = "8000"
10+
11+
[experimental]
12+
allowed_public_ports = []
13+
auto_rollback = true
14+
15+
[[services]]
16+
http_checks = []
17+
internal_port = 8000
18+
processes = ["app"]
19+
protocol = "tcp"
20+
script_checks = []
21+
[services.concurrency]
22+
hard_limit = 25
23+
soft_limit = 20
24+
type = "connections"
25+
26+
[[services.ports]]
27+
force_https = true
28+
handlers = ["http"]
29+
port = 80
30+
31+
[[services.ports]]
32+
handlers = ["tls", "http"]
33+
port = 443
34+
35+
[[services.tcp_checks]]
36+
grace_period = "1s"
37+
interval = "15s"
38+
restart_limit = 0
39+
timeout = "2s"

requirements/deployment.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-r common.txt
22

33
# Database server
4-
psycopg2==2.8.3 --no-binary psycopg2
4+
psycopg2-binary==2.9.5
55

66
# Caching
77
django-redis==4.10.0

0 commit comments

Comments
 (0)