Skip to content

Commit 96bc75f

Browse files
committed
fixed db
1 parent bf321e1 commit 96bc75f

33 files changed

+29557
-29549
lines changed

.github/workflows/docker.yml

+44-44
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
name: Docker
2-
on:
3-
push:
4-
branches:
5-
- "main"
6-
- "renovate/*"
7-
8-
jobs:
9-
build:
10-
name: "Build (${{ matrix.context }})"
11-
runs-on: ubuntu-latest
12-
permissions:
13-
contents: read
14-
packages: write
15-
strategy:
16-
fail-fast: false
17-
matrix:
18-
context: [frontend, backend]
19-
steps:
20-
- name: Checkout repository
21-
uses: actions/checkout@v3
22-
- name: Set up QEMU
23-
uses: docker/setup-qemu-action@v2
24-
with:
25-
platforms: arm64
26-
- name: Set up Docker Buildx
27-
uses: docker/setup-buildx-action@v2
28-
- name: Log into registry ${{ env.REGISTRY }}
29-
uses: docker/login-action@v2
30-
with:
31-
registry: ghcr.io
32-
username: ${{ github.actor }}
33-
password: ${{ secrets.GH_TOKEN }}
34-
- name: Build and push Docker image
35-
uses: docker/build-push-action@v3
36-
with:
37-
context: ${{ matrix.context }}
38-
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
39-
platforms: linux/amd64
40-
file: ${{ matrix.context }}/Dockerfile
41-
tags: |
42-
ghcr.io/csesoc/jobs-board-${{ matrix.context }}:${{ github.sha }}
43-
ghcr.io/csesoc/jobs-board-${{ matrix.context }}:latest
44-
labels: ${{ steps.meta.outputs.labels }}
1+
name: Docker
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
- "renovate/*"
7+
8+
jobs:
9+
build:
10+
name: "Build (${{ matrix.context }})"
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
context: [frontend, backend]
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v2
24+
with:
25+
platforms: arm64
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v2
28+
- name: Log into registry ${{ env.REGISTRY }}
29+
uses: docker/login-action@v2
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GH_TOKEN }}
34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@v3
36+
with:
37+
context: ${{ matrix.context }}
38+
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
39+
platforms: linux/amd64
40+
file: ${{ matrix.context }}/Dockerfile
41+
tags: |
42+
ghcr.io/csesoc/jobs-board-${{ matrix.context }}:${{ github.sha }}
43+
ghcr.io/csesoc/jobs-board-${{ matrix.context }}:latest
44+
labels: ${{ steps.meta.outputs.labels }}

