-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
80 additions
and
8 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 |
---|---|---|
|
@@ -9,4 +9,5 @@ db.sqlite3 | |
static | ||
.env | ||
.venv/ | ||
.coverage | ||
.coverage | ||
fly.toml |
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 @@ | ||
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ | ||
|
||
name: Fly Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
name: Deploy app | ||
runs-on: ubuntu-latest | ||
concurrency: deploy-group # optional: ensure only one action runs at a time | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
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,15 +1,34 @@ | ||
FROM python:3.11.4-slim-buster | ||
ARG PYTHON_VERSION=3.11-slim | ||
|
||
FROM python:${PYTHON_VERSION} | ||
|
||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
WORKDIR /app | ||
# install psycopg2 dependencies. | ||
RUN apt-get update && apt-get install -y \ | ||
libpq-dev \ | ||
gcc \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir -p /code | ||
|
||
WORKDIR /code | ||
|
||
COPY requirements.txt /tmp/requirements.txt | ||
|
||
# install psycopg2 dependencies. | ||
RUN set -ex && \ | ||
pip install --upgrade pip && \ | ||
pip install -r /tmp/requirements.txt && \ | ||
rm -rf /root/.cache/ | ||
COPY . /code | ||
|
||
COPY . . | ||
# env var for building purposes | ||
ENV SECRET_KEY "aGkCk2XY3qk7kOZ0HDXoGq5DXlshIhfpspT2bgrV13CzJWCsQa" | ||
|
||
RUN pip install --upgrade pip && \ | ||
pip install --no-cache-dir -r requirements.txt | ||
RUN python manage.py collectstatic --noinput | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["gunicorn", "--reload", "--bind", ":8000", "--workers", "2", "minesweeper.wsgi"] | ||
CMD ["gunicorn","--bind",":8000","--workers","2","minesweeper.wsgi"] |
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,33 @@ | ||
# fly.toml app configuration file generated for minesweeper-api on 2024-11-22T09:15:04-03:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = 'minesweeper-api' | ||
primary_region = 'yyz' | ||
console_command = '/code/manage.py shell' | ||
|
||
[build] | ||
|
||
[deploy] | ||
release_command = 'python manage.py migrate --noinput' | ||
|
||
[env] | ||
PORT = '8000' | ||
|
||
[http_service] | ||
internal_port = 8000 | ||
force_https = true | ||
auto_stop_machines = 'stop' | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ['app'] | ||
|
||
[[vm]] | ||
memory = '1gb' | ||
cpu_kind = 'shared' | ||
cpus = 1 | ||
|
||
[[statics]] | ||
guest_path = '/code/static' | ||
url_prefix = '/static/' |