Skip to content

Commit

Permalink
(DAL) Use separate db (#1784)
Browse files Browse the repository at this point in the history
* feat: load configs from admin api

* fix: lint & vet

* remove logs table from node db

* feat: migrations separation and dockerfile update
  • Loading branch information
nick-bisonai authored Jul 11, 2024
1 parent 43ca87c commit d657755
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
21 changes: 19 additions & 2 deletions dockerfiles/orakl-dal.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,27 @@ RUN CGO_ENABLED=1 CGO_CFLAGS="-O -D__BLST_PORTABLE__" CGO_CFLAGS_ALLOW="-O -D__B
# debian:bullseye-slim
FROM debian@sha256:4b48997afc712259da850373fdbc60315316ee72213a4e77fc5a66032d790b2a

RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y curl jq && rm -rf /var/lib/apt/lists/*

RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/bin

RUN curl -L https://github.com/golang-migrate/migrate/releases/download/v4.17.0/migrate.linux-amd64.tar.gz | tar xvz && \
mv ./migrate /usr/bin

WORKDIR /app

RUN mkdir /app/migrations

COPY --from=builder /app/node/taskfile.yml /app/taskfile.yml

COPY --from=builder /app/node/taskfiles /app/taskfiles

COPY --from=builder /app/node/migrations/dal /app/migrations

COPY --from=builder /app/node/dalbin /usr/bin

CMD ["dalbin"]
COPY dockerfiles/start-go.sh .

RUN chmod +x start-go.sh

CMD ["./start-go.sh", "dalbin"]
1 change: 1 addition & 0 deletions node/migrations/dal/000001_log.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS logs
5 changes: 5 additions & 0 deletions node/migrations/dal/000001_log.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE IF NOT EXISTS logs (
id SERIAL PRIMARY KEY,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
message TEXT NOT NULL
)
5 changes: 5 additions & 0 deletions node/migrations/node/000028_remove_log.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE IF NOT EXISTS logs (
id SERIAL PRIMARY KEY,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
message TEXT NOT NULL
)
1 change: 1 addition & 0 deletions node/migrations/node/000028_remove_log.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS logs

0 comments on commit d657755

Please sign in to comment.