diff --git a/.gitignore b/.gitignore index a9a8fd3..7e90219 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ secrets.json flaticon_svgs flaticon_colored_svgs icons +bin \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f2dff3b..4b7cdc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,6 @@ WORKDIR /app # volume for nkode.db VOLUME /app/data/sqlite -VOLUME /app/data/icons # Copy go.mod and go.sum files COPY go.mod go.sum ./ @@ -19,7 +18,7 @@ RUN go mod download COPY . . # Build the application -RUN go build -o go-nkode ./cmd +RUN go build -o go-nkode ./cmd/restapi # Stage 2: Runtime FROM debian:bookworm-slim @@ -32,8 +31,6 @@ RUN apt-get update && \ #ENV FRONTEND_HOST=https://app.nkode.tech #ENV FRONTEND_HOST=http://localhost:8090 -ENV SVG_DIR=/app/data/icons -ENV DB_PATH=/app/data/sqlite/nkode.db ENV SQLITE_DB=/app/data/sqlite/nkode.db # Set the working directory inside the runtime container diff --git a/Taskfile.yaml b/Taskfile.yaml index 6f31d69..00ccfed 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -29,7 +29,7 @@ tasks: - docker system prune -f push: cmds: - - docker buildx build --platform linux/amd64,linux/arm64 -t registry.infra.nkode.tech/go-nkode:latest --push . + - docker buildx build --platform linux/amd64,linux/arm64 -t registry.infra.nkode.tech/go-nkode:dod --push . exec: cmds: - docker exec -it cron-nkode bash diff --git a/compose/coolify-compose.yaml b/compose/coolify-compose.yaml index 1dee684..4e58f88 100644 --- a/compose/coolify-compose.yaml +++ b/compose/coolify-compose.yaml @@ -1,10 +1,9 @@ services: go-nkode: container_name: go-nkode - image: registry.infra.nkode.tech/go-nkode + image: registry.infra.nkode.tech/go-nkode:dod volumes: - /var/go-nkode/sqlite:/app/data/sqlite - - /var/go-nkode/icons:/app/data/icons environment: - JWT_SECRET=${JWT_SECRET} diff --git a/internal/api/nkode_api.go b/internal/api/nkode_api.go index 2daad14..709a103 100644 --- a/internal/api/nkode_api.go +++ b/internal/api/nkode_api.go @@ -245,7 +245,7 @@ func (n *NKodeAPI) RenewAttributes(customerId models.CustomerID) error { } func (n *NKodeAPI) RandomSvgInterface() ([]string, error) { - return n.Db.RandomSvgInterface(entities.KeypadMax) + return n.Db.RandomSvgInterface(entities.KeypadDefault) } func (n *NKodeAPI) RefreshToken(userEmail models.UserEmail, customerId models.CustomerID, refreshToken string) (string, error) { diff --git a/internal/repository/sqlite-init/sqlite_init.go b/internal/repository/sqlite-init/sqlite_init.go index 3ee5324..8ab5d5c 100644 --- a/internal/repository/sqlite-init/sqlite_init.go +++ b/internal/repository/sqlite-init/sqlite_init.go @@ -26,7 +26,7 @@ type Root struct { func main() { testDbPath := os.Getenv("TEST_DB_PATH") - dbPath := os.Getenv("DB_PATH") + dbPath := os.Getenv("SQLITE_PATH") dbPaths := []string{testDbPath, dbPath} flaticonSvgDir := os.Getenv("SVG_DIR") //dbPath := "/Users/donov/Desktop/nkode.db" diff --git a/scripts/bash/scp_db.sh b/scripts/bash/scp_db.sh new file mode 100755 index 0000000..c8b6244 --- /dev/null +++ b/scripts/bash/scp_db.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -euo pipefail + +./rebuild_db.sh + +sqlite_db="$HOME/databases/demo.db" +scp $sqlite_db root@nkode.tech:/var/go-nkode/sqlite/demo.db