Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview #84

Closed
wants to merge 377 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
377 commits
Select commit Hold shift + click to select a range
d1cbbe5
Update superadmin page
hansaskov Dec 10, 2024
4376b95
create productionsystem in database
Sebastian689 Dec 10, 2024
bca8b42
Updaet deployment script
hansaskov Dec 11, 2024
fd6e343
delete production system API
Sebastian689 Dec 11, 2024
d05c79c
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
Sebastian689 Dec 11, 2024
c95d504
Update user_create_query to make the first user superadmin
hansaskov Dec 11, 2024
de33037
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
hansaskov Dec 11, 2024
0bdd1d9
routes refactored
Sebastian689 Dec 11, 2024
2b12b52
organization middle route
Sebastian689 Dec 11, 2024
81aa372
Update org state to svelte 5
hansaskov Dec 11, 2024
6dd505d
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
hansaskov Dec 11, 2024
2d3769d
microsoft route updated
Sebastian689 Dec 11, 2024
5aa4622
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
Sebastian689 Dec 11, 2024
fa66622
breadcrumbs routes correctly
Sebastian689 Dec 11, 2024
919206c
Update org combobox
hansaskov Dec 11, 2024
873eefe
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
hansaskov Dec 11, 2024
0b7e2a2
Update combobox
hansaskov Dec 11, 2024
23e9576
Update organization to edit element in place
hansaskov Dec 11, 2024
2b1c3b7
Update home button to redirect to organization
hansaskov Dec 11, 2024
af4b1c7
System API auth
Sebastian689 Dec 11, 2024
16bb4c7
added systems to parts table
Sebastian689 Dec 11, 2024
96f6aeb
remove bad override config
hansaskov Dec 11, 2024
62907a2
Updatae to svelte 5 and fix frontend warning
hansaskov Dec 12, 2024
0da0ca1
Add error message for organization insert
hansaskov Dec 12, 2024
0e6fc57
Remove specific error
hansaskov Dec 12, 2024
832803a
Add error handling for schema
hansaskov Dec 12, 2024
dd2c229
update backend packages
hansaskov Dec 12, 2024
f9c9f6a
fix test code
hansaskov Dec 12, 2024
ca1ceab
format
hansaskov Dec 12, 2024
5ae0397
linting
hansaskov Dec 12, 2024
9ecffaf
Big refactor stash changes
hansaskov Dec 13, 2024
f22cd38
bit refactor stash changes
hansaskov Dec 13, 2024
0bcca9b
Fix frontend errors
hansiboy1999 Dec 13, 2024
dc1564f
Used import aliases more places
hansiboy1999 Dec 13, 2024
fb631d2
Update organization page
hansiboy1999 Dec 14, 2024
3991a07
Update organization store with optimiztic loading
hansiboy1999 Dec 16, 2024
d8cce3a
Added consistency changes
hansiboy1999 Dec 16, 2024
157e5b5
Add comments
hansiboy1999 Dec 16, 2024
32cee85
Added meaningful comments
hansiboy1999 Dec 16, 2024
dd03c57
fix typo
hansiboy1999 Dec 16, 2024
8ceeb0e
fix typo
hansiboy1999 Dec 16, 2024
85ea370
Fix comment
hansiboy1999 Dec 16, 2024
0c07f47
Fix bug in edit
hansiboy1999 Dec 16, 2024
0265201
Rename build.yml to deploy-preview.yml
Sebastian689 Dec 17, 2024
7a8faf3
exponential
Sebastian689 Dec 17, 2024
a839323
Merge branch 'preview' into backend-refactor
Sebastian689 Dec 17, 2024
3400549
Merge pull request #49 from hansaskov/backend-refactor
Sebastian689 Dec 17, 2024
e9b6065
fixed things that went wrong in the merge
Sebastian689 Dec 17, 2024
d24e7b7
Add error logging of callback route
hansaskov Dec 18, 2024
5fb77c5
Update microsoft callback
hansaskov Dec 18, 2024
59ce2d3
Add custom error message to microsoft login
hansaskov Dec 18, 2024
c2723c1
Rename collection folder to collections
hansaskov Dec 18, 2024
141f7ac
updated sveltekit
Sebastian689 Dec 18, 2024
2a4c8ef
Edit erros from frontend due to incorrect foldername
hansaskov Dec 18, 2024
2199294
Update backend logic to convert all keys of an object to lowercase
hansaskov Dec 18, 2024
47cfdb8
currentOrganizatioN
Sebastian689 Dec 18, 2024
38a8b5f
Update backend with parts schema
hansaskov Dec 18, 2024
24ababa
Added new svelte store and parts component for that store
hansaskov Dec 18, 2024
5fbd5e7
Update microsoft identity
hansaskov Dec 18, 2024
6f3da2e
Copy public folder into the final docker image
hansaskov Dec 18, 2024
a15bde8
update dockerfile to also have the public directory in final image
hansaskov Dec 18, 2024
681426f
Update spare parts page
hansaskov Dec 18, 2024
819e322
Fix names
hansaskov Dec 18, 2024
6b182c7
fix type
hansaskov Dec 18, 2024
a208c7f
Update dependencies
hansaskov Dec 18, 2024
7968e90
Opdater default env variables
hansaskov Dec 19, 2024
f8b6294
Add example of studio dockerfile
hansiboy1999 Dec 19, 2024
2b9f236
Update home button
hansiboy1999 Dec 20, 2024
43af667
Update layout to svelte 5 component
hansiboy1999 Dec 20, 2024
2a0d5aa
so far
Sebastian689 Dec 20, 2024
37ffba0
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
Sebastian689 Dec 20, 2024
d3e7c9b
Initial svelte 5 refactor
hansiboy1999 Dec 20, 2024
1e25248
Update components to svelte 5
hansiboy1999 Dec 20, 2024
f765e1d
Start update to shadcn-svelte 5
hansiboy1999 Dec 20, 2024
9b01671
0 check erros in svelte
hansiboy1999 Dec 21, 2024
a6f890b
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
hansaskov Dec 21, 2024
5fc41bf
Fix layout not rendering & format
hansaskov Dec 21, 2024
c4bcef7
revert api change
hansaskov Dec 21, 2024
9bb3883
remove layout comment
hansaskov Dec 21, 2024
a6742b1
Update svelte and sveltekit
hansaskov Dec 22, 2024
bde72aa
Fix Select in superadmin
hansaskov Dec 22, 2024
2dafc46
Add data-table example to test
hansaskov Dec 22, 2024
69bdbb4
Refactor data-table to be more generic
hansaskov Dec 22, 2024
63168b1
Merge pull request #50 from hansaskov/next-2
hansaskov Dec 23, 2024
7816951
Fix usernav in layout
hansaskov Dec 23, 2024
673a777
systems can be added to database
Sebastian689 Dec 23, 2024
0426ab8
Make table more generic
hansaskov Dec 23, 2024
486cd76
Simplify data table
hansaskov Dec 23, 2024
fee5190
Add spareparts example
hansaskov Dec 23, 2024
de52f32
Update data table
hansaskov Dec 23, 2024
1dee6ee
Remove unused ?
hansaskov Dec 23, 2024
6c22699
Fix Parts api
hansaskov Dec 24, 2024
4c9b694
Add experimental test-2
hansaskov Dec 24, 2024
022f6d5
Remove unused inputs
hansaskov Dec 24, 2024
f1be822
Fix @ alias path
hansaskov Dec 24, 2024
4b3c8d1
Updated organization to be session storage with no synced tabs
hansaskov Dec 24, 2024
a8b7815
Refactor code
hansaskov Dec 24, 2024
a7e5b5c
Simplify select in superadmin page
hansaskov Dec 25, 2024
dad56d7
Update github actions
hansaskov Dec 25, 2024
f1cb11a
Merge branch 'preview' into next
hansaskov Dec 25, 2024
6fe6aae
Merge pull request #55 from hansaskov/next
hansaskov Dec 25, 2024
19d09fb
downgrade drizzle-typebox to 0.1.1
hansaskov Dec 25, 2024
1d962ea
Push intentially failing build
hansaskov Dec 25, 2024
1d2a9cd
Fix introduced issue and add unit tests
hansaskov Dec 25, 2024
3804f1b
Update unit tests to use example enviroment variables
hansaskov Dec 25, 2024
c3de1c7
Test unit test in github actions
hansaskov Dec 25, 2024
98f9918
Update github
hansaskov Dec 25, 2024
ca4313e
Add small timeout before unit-tests
hansaskov Dec 25, 2024
48cf9ae
Try to fix deploy script
hansaskov Dec 25, 2024
da207f3
Update deployment to remove old unused containers
hansaskov Dec 25, 2024
7aaf41b
Edit prune to less than 12 hours
hansaskov Dec 25, 2024
6f3549d
Use a system prune instead
hansaskov Dec 25, 2024
e6baf69
Update filter to work for items older than 72 hours
hansaskov Dec 25, 2024
96b0600
Update preview deployment
hansaskov Dec 25, 2024
8ba44c7
format backend
hansaskov Dec 25, 2024
98f233e
Bun format root directory
hansaskov Dec 25, 2024
3a05090
Fix backend linting
hansaskov Dec 25, 2024
67c7caa
frontend formatting
hansaskov Dec 25, 2024
7834ef6
Fix all linting errors
hansaskov Dec 25, 2024
6841d5e
format code
hansaskov Dec 25, 2024
d41e720
cicd: reduce startup of unit-tests
hansaskov Dec 25, 2024
16da5ea
Fix error related to using the username as passwork for deployments
hansaskov Dec 25, 2024
0e72ee1
Make svelte page a single file instead of split files
hansaskov Dec 25, 2024
11737eb
Update button and badge to use the new conditional class rendering
hansaskov Dec 25, 2024
d22ca47
update name of github action
hansaskov Dec 25, 2024
86d1d74
remove unnessesary bun in build step
hansaskov Dec 25, 2024
b781e7c
fix issue where image would not build
hansaskov Dec 25, 2024
3c8a41d
Update toast to be from the top for mobile users
hansaskov Dec 26, 2024
e86eb2e
Add prevent default to edit dialog
hansaskov Dec 26, 2024
594cdf9
Refactor docker compose
hansaskov Dec 27, 2024
135a586
Add umami service and refactor compose files
hansaskov Dec 27, 2024
7f568eb
Run formatter
hansaskov Dec 27, 2024
9765b04
Update deployment script
hansaskov Dec 27, 2024
b01bb80
update .env.example
hansaskov Dec 27, 2024
12270bd
Add portainer fqdn to deploy script
hansaskov Dec 27, 2024
c39f87a
Revert preview changes
hansaskov Dec 27, 2024
fed0a91
Update production deployment script
hansaskov Dec 27, 2024
f84d7fd
Update github actions
hansaskov Dec 27, 2024
fbf25d6
Updaet deploy script
hansaskov Dec 27, 2024
0f6671f
Update deployment action
hansaskov Dec 27, 2024
8b1377e
small refactor
hansaskov Dec 27, 2024
f5457dc
update dependencies
hansaskov Dec 30, 2024
db232cc
Simplify organization page
hansaskov Dec 30, 2024
09eb6ba
add healthz route
hansaskov Dec 30, 2024
9123ac2
simplify logout route
hansaskov Dec 30, 2024
93f266f
simplify logout again
hansaskov Dec 30, 2024
ad183bc
Remove unused import
hansaskov Dec 30, 2024
bbfe603
Add test and update timeout for endpoint
hansaskov Dec 30, 2024
3fa554c
Add healthchecks to the backend
hansaskov Dec 30, 2024
767e290
Create script to automatically create new server
hansaskov Jan 15, 2025
8874b85
Add github action for creating server
hansaskov Jan 15, 2025
5ddcaa0
Add postgres backup and restore
hansaskov Jan 20, 2025
347e825
Update backup and restore scripts for timescaledb
hansaskov Jan 21, 2025
0422b16
Simplify selectOrganizationsOnUser query
hansiboy1999 Jan 28, 2025
a1c70c0
Set dockerfile to bun 1.1
hansiboy1999 Jan 28, 2025
d3b663d
Add --wait to github actions
hansiboy1999 Jan 28, 2025
fdae811
revert --wait on deploy
hansiboy1999 Jan 28, 2025
d74a944
Add HCLOUD_TOKEN to env.example
hansiboy1999 Jan 28, 2025
d8b767d
Improve location of collection in backend
hansiboy1999 Jan 28, 2025
c58f374
Bun lint backend
hansiboy1999 Jan 28, 2025
3521bab
Update svelte config
hansiboy1999 Jan 28, 2025
509078c
Update formatting of config
hansiboy1999 Jan 28, 2025
6a54225
Update bun lockfile
hansiboy1999 Jan 28, 2025
cd395d5
Update type imports
hansiboy1999 Jan 28, 2025
4d5dd60
Update dockerfiles to bun 1.2
hansiboy1999 Jan 28, 2025
57ed629
update frontend dependencies
hansiboy1999 Jan 28, 2025
117f630
update frontend. Build currently does not work with docker
hansiboy1999 Jan 28, 2025
0d218b3
Update data table to show no errors
hansiboy1999 Jan 28, 2025
a08839f
Fix frontend build by going back to bun 1.1
hansiboy1999 Jan 28, 2025
fb11b91
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
hansiboy1999 Jan 28, 2025
e390e54
Downgrade to bun 1.1 for the frontend build
hansiboy1999 Jan 28, 2025
bda0e35
simplify github-actions
hansiboy1999 Jan 28, 2025
6835343
update github action name
hansiboy1999 Jan 28, 2025
90618b6
Add bun cluster
hansiboy1999 Jan 28, 2025
42ce9e0
move seed.ts to test
hansiboy1999 Jan 28, 2025
9e033b9
Update api
hansiboy1999 Jan 29, 2025
4d0fa5d
refactor health api
hansiboy1999 Jan 29, 2025
a75ec14
Add script for continues deployment
hansiboy1999 Jan 29, 2025
3c4b391
Reduce the number of concurrent workers
hansiboy1999 Jan 29, 2025
10a70af
move backup to ci-cd
hansiboy1999 Jan 29, 2025
436fee6
Add readme about rclone
hansiboy1999 Jan 29, 2025
daeaaaf
Add example s3 api keys
hansiboy1999 Jan 29, 2025
1887796
Add s3 api keys
hansiboy1999 Jan 29, 2025
27d7e6d
Update app export
hansaskov Jan 29, 2025
004d493
Update example.env
hansaskov Jan 29, 2025
67c3db6
Rename dockerfile to Dockerfile
hansaskov Feb 1, 2025
89a78d6
add bun upload script to s3
trivision-hans Feb 10, 2025
0ffa727
update env example
trivision-hans Feb 10, 2025
c90734b
Use docker in bun...
trivision-hans Feb 10, 2025
78fbed4
simplify
trivision-hans Feb 10, 2025
d4d927d
test
Sebastian689 Feb 11, 2025
20cffdf
update name of dockerfile location in compose file
trivision-hans Feb 11, 2025
8edc6fd
Update ssh_keys to ssh_public_keys
trivision-hans Feb 11, 2025
a082adc
Update to bun 1.2 and update packages
trivision-hans Feb 11, 2025
d32fe7c
Fix previous error by not updating dependencies
trivision-hans Feb 11, 2025
85b4f83
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
trivision-hans Feb 11, 2025
16f62e3
drizzle studio update
Sebastian689 Feb 11, 2025
245a6f8
Add authMiddleware and update organization
trivision-hans Feb 11, 2025
38e3174
Add organization admin middleware
trivision-hans Feb 11, 2025
8a1c7ee
Update timescale dependencies
trivision-hans Feb 11, 2025
abad60e
Update to only have 1 server
trivision-hans Feb 11, 2025
6035675
Add organization id cookie
trivision-hans Feb 11, 2025
927fd11
Update organizationsStore to refresh when created
trivision-hans Feb 11, 2025
a79058a
Add isSuperadmin middleware and update organization settings
trivision-hans Feb 11, 2025
3d858f9
isOrganization middleware
Sebastian689 Feb 12, 2025
56f70fc
systems refresh based on organization
Sebastian689 Feb 12, 2025
994026a
Add invite collection
hansiboy1999 Feb 12, 2025
3f2938b
improve organization query select statement
hansiboy1999 Feb 12, 2025
e9a8241
Update user schema
hansiboy1999 Feb 12, 2025
384909b
refactored parts api + temporary system models sql injection
Sebastian689 Feb 12, 2025
94c045a
refactor invites to use correct names
hansiboy1999 Feb 12, 2025
1fd4f9d
Add name and email field to user table
hansiboy1999 Feb 12, 2025
7e5633b
fixed systems page
Sebastian689 Feb 12, 2025
d50d569
Add user management functionality to organization settings
hansiboy1999 Feb 12, 2025
13a5e22
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
hansiboy1999 Feb 12, 2025
fd747b2
formatter
Sebastian689 Feb 12, 2025
379274a
Modify invites schema and queries to use email and organization_id as…
hansiboy1999 Feb 12, 2025
205f516
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
hansiboy1999 Feb 12, 2025
a04b124
format
hansiboy1999 Feb 12, 2025
dc062df
no more double primary key in invites
Sebastian689 Feb 12, 2025
4f3a656
Implement invite user functionality in organization settings
hansiboy1999 Feb 12, 2025
4fc4e22
adds all system_models types on migration
Sebastian689 Feb 12, 2025
864a0d9
Enhance invite management in user settings
hansiboy1999 Feb 12, 2025
38ca2cb
Merge branch 'preview' of https://github.com/hansaskov/master-thesis …
hansiboy1999 Feb 12, 2025
41651a5
Add validation on prs
trivision-hans Feb 13, 2025
f2aadbb
Test commit
trivision-hans Feb 13, 2025
13f9a83
Fix linting and formatting errors
trivision-hans Feb 13, 2025
929aa7a
Merge pull request #79 from hansaskov/email-provider
hansaskov Feb 13, 2025
fc83fab
Create backup bun scrips
trivision-hans Feb 14, 2025
a37e48b
fixed login to handle name and given name (#80)
Sebastian689 Feb 18, 2025
85112a3
Add resend as a email client
trivision-hans Feb 18, 2025
560b1c0
Update names
trivision-hans Feb 18, 2025
efc1052
Merge pull request #81 from hansaskov/email
hansaskov Feb 18, 2025
6d1ab3e
Add feature to invite new users to an organization
trivision-hans Feb 18, 2025
90ccb8c
Merge pull request #82 from hansaskov/user-invite
hansaskov Feb 18, 2025
4730662
Update github action to also use resend client secret
trivision-hans Feb 18, 2025
984ea1f
Merge pull request #83 from hansaskov/actions
hansaskov Feb 18, 2025
ac18c2b
Change directory and hide buttons when not allowed to use them
hansiboy1999 Feb 19, 2025
e8629d5
Merge pull request #86 from hansaskov/navigation-and-icons
hansaskov Feb 19, 2025
33cf2b1
Remove goto statement
hansiboy1999 Feb 19, 2025
adb7eec
Merge pull request #87 from hansaskov/login-redirect-issue
hansaskov Feb 19, 2025
4486b16
Update authorization and page navigation
hansiboy1999 Feb 19, 2025
205e8d9
Merge pull request #88 from hansaskov/use-systemId-over-id
hansaskov Feb 19, 2025
dc22ea5
Refactor org settings
hansiboy1999 Feb 19, 2025
5bae3a3
Fix settings always being shown
hansiboy1999 Feb 19, 2025
d083608
make login also do authentication
hansiboy1999 Feb 19, 2025
3ee81f8
Merge pull request #89 from hansaskov/org-settings-refactor
hansaskov Feb 19, 2025
ef09a0c
Update settings page
trivision-hans Feb 20, 2025
62697e4
Merge pull request #91 from hansaskov/org-settings-update
hansaskov Feb 20, 2025
f0b9f75
Parts to systems (#92)
Sebastian689 Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 0 additions & 26 deletions .env

This file was deleted.

34 changes: 34 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Compose
COMPOSE_PROJECT_NAME=thesis
COMPOSE_PROFILES=proxy, stateless, stateful, migrate

## Statefull
POSTGRES_DB=database
POSTGRES_USER=username
POSTGRES_PASSWORD=password
DATABASE_URL=postgres://username:password@timescaledb:5432/database

## Stateless
INTERFACE_FQDN=http://localhost
MICROSOFT_TENANT_ID=
MICROSOFT_CLIENT_ID="d03453634..."
MICROSOFT_CLIENT_SECRET="jcmads...."
RESEND_CLIENT_SECRET=
PROD=true

## Monitor
PORTAINER_FQDN=http://portainer.localhost

## Cloud
HCLOUD_TOKEN=

## Nixos
SERVER_IP=
SSH_PUBLIC_KEYS="ssh-rsa AAAAB3..."
PASSWORD_HASH=

## S3 Storage
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_BUCKET=
S3_ENDPOINT=
17 changes: 0 additions & 17 deletions .env.production

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/create-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: start server

on:
workflow_dispatch:
inputs:
server_name:
description: 'Name for the server'
required: false
default: 'nixos'
ssh_key:
description: 'Name of the SSH key registered in Hetzner Cloud'
required: false
default: 'deploy-key'

jobs:
provision:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Hetzner Cloud CLI
uses: hetznercloud/setup-hcloud@v1
env:
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}

- name: Run NixOS Server Provisioner
env:
PASSWORD_HASH: ${{ secrets.PASSWORD_HASH }}
run: |
cd ci-cd/nixos/
./create-server.sh "${{ github.event.inputs.server_name }}" "${{ github.event.inputs.ssh_key }}"
34 changes: 0 additions & 34 deletions .github/workflows/deploy-preview.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/deploy-production.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: deploy
on:
push:
branches:
- main
- preview

jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.ref_name == 'main' && 'production' || 'preview' }}
env:
PROD: true
COMPOSE_PROJECT_NAME: ${{ github.ref_name }}
COMPOSE_PROFILES: stateless, stateful, migrate
DOCKER_HOST: ssh://admin@${{ secrets.SERVER_IP }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
INTERFACE_FQDN: ${{ vars.INTERFACE_FQDN }}
MICROSOFT_TENANT_ID: ${{ vars.MICROSOFT_TENANT_ID }}
MICROSOFT_CLIENT_ID: ${{ secrets.MICROSOFT_CLIENT_ID }}
MICROSOFT_CLIENT_SECRET: ${{ secrets.MICROSOFT_CLIENT_SECRET }}
POSTGRES_DB: ${{ vars.POSTGRES_DB }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
DATABASE_URL: postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@timescaledb:5432/${{ vars.POSTGRES_DB }}
RESEND_CLIENT_SECRET: ${{ secrets.RESEND_CLIENT_SECRET }}
PORTAINER_FQDN: ${{ vars.PORTAINER_FQDN }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Which branch?
run: echo "${{ github.ref_name }}"

- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config

- name: Docker prune
run: docker system prune --all --force --filter "until=36h"

- name: Deploy caddy
run: docker compose --profile proxy -p proxy up -d

- name: Deploy docker compose
run: docker compose -f compose.yaml --profile stateful --profile stateless --profile migrate up --build -d

- name: Deploy monitoring
run: docker compose --profile monitor -p monitor up -d
66 changes: 38 additions & 28 deletions .github/workflows/build.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,48 @@
name: Build and test images
name: publish

on: [push]
on:
release:
types: [created]

permissions:
packages: write
contents: read
id-token: write

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
FRONTEND_IMAGE_NAME: hansaskov/master-thesis-frontend
BACKEND_IMAGE_NAME: hansaskov/master-thesis-backend
DATABASE_URL: postgresql://myuser:password@localhost:5432/mydatabase
PROD: false
IMAGE_TAG: 1.0

jobs:
rust_release:
name: Build Release
runs-on: windows-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Build release in services/ingest
working-directory: ./services/ingest
run: cargo build --release

- name: Create Release Asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./services/ingest/target/release/ingest.exe

build_frontend_docker_image:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -60,7 +86,8 @@ jobs:
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: ./services/frontend
context: .
file: ./services/frontend/dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -79,28 +106,12 @@ jobs:

build_backend_docker_image:
runs-on: ubuntu-latest
env:
DATABASE_URL: postgresql://myuser:password@localhost:5432/mydatabase
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install package
working-directory: ./services/backend
run: bun install
- name: Start TimescaleDB
run: docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_USER=myuser -e POSTGRES_DB=mydatabase timescale/timescaledb:latest-pg17
- name: Wait 10 seconds
run: sleep 10
- name: List Containers
run: docker container list
- name: Start migrate
working-directory: ./services/backend
run: bun db:migrate
- name: Run backend tests
working-directory: ./services/backend
run: bun test

- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
Expand Down Expand Up @@ -136,7 +147,8 @@ jobs:
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: ./services/backend
context: .
file: ./services/backend/dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -151,6 +163,4 @@ jobs:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
deploy-preview:
uses: hansaskov/master-thesis/.github/workflows/deploy-preview.yml@main
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
34 changes: 0 additions & 34 deletions .github/workflows/rust-release.yml

This file was deleted.

Loading