Skip to content

Commit

Permalink
Merge pull request #1904 from scpwiki/WJ-994-single-dokku
Browse files Browse the repository at this point in the history
[WJ-994] Set up single image for Dokku dev deploy
  • Loading branch information
emmiegit authored Apr 30, 2024
2 parents d1e08ae + a4cceed commit 51bec08
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 133 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/docker-build-api.dev.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: '[backend] Docker build Framerail (dev)'
name: '[backend] Docker build Dokku (dev)'

on:
pull_request:
paths:
- 'deepwell/**'
- 'framerail/**'
- 'install/aws/dev/docker/web/Dockerfile'
- '.github/workflows/docker-build-web.dev.yaml'
- 'install/dev/dokku/Dockerfile'
- '.github/workflows/docker-build-dokku.dev.yaml'

jobs:
build:
Expand All @@ -15,6 +16,7 @@ jobs:
uses: actions/checkout@v2

- name: Build image
run: docker build -f install/aws/dev/docker/web/Dockerfile .
run: docker build -f install/dev/dokku/Dockerfile .
env:
DOCKER_BUILDKIT: 1

21 changes: 0 additions & 21 deletions .github/workflows/docker-build-postgres.dev.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: '[deploy] Docker push Deepwell'
name: '[deploy] Docker push Dokku'

on:
push:
branches:
- develop
paths:
- 'deepwell/**'
- 'install/aws/dev/docker/api/**'
- '.github/workflows/docker-build-push-api.dev.yaml'
- 'framerail/**'
- 'install/dev/dokku/Dockerfile'
- '.github/workflows/docker-build-push-dokku.dev.yaml'

jobs:
build:
Expand All @@ -22,5 +23,5 @@ jobs:
uses: dokku/github-action@master
with:
ssh_private_key: ${{ secrets.DOKKU_DEPLOY_KEY }}
git_remote_url: 'ssh://[email protected]:22/deepwell'
git_remote_url: 'ssh://[email protected]:22/wikijump'
git_push_flags: --force --verbose
26 changes: 0 additions & 26 deletions .github/workflows/docker-build-push-web.dev.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
web: /usr/bin/node /app/framerail/build
api: /usr/local/bin/deepwell /etc/deepwell.toml
36 changes: 36 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"healthchecks": {
"web": [
{
"type": "startup",
"name": "framerail-init",
"description": "Checks if the web server has started",
"port": 3000,
"attempts": 3
},
{
"type": "liveness",
"name": "framerail-healthy",
"description": "Checks if the web server can start serving requests",
"command": ["curl", "-If", "http://localhost:3000/"],
"attempts": 3
}
],
"api": [
{
"type": "startup",
"name": "deepwell-init",
"description": "Checks if API server has started",
"port": 2747,
"attempts": 3
},
{
"type": "liveness",
"name": "deepwelly-healthy",
"description": "Checks if the API server can accept requests",
"command": ["/bin/deepwell-health-check"],
"attempts": 3
}
]
}
}
20 changes: 0 additions & 20 deletions install/aws/dev/docker/postgres/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions install/aws/dev/docker/web/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion install/aws/prod/docker/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ RUN cargo build --release
# Final image
#

# We want alpine, but need glibc
FROM alpine:latest

ENV LOCALIZATION_PATH="/opt/locales"
Expand Down
2 changes: 1 addition & 1 deletion install/aws/prod/docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM postgres:14-alpine
FROM postgres:16-alpine

EXPOSE 5432

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,48 @@ RUN cargo vendor
# Build deepwell server
RUN cargo build --release

#
# Framerail build
#

FROM node:19-alpine AS node

# Install pnpm
RUN npm install -g pnpm

# Copy sources
RUN mkdir /app
WORKDIR /app
COPY framerail/ ./
COPY assets ./src/assets

# Install app
RUN \
pnpm install && \
pnpm build && \
pnpm prune --prod && \
rm -rf src/ tests/

#
# Final image
#

# We want alpine, but need glibc
FROM alpine:latest

ENV LOCALIZATION_PATH="/opt/locales"

RUN mkdir /app
WORKDIR /app

RUN apk update
RUN apk add --no-cache curl
RUN apk add --no-cache curl nodejs libmagic-static file

COPY --from=rust /src/deepwell/target/release/deepwell /usr/local/bin/deepwell
COPY ./install/files/api/health-check.sh /bin/wikijump-health-check
COPY --from=node /app /app/framerail

COPY ./install/files/api/health-check.sh /bin/deepwell-health-check
COPY ./install/files/dev/deepwell.toml /etc/deepwell.toml
COPY ./locales/fluent /opt/locales/fluent
COPY ./deepwell/seeder /opt/seeder

USER daemon
EXPOSE 2747
CMD ["/usr/local/bin/deepwell", "/etc/deepwell.toml"]
8 changes: 7 additions & 1 deletion install/files/postgres/init/02-seed.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
SET default_transaction_read_only = off;

CREATE ROLE wikijump
WITH INHERIT NOSUPERUSER NOCREATEDB LOGIN NOREPLICATION NOBYPASSRLS ENCRYPTED PASSWORD 'wikijump';

CREATE DATABASE wikijump
WITH OWNER wikijump;

CREATE ROLE wikijump_ro
WITH INHERIT NOSUPERUSER NOCREATEDB LOGIN NOREPLICATION NOBYPASSRLS PASSWORD 'wikijump_ro';
WITH INHERIT NOSUPERUSER NOCREATEDB LOGIN NOREPLICATION NOBYPASSRLS ENCRYPTED PASSWORD 'wikijump_ro';

\connect wikijump

Expand Down
2 changes: 1 addition & 1 deletion install/local/dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ services:
- "S3_SECRET_ACCESS_KEY=defaultpassword"
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "-X", "POST", "--json", '{"jsonrpc":"2.0","method":"ping","id":9000}', "http://localhost:2747/jsonrpc"]
test: ["CMD", "/bin/wikijump-health-check"]
interval: 120s
timeout: 2s
retries: 3
Expand Down
2 changes: 1 addition & 1 deletion install/local/dev/postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM postgres:14-alpine
FROM postgres:16-alpine

EXPOSE 5432

Expand Down

0 comments on commit 51bec08

Please sign in to comment.