Skip to content

Commit

Permalink
feat: add sqlite db for item locking with k8s (TT-1764) (#7)
Browse files Browse the repository at this point in the history
* feat: add sqlite db for item locking with k8s (TT-1764)

* lint fix

* move text under image

* update db readme

* make delete endpoint valid

* use the username from token to check if locked to current user

* cleanup

* Fix merge conflicts and use SVG for logo font

* Make header a little smaller

* Fix invalid properties on svg

* update readme with prisma details

* delete lock on cancel. allow fetching items locked to same user.

* Delete lock on approval

* console log removal

* Reduce claim size, update Dockerfile, make prisma singleton
  • Loading branch information
fredrikmonsen authored Nov 6, 2024
1 parent 585ecf9 commit 9eb74ce
Show file tree
Hide file tree
Showing 26 changed files with 1,857 additions and 56 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ next-env.d.ts
/.idea

# local dev files
dummy-data.json
dummy-data.json

# PVC k8s
/db/ammo.db
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ COPY . .

ENV NEXT_TELEMETRY_DISABLED=1

RUN npx prisma generate
RUN npx prisma migrate deploy
COPY prisma ./prisma/

RUN npm run build

FROM base AS runner
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ cp .env.example .env.local
| AUTH_API_PATH | _N/A_ | Sti til autentiserings-APIet |
| CATALOG_API_PATH | http://localhost:8087/bikube | Sti til [katalog APIet ](https://github.com/NationalLibraryOfNorway/bikube)<br/>Må starte med `http://` eller `https://` |

Appen bruker SQLite for å holde orden på hvilke objekter som er låst til ulike brukere.
AMMO bruker Prisma som ORM for å kommunisere med databasen.
For å få dette opp å kjøre bruker man `prisma db pull` for å lage nytt schema.prisma,
og `prisma generate` for å laste skjemaet inn i prisma klienten.


Deretter må du kjøre følgende kommandoer:
```bash
npm install
Expand Down
1 change: 1 addition & 0 deletions db/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The sqlite db-file goes here. Adding this README so we can commit the directory.
13 changes: 13 additions & 0 deletions k8s/stage/ammo-pvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ammo-pvc
namespace: tekst-stage
spec:
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 1Gi
storageClassName: fast
8 changes: 8 additions & 0 deletions k8s/stage/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ spec:
- name: app-port
containerPort: 3000
imagePullPolicy: Always
volumeMounts:
- name: ammo-sqlite
mountPath: /db
volumes:
- name: ammo-sqlite
persistentVolumeClaim:
claimName: ammo-pvc

Loading

0 comments on commit 9eb74ce

Please sign in to comment.