Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/dockerhub-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and publish Docker image to Docker Hub

on:
push:
branches: [ main, master ]
tags: [ 'v*' ]
paths:
- 'dockerimage/**'
- 'backend/**'
- 'frontend/**'
- '.github/workflows/dockerhub-publish.yml'
pull_request:
branches: [ main, master ]
paths:
- 'dockerimage/**'
- 'backend/**'
- 'frontend/**'
- '.github/workflows/dockerhub-publish.yml'

env:
DOCKERHUB_REPO: rapnuss/ciphernotes

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_REPO }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: dockerimage/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max


23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"Betroffenenrechte",
"bowser",
"bubblewrap",
"buildx",
"Buildx",
"CAROOT",
"cascadia",
"Cascadia",
Expand All @@ -22,20 +24,25 @@
"clipb",
"comlink",
"Consolas",
"createdb",
"CSIC",
"CTAN",
"customtabs",
"Dailymotion",
"dasharray",
"dashoffset",
"datname",
"dexie",
"Dexie",
"dockerhub",
"dockerimage",
"downl",
"DSGVO",
"Ecosia",
"esnext",
"Eurogamer",
"genkeypair",
"github",
"hcaptcha",
"HCAPTCHA",
"healthcheck",
Expand All @@ -48,32 +55,45 @@
"jszip",
"keyalg",
"keymap",
"keypair",
"keysize",
"keytool",
"Kotaku",
"lastmod",
"levenshtein",
"linecap",
"linejoin",
"linux",
"mantine",
"matplotlib",
"Metacritic",
"nginx",
"nocrypt",
"Nußbaumer",
"nvmrc",
"openssl",
"outdir",
"outform",
"panzoom",
"passwortloser",
"PGDATA",
"pkcs",
"PKCS",
"postgres",
"postgresql",
"precache",
"precaching",
"presign",
"presigner",
"printcert",
"psql",
"pubout",
"qrcode",
"Qwant",
"rapnuss",
"replit",
"rgba",
"rolname",
"Searchalot",
"sels",
"serverside",
Expand All @@ -83,9 +103,12 @@
"Supportanfragen",
"Swisscows",
"tabler",
"topk",
"unarch",
"urlset",
"Usec",
"uuid",
"Vite",
"Wickenburggasse",
"yudiel"
],
Expand Down
1 change: 1 addition & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist
node_modules
.bun-version
.dockerignore
.env
.env.example
Expand Down
49 changes: 49 additions & 0 deletions backend/drizzle/0000_warm_blink.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
CREATE TYPE "public"."note_type" AS ENUM('note', 'todo', 'label', 'file');--> statement-breakpoint
CREATE TYPE "public"."subscription_type" AS ENUM('free', 'plus', 'pro');--> statement-breakpoint
CREATE TABLE "notes" (
"id" bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "notes_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1),
"user_id" bigint NOT NULL,
"clientside_id" varchar(36) NOT NULL,
"type" "note_type" DEFAULT 'note' NOT NULL,
"cipher_text" text,
"iv" varchar(16),
"version" integer DEFAULT 1 NOT NULL,
"serverside_created_at" bigint NOT NULL,
"serverside_updated_at" bigint NOT NULL,
"clientside_created_at" bigint NOT NULL,
"clientside_updated_at" bigint NOT NULL,
"clientside_deleted_at" bigint,
"committed_size" integer DEFAULT 0 NOT NULL,
CONSTRAINT "user_client_id" UNIQUE("user_id","clientside_id")
);
--> statement-breakpoint
CREATE TABLE "sessions" (
"id" bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "sessions_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1),
"user_id" bigint NOT NULL,
"access_token_hash" varchar(64) NOT NULL,
"access_token_salt" varchar(32) NOT NULL,
"created_at" bigint NOT NULL
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "users_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1),
"email" varchar(255) NOT NULL,
"password_hash" varchar(255),
"is_admin" boolean DEFAULT false NOT NULL,
"login_code" varchar(6),
"login_code_created_at" bigint,
"login_tries_left" integer DEFAULT 0 NOT NULL,
"created_at" bigint NOT NULL,
"updated_at" bigint NOT NULL,
"sync_token" varchar(24),
"confirm_code" varchar(6),
"confirm_code_created_at" bigint,
"confirm_code_tries_left" integer DEFAULT 0 NOT NULL,
"new_email" varchar(255),
"subscription" "subscription_type" DEFAULT 'free' NOT NULL,
"successful_login_at" bigint,
CONSTRAINT "users_email_unique" UNIQUE("email")
);
--> statement-breakpoint
ALTER TABLE "notes" ADD CONSTRAINT "notes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;
91 changes: 0 additions & 91 deletions backend/drizzle/0001_migrate_to_bigint_ids.sql

This file was deleted.

21 changes: 20 additions & 1 deletion backend/drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "30ed7634-b16d-4176-b067-561c5f6d48a9",
"id": "b828c258-78b3-4758-b8f7-9fda1add2a07",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
Expand Down Expand Up @@ -228,6 +228,19 @@
"primaryKey": false,
"notNull": true
},
"password_hash": {
"name": "password_hash",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"is_admin": {
"name": "is_admin",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"login_code": {
"name": "login_code",
"type": "varchar(6)",
Expand Down Expand Up @@ -297,6 +310,12 @@
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"successful_login_at": {
"name": "successful_login_at",
"type": "bigint",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
Expand Down
8 changes: 4 additions & 4 deletions backend/drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": "5",
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "5",
"when": 1732487460000,
"tag": "0001_migrate_to_bigint_ids",
"version": "7",
"when": 1756705234111,
"tag": "0000_warm_blink",
"breakpoints": true
}
]
Expand Down
Loading