README.md

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
# story-website
2-
3-
A website for story-driven programming competitions.
4-
5-
## Architecture
6-
7-
### Backend
8-
9-
The backend itself is written in Python (with Flask), and is made up of a couple of sections:
10-
11-
- The "Advent of Code" stuff itself (in `/backend/advent`): where all of our puzzles are located.
12-
- Authentication (in `/backend/auth` and `/backend/routes/auth.py`): where our login/registration/logout stuff is located.
13-
- API (in `/backend/routes`): the main point of access between the frontend and backend.
14-
15-
Features we want to implement:
16-
[] Email verification (i.e. when we register an account, an email gets sent to the account name)
17-
[] A decent puzzle architecture
18-
19-
### Database
20-
21-
The database is written in PostgreSQL, and the backend uses `psycopg2` in order to interact with it (so if you've done COMP3311,
22-
this should be pretty familiar). The creation of tables can be found in `/database/setup.sql`.
23-
24-
### Frontend
25-
26-
The frontend is written in React, and we plan to have the following features:
27-
[] Cleaned-up login/register/logout pages
28-
[] Profile page
29-
[] Leaderboard
30-
31-
## How to build
32-
33-
1. Download Docker Desktop and follow the instructions [here](https://docs.docker.com/desktop/windows/wsl/#download). (Assumes Windows - if you're using something else then follow instructions there)
34-
2. Create the `config` folder, and put all `.env` files there.
35-
3. In the main folder, run `docker-compose up --build` to make your Docker images for the first time. `--build` is not necessary when you update code later on.
36-
4. If you need to add a package that doesn't already exist to the frontend, make sure to do `docker-compose down -v` first, and then do `docker-compose up --build`.
37-
5. Profit
1+
# story-website
2+
3+
A website for story-driven programming competitions.
4+
5+
## Architecture
6+
7+
### Backend
8+
9+
The backend itself is written in Python (with Flask), and is made up of a couple of sections:
10+
11+
- The "Advent of Code" stuff itself (in `/backend/advent`): where all of our puzzles are located.
12+
- Authentication (in `/backend/auth` and `/backend/routes/auth.py`): where our login/registration/logout stuff is located.
13+
- API (in `/backend/routes`): the main point of access between the frontend and backend.
14+
15+
Features we want to implement:
16+
[] Email verification (i.e. when we register an account, an email gets sent to the account name)
17+
[] A decent puzzle architecture
18+
19+
### Database
20+
21+
The database is written in PostgreSQL, and the backend uses `psycopg2` in order to interact with it (so if you've done COMP3311,
22+
this should be pretty familiar). The creation of tables can be found in `/database/setup.sql`.
23+
24+
### Frontend
25+
26+
The frontend is written in React, and we plan to have the following features:
27+
[] Cleaned-up login/register/logout pages
28+
[] Profile page
29+
[] Leaderboard
30+
31+
## How to build
32+
33+
1. Download Docker Desktop and follow the instructions [here](https://docs.docker.com/desktop/windows/wsl/#download). (Assumes Windows - if you're using something else then follow instructions there)
34+
2. Create the `config` folder, and put all `.env` files there.
35+
3. In the main folder, run `docker-compose up --build` to make your Docker images for the first time. `--build` is not necessary when you update code later on.
36+
4. If you need to add a package that doesn't already exist to the frontend, make sure to do `docker-compose down -v` first, and then do `docker-compose up --build`.
37+
5. Profit

backend/.gitignore

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
.DS_Store
2-
.env
3-
.flaskenv
4-
*.pyc
5-
*.pyo
6-
env/
7-
venv/
8-
.venv/
9-
env*
10-
dist/
11-
build/
12-
*.egg
13-
*.egg-info/
14-
_mailinglist
15-
.tox/
16-
.cache/
17-
.pytest_cache/
18-
.idea/
19-
docs/_build/
20-
.vscode
21-
22-
# Coverage reports
23-
htmlcov/
24-
.coverage
25-
.coverage.*
1+
.DS_Store
2+
.env
3+
.flaskenv
4+
*.pyc
5+
*.pyo
6+
env/
7+
venv/
8+
.venv/
9+
env*
10+
dist/
11+
build/
12+
*.egg
13+
*.egg-info/
14+
_mailinglist
15+
.tox/
16+
.cache/
17+
.pytest_cache/
18+
.idea/
19+
docs/_build/
20+
.vscode
21+
22+
# Coverage reports
23+
htmlcov/
24+
.coverage
25+
.coverage.*
2626
*,cover

backend/Dockerfile

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# pull official base image
2-
FROM python:3.8.10-slim-buster
3-
4-
# set work directory
5-
WORKDIR /backend
6-
7-
# set environment variables
8-
ENV PYTHONDONTWRITEBYTECODE 1
9-
ENV PYTHONUNBUFFERED 1
10-
11-
COPY Pipfile* /backend/
12-
13-
RUN pip install pipenv
14-
RUN pipenv lock -r > requirements.txt
15-
RUN pip uninstall --yes pipenv
16-
RUN pip install -r requirements.txt
17-
18-
EXPOSE 5001
19-
20-
CMD [ "python", "app.py" ]
1+
# pull official base image
2+
FROM python:3.8.10-slim-buster
3+
4+
# set work directory
5+
WORKDIR /backend
6+
7+
# set environment variables
8+
ENV PYTHONDONTWRITEBYTECODE 1
9+
ENV PYTHONUNBUFFERED 1
10+
11+
COPY Pipfile* /backend/
12+
13+
RUN pip install pipenv
14+
RUN pipenv lock -r > requirements.txt
15+
RUN pip uninstall --yes pipenv
16+
RUN pip install -r requirements.txt
17+
18+
EXPOSE 5001
19+
20+
CMD [ "python", "app.py" ]

backend/Pipfile

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
[[source]]
2-
url = "https://pypi.python.org/simple"
3-
verify_ssl = true
4-
name = "pypi"
5-
6-
[packages]
7-
Flask = "*"
8-
Flask-SQLAlchemy = "*"
9-
Flask-Login = "*"
10-
psycopg2-binary = "*"
11-
email-validator = "*"
12-
argon2-cffi = "*"
13-
flask-jwt-extended = "*"
14-
redis = "*"
15-
flask-cors = "*"
16-
17-
[dev-packages]
18-
19-
[requires]
20-
python_version = "3.8"
1+
[[source]]
2+
url = "https://pypi.python.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
Flask = "*"
8+
Flask-SQLAlchemy = "*"
9+
Flask-Login = "*"
10+
psycopg2-binary = "*"
11+
email-validator = "*"
12+
argon2-cffi = "*"
13+
flask-jwt-extended = "*"
14+
redis = "*"
15+
flask-cors = "*"
16+
17+
[dev-packages]
18+
19+
[requires]
20+
python_version = "3.8"

0 commit comments

Comments
 (0)