From 12c45d4aa2fda70257ec20dc5fb922d1e88ad63b Mon Sep 17 00:00:00 2001 From: Katie Harris Date: Wed, 3 Sep 2025 11:08:21 -0400 Subject: [PATCH 1/8] Modify old workflows and add new workflow for Nexlayer --- .github/workflows/build-and-push.yml | 50 ++++++++++++++++++++++++++++ .github/workflows/docker-ci-tags.yml | 9 +---- .github/workflows/lint.yml | 3 +- .github/workflows/main.yml | 4 +-- .github/workflows/test.yml | 3 +- 5 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/build-and-push.yml diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 000000000..eae5402dc --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,50 @@ +name: Build and Push to GHCR + +on: + push: + branches: + - main + +env: + IMAGE_NAME: sqlpad + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/nexlayer/${{ env.IMAGE_NAME }} + tags: | + type=sha,prefix=,format=short + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/docker-ci-tags.yml b/.github/workflows/docker-ci-tags.yml index b8d2643c4..33a91c2ef 100644 --- a/.github/workflows/docker-ci-tags.yml +++ b/.github/workflows/docker-ci-tags.yml @@ -3,14 +3,7 @@ name: docker-ci-tags on: - push: - branches: - - 'master' - tags: - - 'v*.*.*' - pull_request: - branches: - - 'master' + workflow_dispatch: # Allow manual triggering jobs: docker: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bb1ed09b2..a2ca889ce 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,7 @@ name: lint -on: [push, pull_request] +on: + workflow_dispatch: # Allow manual triggering jobs: lint: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index de2f34a7f..f77da8d4f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,7 @@ name: SQLPad release on: - push: - tags: - - '*' + workflow_dispatch: # Allow manual triggering jobs: build: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 02dfd3d73..0f7e9ec61 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,7 @@ name: test -on: [push, pull_request] +on: + workflow_dispatch: # Allow manual triggering env: TZ: utc From 7abf8865b29b8d56205dd5935dd0d5b6dcc9cf95 Mon Sep 17 00:00:00 2001 From: KatieHarris2397 <138803843+KatieHarris2397@users.noreply.github.com> Date: Wed, 3 Sep 2025 11:11:33 -0400 Subject: [PATCH 2/8] Update docker-ci-tags.yml --- .github/workflows/docker-ci-tags.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-ci-tags.yml b/.github/workflows/docker-ci-tags.yml index 33a91c2ef..6e48aa7ee 100644 --- a/.github/workflows/docker-ci-tags.yml +++ b/.github/workflows/docker-ci-tags.yml @@ -3,7 +3,7 @@ name: docker-ci-tags on: - workflow_dispatch: # Allow manual triggering + workflow_dispatch: # Allow manual triggering jobs: docker: From a5478eca3f7b27132d088569d9d984beac8393ba Mon Sep 17 00:00:00 2001 From: KatieHarris2397 <138803843+KatieHarris2397@users.noreply.github.com> Date: Wed, 3 Sep 2025 11:11:56 -0400 Subject: [PATCH 3/8] Update lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a2ca889ce..93a6a9459 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,7 @@ name: lint on: - workflow_dispatch: # Allow manual triggering + workflow_dispatch: # Allow manual triggering jobs: lint: From 9171fda9c10c039b6d6fe966f7a4468bf8a71b98 Mon Sep 17 00:00:00 2001 From: KatieHarris2397 <138803843+KatieHarris2397@users.noreply.github.com> Date: Wed, 3 Sep 2025 11:12:13 -0400 Subject: [PATCH 4/8] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f7e9ec61..563c38e13 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: test on: - workflow_dispatch: # Allow manual triggering + workflow_dispatch: # Allow manual triggering env: TZ: utc From 2d4e03841a2607ee66146bb49e448701fa3677fb Mon Sep 17 00:00:00 2001 From: KatieHarris2397 <138803843+KatieHarris2397@users.noreply.github.com> Date: Wed, 3 Sep 2025 11:12:31 -0400 Subject: [PATCH 5/8] Update build-and-push.yml --- .github/workflows/build-and-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index eae5402dc..6123929ff 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -3,7 +3,7 @@ name: Build and Push to GHCR on: push: branches: - - main + - master env: IMAGE_NAME: sqlpad From a0abd225f7f02b1ab5accde135e50396135e5c14 Mon Sep 17 00:00:00 2001 From: Katie Harris Date: Wed, 3 Sep 2025 16:53:17 -0400 Subject: [PATCH 6/8] Remove Sign Up button and let users use username instead of email. Update Dockerfile --- Dockerfile | 19 ++++++++++++++++--- client/src/pages/SignIn.tsx | 18 +++++++++--------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3123c0047..17864a05f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,9 +72,22 @@ COPY --from=build /sqlpad/docker-entrypoint / COPY --from=build /sqlpad/server . ENV NODE_ENV production -ENV SQLPAD_DB_PATH /var/lib/sqlpad -ENV SQLPAD_PORT 3000 -EXPOSE 3000 +ENV SQLPAD_DB_PATH=/var/lib/sqlpad +ENV SQLPAD_PORT=3030 +ENV SQLPAD_ADMIN=${SQLPAD_USER} +ENV SQLPAD_ADMIN_PASSWORD=${SQLPAD_PASSWORD} +ENV SQLPAD_TRUST_PROXY="true" +ENV SQLPAD_BASE_URL="/dbadmin" +ENV SQLPAD_PASSPHRASE=${SQLPAD_PASSWORD}-${SQLPAD_USER}-passphrase +ENV SQLPAD_CONNECTIONS__postgres__name="Connected PostgreSQL DB" +ENV SQLPAD_CONNECTIONS__postgres__driver=postgres +ENV SQLPAD_CONNECTIONS__postgres__port="5432" +ENV SQLPAD_CONNECTIONS__postgres__host=${POSTGRES_HOST} +ENV SQLPAD_CONNECTIONS__postgres__database=${POSTGRES_DB} +ENV SQLPAD_CONNECTIONS__postgres__username=${POSTGRES_USER} +ENV SQLPAD_CONNECTIONS__postgres__password=${POSTGRES_PASSWORD} + +EXPOSE 3030 ENTRYPOINT ["/docker-entrypoint"] # Things to think about for future docker builds diff --git a/client/src/pages/SignIn.tsx b/client/src/pages/SignIn.tsx index c78bd2c80..4cbb5e14a 100644 --- a/client/src/pages/SignIn.tsx +++ b/client/src/pages/SignIn.tsx @@ -11,7 +11,7 @@ import { api } from '../utilities/api'; import useAppContext from '../utilities/use-app-context'; function SignIn() { - const [email, setEmail] = useState(''); + const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const history = useHistory(); const { config } = useAppContext(); @@ -23,7 +23,7 @@ function SignIn() { const signIn = async (e: React.FormEvent) => { e.preventDefault(); - const json = await api.post('/api/signin', { email, password }); + const json = await api.post('/api/signin', { username, password }); if (json.error) { return message.error('Username or password incorrect'); } @@ -37,21 +37,21 @@ function SignIn() { let placeholderText = ''; if (config.ldapConfigured && config.localAuthConfigured) { - placeholderText = 'username or email address'; + placeholderText = 'username'; } else if (config.ldapConfigured) { placeholderText = 'username'; } else if (config.localAuthConfigured) { - placeholderText = 'email address'; + placeholderText = 'username'; } const localLdapForm = (
) => - setEmail(e.target.value) + setUsername(e.target.value) } required /> @@ -76,7 +76,7 @@ function SignIn() { - {config.localAuthConfigured && ( + {/* {config.localAuthConfigured && ( Sign Up - )} + )} */} ); From 67f9427f39448bbac9969dccdad13ab19cd80481 Mon Sep 17 00:00:00 2001 From: Katie Harris Date: Wed, 3 Sep 2025 18:13:49 -0400 Subject: [PATCH 7/8] Use email for login --- Dockerfile | 2 +- client/src/pages/SignIn.tsx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 17864a05f..c1d680642 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,7 +78,7 @@ ENV SQLPAD_ADMIN=${SQLPAD_USER} ENV SQLPAD_ADMIN_PASSWORD=${SQLPAD_PASSWORD} ENV SQLPAD_TRUST_PROXY="true" ENV SQLPAD_BASE_URL="/dbadmin" -ENV SQLPAD_PASSPHRASE=${SQLPAD_PASSWORD}-${SQLPAD_USER}-passphrase +ENV SQLPAD_PASSPHRASE=${SQLPAD_PASSWORD}-${POSTGRES_DB}-passphrase ENV SQLPAD_CONNECTIONS__postgres__name="Connected PostgreSQL DB" ENV SQLPAD_CONNECTIONS__postgres__driver=postgres ENV SQLPAD_CONNECTIONS__postgres__port="5432" diff --git a/client/src/pages/SignIn.tsx b/client/src/pages/SignIn.tsx index 4cbb5e14a..8754e4b6f 100644 --- a/client/src/pages/SignIn.tsx +++ b/client/src/pages/SignIn.tsx @@ -11,7 +11,7 @@ import { api } from '../utilities/api'; import useAppContext from '../utilities/use-app-context'; function SignIn() { - const [username, setUsername] = useState(''); + const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const history = useHistory(); const { config } = useAppContext(); @@ -23,7 +23,7 @@ function SignIn() { const signIn = async (e: React.FormEvent) => { e.preventDefault(); - const json = await api.post('/api/signin', { username, password }); + const json = await api.post('/api/signin', { email, password }); if (json.error) { return message.error('Username or password incorrect'); } @@ -37,21 +37,21 @@ function SignIn() { let placeholderText = ''; if (config.ldapConfigured && config.localAuthConfigured) { - placeholderText = 'username'; + placeholderText = 'username or email address'; } else if (config.ldapConfigured) { placeholderText = 'username'; } else if (config.localAuthConfigured) { - placeholderText = 'username'; + placeholderText = 'email address'; } const localLdapForm = (
) => - setUsername(e.target.value) + setEmail(e.target.value) } required /> From ec483730dcfbb3afa6e49dc35a98967c5fc14628 Mon Sep 17 00:00:00 2001 From: Katie Harris Date: Wed, 3 Sep 2025 18:31:58 -0400 Subject: [PATCH 8/8] Update docker-entrypoint script --- Dockerfile | 7 ------- docker-entrypoint | 11 +++++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index c1d680642..e4dc2ab0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -74,18 +74,11 @@ COPY --from=build /sqlpad/server . ENV NODE_ENV production ENV SQLPAD_DB_PATH=/var/lib/sqlpad ENV SQLPAD_PORT=3030 -ENV SQLPAD_ADMIN=${SQLPAD_USER} -ENV SQLPAD_ADMIN_PASSWORD=${SQLPAD_PASSWORD} ENV SQLPAD_TRUST_PROXY="true" ENV SQLPAD_BASE_URL="/dbadmin" -ENV SQLPAD_PASSPHRASE=${SQLPAD_PASSWORD}-${POSTGRES_DB}-passphrase ENV SQLPAD_CONNECTIONS__postgres__name="Connected PostgreSQL DB" ENV SQLPAD_CONNECTIONS__postgres__driver=postgres ENV SQLPAD_CONNECTIONS__postgres__port="5432" -ENV SQLPAD_CONNECTIONS__postgres__host=${POSTGRES_HOST} -ENV SQLPAD_CONNECTIONS__postgres__database=${POSTGRES_DB} -ENV SQLPAD_CONNECTIONS__postgres__username=${POSTGRES_USER} -ENV SQLPAD_CONNECTIONS__postgres__password=${POSTGRES_PASSWORD} EXPOSE 3030 ENTRYPOINT ["/docker-entrypoint"] diff --git a/docker-entrypoint b/docker-entrypoint index f9ee70c2e..a7447bebd 100644 --- a/docker-entrypoint +++ b/docker-entrypoint @@ -1,5 +1,16 @@ #!/bin/bash set -e + +# Export the env variables +export SQLPAD_ADMIN="$SQLPAD_USER" +export SQLPAD_ADMIN_PASSWORD="$SQLPAD_PASSWORD" +export SQLPAD_PASSPHRASE="$SQLPAD_PASSWORD-$POSTGRES_DB-passphrase" +export SQLPAD_CONNECTIONS__postgres__host="$POSTGRES_HOST" +export SQLPAD_CONNECTIONS__postgres__database="$POSTGRES_DB" +export SQLPAD_CONNECTIONS__postgres__username="$POSTGRES_USER" +export SQLPAD_CONNECTIONS__postgres__password="$POSTGRES_PASSWORD" +export SQLPAD_CONNECTIONS__postgres__port="$POSTGRES_PORT" + # This iterates any sh file in the directory and executes them before our server starts # Note: we intentionally source the files, allowing scripts to set vars that override default behavior. if [ -d "/etc/docker-entrypoint.d" ]; then