Skip to content

Commit

Permalink
Updated the Backend's Deployment (#657)
Browse files Browse the repository at this point in the history
* removed webpack dependency and background_jobs endpoint

* removed legacy deployment stuff and began work on new production dockerfile

* added building the application to the publish workflow

* updated publish workflow to run on push for now

* made index.html paths relative

* appended tira-frontend to all resource paths in the compiled frontend

* set base path explicitly

* added tfr-static prefix

* added workaround for disraptor

* test

* rewoked last changes

* updated dockerfile of frontend

* fixed frontend dockerfile

* removed extractRole for fetchUserInfo

* removed extractOrganizerTeams

* elaborated TODO Comment

* fixed typehints

* removed unused utils functions

* renamed application module to tira_app and updated production container

* minor fixes to ci

* more configurable TIRA_ROOT and TIRA_CONF

* cleaned the settings.py and settings-test.py up a bit

* consolidated tira-application-config.*.yml and improved settings.py further

* removed src/tira_app/static and fixed TIRA_DEBUG handling

* configured TIRE_CONFIG appropriately in CI and dockerfile for make setup

* another problem found

* dockerfile.prod runs make setup in debug mode

* automatic migration; extended configuration via environment variables; fixed a bug in Tasks.vue

* fixed python-gitlabto 4.10.0

* added helpful tools to production container

* fixed wrong path

* fixed django to 5.0.9

* oops

* heldenhaft

* final deployment adjustments

* made django_secret and discourse_api_key configurable via env

* updated deployment documentation

* uwsgi uses port 8080

* the info endpoint now fetches the actual tira version
  • Loading branch information
TheMrSheldon authored Sep 19, 2024
1 parent fb66cc7 commit 3723cf1
Show file tree
Hide file tree
Showing 144 changed files with 2,001 additions and 2,049 deletions.
10 changes: 6 additions & 4 deletions .devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ ENV PIP_BREAK_SYSTEM_PACKAGES 1
USER root
RUN apt-get update && apt-get install -y python3 python3-pip python3-dev pkg-config default-libmysqlclient-dev \
libpcre3-dev
# Create a dummy secret
COPY <<EOF /etc/discourse/client-api-key
I am so secret
EOF

# Environment Variables for TIRA Configuration:
ENV TIRA_ROOT=/workspaces/tira/model/src
ENV TIRA_CONFIG=/workspaces/tira/application/config/tira-application-config.yml
ENV TIRA_DEBUG=true
ENV DISCOURSE_API_KEY="I am so secret"

########################################################################################################################
# Client #
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: Publish Docker images
on:
release:
types: [published]
# TODO: The run on push should be removed (or commented out) in the future. It is here only for testing purposes
# while the deployment is WiP
push:
branches:
- updated_backend_deployment

env:
REGISTRY: ghcr.io
Expand All @@ -24,7 +29,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
id: meta-frontend
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/tira-io/tira-frontend
Expand All @@ -34,5 +39,19 @@ jobs:
context: ${{ github.workspace }}/frontend
file: ${{ github.workspace }}/frontend/Dockerfile.prod
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta-frontend.outputs.tags }}
labels: ${{ steps.meta-frontend.outputs.labels }}

- name: Extract metadata (tags, labels) for Docker
id: meta-backend
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/tira-io/tira-backend
- name: Publish tira-backend image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: ${{ github.workspace }}/
file: ${{ github.workspace }}/application/Dockerfile.prod
push: true
tags: ${{ steps.meta-backend.outputs.tags }}
labels: ${{ steps.meta-backend.outputs.labels }}
12 changes: 7 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -20,14 +20,16 @@ jobs:
run: |
# Install tira from the repository since the pip version may not be up-to-date enough.
# The install musst be editable (-e) since importing from tira fails otherwise
pip3 install -e .[dev,test]
pip3 install .[dev,test]
- name: Install dependencies
working-directory: ${{github.workspace}}/application
run: |
# Create a dummy DISRAPTOR_API_KEY
sudo bash -c 'mkdir -p "/etc/discourse/" && echo "I am so secret" > "/etc/discourse/client-api-key"'
pip3 install -e .[dev,test]
pip3 install .[dev,test]
make setup
env:
TIRA_ROOT: ${{github.workspace}}/model/src
TIRA_CONFIG: ${{github.workspace}}/application/config/tira-application-config.yml
DISCOURSE_API_KEY: "I am so secret"
- name: Run backend tests
working-directory: ${{github.workspace}}/application/test
run: pytest
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<a href="https://tira.io">
<img alt="Deployment" src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fwww.tira.io%2Finfo&query=%24.version&prefix=v.&label=tira.io"/>
</a>
<a href="https://github.com/tira-io/tira/actions/workflows/run-all-tests.yml">
<img alt="Tests" src="https://github.com/tira-io/tira/actions/workflows/run-all-tests.yml/badge.svg"/>
<a href="https://github.com/tira-io/tira/actions/workflows/tests.yml">
<img alt="Tests" src="https://github.com/tira-io/tira/actions/workflows/tests.yml/badge.svg"/>
</a>
<a href="https://github.com/tira-io/tira/actions/workflows/linters.yml">
<img alt="Linters" src="https://github.com/tira-io/tira/actions/workflows/linters.yml/badge.svg"/>
Expand Down
8 changes: 0 additions & 8 deletions application/.devcontainer.json

This file was deleted.

Loading

0 comments on commit 3723cf1

Please sign in to comment.