Skip to content

Commit f4dfb60

Browse files
authored
API Rewrite and Dockerization (#78)
* workers: init * workers: d1 initial work * workers: resuming work, simplified schema * api: flesh out the majority of critical features * api: get rid of the old implementation * db: seed database with current releases * db: break seed files up, too much for a single stdout buffer * api: support version diff'ing * d1: debugging insert issue * api: fix insert issue (missing `await`s) and explicitly cache to avoid invocations * api: append CORS headers for requests originating from `pcsx2.net` * api: update seed data and fix response data * api: optimize DB indexes and add caching * api: update page rule cache when a release is added/deleted/modified * api: most functionality ported over to rocket.rs * api: finish off core implementation * api: dockerize * api: cleaning up TODOs * v1: remove some of the old implementation * v2: small script to pull release data, update DB seed * v2: minor cleanup * v2: finalize v1 -> v2 transition * v2: synchronize db on startup * sqlx: commit sql query metadata * v2: handful of bug fixes and v1 parity adjustments * v2: some repo house cleaning * ci: add CI workflows * ci: finalize ci implementation
1 parent 7ffaa76 commit f4dfb60

File tree

64 files changed

+5826
-7701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+5826
-7701
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Added by cargo
2+
3+
/target
4+
db.sqlite3
5+
db.sqlite3-journal
6+
.env
7+
.sqlx/
8+
*.log

.env.template

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Fill in this file and rename to `.env`
2+
GITHUB_API_TOKEN=TODO
3+
GITHUB_WEBHOOK_SECRET=TODO
4+
ADMIN_API_KEY=TODO
5+
# The following parameters will likely be fine
6+
DATABASE_URL=sqlite://db.sqlite3
7+
ERROR_LOG_PATH=./error.log
8+
APP_LOG_PATH=./app.log
9+
VERBOSE_LOGGING=true

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ensure line endings are consistently 'LF'
2+
* text=auto
3+
4+
.sqlx/**/* linguist-generated

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "monthly"
7-
- package-ecosystem: "npm"
7+
- package-ecosystem: "cargo"
88
directory: "/"
99
schedule:
1010
interval: "monthly"

.github/workflows/build-backend.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 🔨 Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-server:
17+
name: Server
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install Rust Stable
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
toolchain: stable
27+
28+
- uses: Swatinem/rust-cache@v2
29+
name: Cache Rust Build
30+
with:
31+
shared-key: web-api-build-${{ matrix.platform }}
32+
33+
- name: Build Tauri App
34+
run: |
35+
cargo install --path .
36+
37+
build-docker:
38+
name: Docker Image
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 30
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Extract metadata (tags, labels) for Docker
45+
id: meta
46+
uses: docker/metadata-action@v5
47+
with:
48+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
49+
50+
- name: Build Docker image
51+
uses: docker/build-push-action@v6
52+
with:
53+
context: .
54+
push: false
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/lint-backend.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: 📝 Linter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
formatting:
13+
name: Formatting
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install Rust Stable
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: stable
22+
components: clippy
23+
24+
- uses: Swatinem/rust-cache@v2
25+
name: Cache Rust Build
26+
with:
27+
shared-key: web-api-build-ubuntu-latest
28+
29+
- name: Check Rust formatting
30+
run: cargo fmt --all --check
31+
32+
linter:
33+
name: Linter
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: Swatinem/rust-cache@v2
39+
name: Cache Rust Build
40+
with:
41+
shared-key: web-api-build-${{ matrix.platform }}
42+
43+
- uses: actions-rs/clippy-check@v1
44+
name: Rust Linting - Clippy
45+
continue-on-error: true
46+
with:
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
args: --all-features --manifest-path Cargo.toml

0 commit comments

Comments
 (0)