Skip to content

Commit dbf8305

Browse files
authored
Merge pull request #85 from eduardolat/develop
Merge v0.4.0
2 parents d761283 + 39855a4 commit dbf8305

File tree

202 files changed

+5053
-9091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+5053
-9091
lines changed

.air.toml

Lines changed: 0 additions & 22 deletions
This file was deleted.

docker/compose.dev.yaml renamed to .devcontainer/compose.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
name: pgbackweb-dev
22

33
services:
4-
app:
5-
container_name: pbw_app
4+
devcontainer:
5+
container_name: pbw_devcontainer
66
build:
77
context: ../
88
dockerfile: ./docker/Dockerfile.dev
99
ports:
1010
- "8085:8085"
1111
volumes:
12-
- ../:/app
13-
- pbw_vol_app_ssh:/root/.ssh
14-
- pbw_vol_app_gh:/root/.config/gh
15-
- pbw_vol_app_go_mod_cache:/root/go/pkg/mod
12+
- ../..:/workspaces:cached
1613
networks:
1714
- pbw_network
1815
depends_on:
@@ -61,9 +58,6 @@ services:
6158
- pbw_network
6259

6360
volumes:
64-
pbw_vol_app_ssh:
65-
pbw_vol_app_gh:
66-
pbw_vol_app_go_mod_cache:
6761
pbw_vol_postgres:
6862
pbw_vol_minio:
6963

.devcontainer/devcontainer.json

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"dockerComposeFile": "./compose.yaml",
3+
"service": "devcontainer",
4+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
5+
"customizations": {
6+
"vscode": {
7+
"extensions": [
8+
"golang.go",
9+
"bradlc.vscode-tailwindcss",
10+
"denoland.vscode-deno",
11+
"mhutchie.git-graph",
12+
"mutantdino.resourcemonitor",
13+
"Compile-TomaszKasperczyk.copy-to-llm"
14+
],
15+
"settings": {
16+
/////
17+
// Editor settings
18+
/////
19+
"editor.formatOnSave": true,
20+
"editor.foldingStrategy": "indentation",
21+
"editor.rulers": [
22+
80
23+
],
24+
"files.eol": "\n",
25+
/////
26+
// Language specific settings
27+
/////
28+
"[json]": {
29+
"editor.defaultFormatter": "denoland.vscode-deno"
30+
},
31+
"[jsonc]": {
32+
"editor.defaultFormatter": "denoland.vscode-deno"
33+
},
34+
"[typescript]": {
35+
"editor.defaultFormatter": "denoland.vscode-deno"
36+
},
37+
"[javascript]": {
38+
"editor.defaultFormatter": "denoland.vscode-deno"
39+
},
40+
"[css]": {
41+
"editor.defaultFormatter": "denoland.vscode-deno"
42+
},
43+
"[html]": {
44+
"editor.defaultFormatter": "denoland.vscode-deno"
45+
},
46+
"[markdown]": {
47+
"editor.defaultFormatter": "denoland.vscode-deno"
48+
},
49+
// Go & Golangci-lint
50+
"[go]": {
51+
"editor.defaultFormatter": "golang.go"
52+
},
53+
"go.lintTool": "golangci-lint",
54+
"go.lintFlags": [
55+
"--fast"
56+
],
57+
// Deno
58+
"deno.enable": true,
59+
/////
60+
// Tailwind CSS + NodX
61+
/////
62+
"tailwindCSS.includeLanguages": {
63+
"go": "go"
64+
},
65+
"tailwindCSS.experimental.classRegex": [
66+
[
67+
"Class\\(([^)]*)\\)",
68+
"[\"`]([^\"`]*)[\"`]"
69+
], // Class("...") or Class(`...`)
70+
[
71+
"ClassMap\\{([^)]*)\\}",
72+
"[\"`]([^\"`]*)[\"`]"
73+
] // ClassMap{"..."} or ClassMap{`...`}
74+
]
75+
}
76+
}
77+
}
78+
}

.env.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ PBW_ENCRYPTION_KEY="encryption-key"
1111

1212
# Database connection string for a PostgreSQL database where the pgbackweb
1313
# will store its data.
14-
PBW_POSTGRES_CONN_STRING="postgresql://postgres:password@host.docker.internal:5432/pgbackweb?sslmode=disable"
14+
PBW_POSTGRES_CONN_STRING="postgresql://postgres:password@pbw_postgres:5432/pgbackweb?sslmode=disable"

.env.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@ PBW_ENCRYPTION_KEY=""
55
# Database connection string for a PostgreSQL database where the pgbackweb
66
# will store its data.
77
PBW_POSTGRES_CONN_STRING=""
8+
9+
# The host on which the pgbackweb will listen for incoming HTTP requests.
10+
PBW_LISTEN_HOST=""
11+
12+
# The port on which the pgbackweb will listen for incoming HTTP requests.
13+
PBW_LISTEN_PORT=""
14+
15+
# Your timezone, this impacts logging, backup filenames and default timezone
16+
# in the web interface.
17+
TZ=""
Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,54 @@
1-
name: Lint, test & build
2-
1+
name: Lint, test, and build
32
on:
3+
workflow_dispatch:
44
push:
55
branches:
66
- main
7+
- develop
78
pull_request:
89
branches:
910
- main
11+
- develop
1012

1113
jobs:
12-
build-test-lint:
13-
name: Build, test & lint
14-
runs-on: ubuntu-latest
14+
lint-test-build:
1515
strategy:
1616
matrix:
17-
platform: [linux/amd64, linux/arm64]
17+
vars: [
18+
{ os: ubuntu-24.04, platform: linux/amd64 },
19+
{ os: ubuntu-24.04-arm, platform: linux/arm64 },
20+
]
21+
22+
name: Lint, test, and build the code
23+
runs-on: ${{ matrix.vars.os }}
24+
timeout-minutes: 20
25+
1826
steps:
19-
- name: Checkout code
27+
- name: Checkout
2028
uses: actions/checkout@v4
2129

22-
- name: Set up QEMU
23-
uses: docker/setup-qemu-action@v3
24-
25-
- name: Set up Docker Buildx
30+
- name: Setup Docker buildx for multi-architecture builds
2631
uses: docker/setup-buildx-action@v3
27-
28-
- name: Build Docker image
29-
run: |
30-
docker buildx create --use
31-
docker buildx build \
32-
--platform ${{ matrix.platform }} \
33-
-t pbw-test-${{ matrix.platform }}:latest \
34-
-f ./docker/Dockerfile.cicd \
35-
--load .
36-
37-
- name: Run dependencies check
38-
run: docker run --rm --platform ${{ matrix.platform }} pbw-test-${{ matrix.platform }}:latest task check-deps
39-
40-
- name: Run linter
41-
run: docker run --rm --platform ${{ matrix.platform }} pbw-test-${{ matrix.platform }}:latest task lint-only
42-
43-
- name: Run tests
44-
run: docker run --rm --platform ${{ matrix.platform }} pbw-test-${{ matrix.platform }}:latest task test-only
45-
46-
- name: Build project
47-
run: docker run --rm --platform ${{ matrix.platform }} pbw-test-${{ matrix.platform }}:latest task build
32+
with:
33+
use: true
34+
35+
- name: Build the Docker image
36+
run: >
37+
docker buildx build
38+
--load
39+
--platform ${{ matrix.vars.platform }}
40+
--tag pgbackweb:latest
41+
--file docker/Dockerfile.dev .
42+
43+
- name: Run lint, test, and build
44+
run: >
45+
docker run --rm -v $PWD:/app pgbackweb:latest /bin/bash -c "
46+
cd /app &&
47+
deno install &&
48+
go mod download &&
49+
task fixperms &&
50+
task check-deps &&
51+
task lint-only &&
52+
task test-only &&
53+
task build
54+
"

.github/workflows/publish-docker-image.yaml

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,84 @@ on:
44
workflow_dispatch:
55
inputs:
66
commit:
7-
description: "Commit SHA or branch to build"
7+
description: The specific commit SHA or branch name to build from (e.g., main or a feature branch)
88
required: true
9-
default: "main"
10-
tags:
11-
description: "Array of docker image tags to build and push separated by commas"
9+
default: main
10+
tag:
11+
description: The version tag for the Docker image (e.g., 1.0.0)
1212
required: true
13-
default: "latest"
13+
latest:
14+
description: Choose "yes" to also tag the image as "latest" in Docker Hub
15+
required: true
16+
type: choice
17+
options:
18+
- "no"
19+
- "yes"
1420

1521
jobs:
16-
build-and-publish:
17-
name: Build and Publish Docker Image
18-
runs-on: ubuntu-latest
22+
build-and-push-images:
23+
strategy:
24+
matrix:
25+
vars: [
26+
{ os: ubuntu-24.04, platform: amd64 },
27+
{ os: ubuntu-24.04-arm, platform: arm64 },
28+
]
29+
30+
name: Build and push images
31+
runs-on: ${{ matrix.vars.os }}
32+
timeout-minutes: 20
33+
1934
steps:
2035
- name: Checkout code
2136
uses: actions/checkout@v4
2237
with:
2338
ref: ${{ github.event.inputs.commit }}
2439

25-
- name: Set up QEMU
26-
uses: docker/setup-qemu-action@v3
40+
- name: Login to Docker Hub
41+
uses: docker/login-action@v3
42+
with:
43+
username: ${{ secrets.DOCKERHUB_USER }}
44+
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
45+
46+
- name: Build the Docker image
47+
run: >
48+
docker build
49+
--tag eduardolat/pgbackweb:${{ github.event.inputs.tag }}-${{ matrix.vars.platform }}
50+
--build-arg TARGETPLATFORM=linux/${{ matrix.vars.platform }}
51+
--file docker/Dockerfile .
52+
53+
- name: Push the Docker image
54+
run: docker push eduardolat/pgbackweb:${{ github.event.inputs.tag }}-${{ matrix.vars.platform }}
2755

28-
- name: Set up Docker Buildx
29-
uses: docker/setup-buildx-action@v3
56+
merge-and-push-manifest:
57+
name: Merge manifest
58+
needs: build-and-push-images
59+
runs-on: ubuntu-24.04
60+
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
with:
65+
ref: ${{ github.event.inputs.commit }}
3066

3167
- name: Login to Docker Hub
3268
uses: docker/login-action@v3
3369
with:
3470
username: ${{ secrets.DOCKERHUB_USER }}
3571
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
3672

37-
- name: Build and push Docker image
73+
- name: Merge and push manifest
3874
run: |
39-
docker buildx create --use
40-
41-
IFS=',' read -r -a tags <<< "${{ github.event.inputs.tags }}"
42-
tag_args=""
43-
for tag in "${tags[@]}"; do
44-
tag_args="$tag_args -t eduardolat/pgbackweb:$tag"
45-
done
46-
47-
docker buildx build \
48-
--platform linux/amd64,linux/arm64 \
49-
$tag_args \
50-
-f ./docker/Dockerfile \
51-
--push .
75+
docker manifest create eduardolat/pgbackweb:${{ github.event.inputs.tag }} \
76+
eduardolat/pgbackweb:${{ github.event.inputs.tag }}-amd64 \
77+
eduardolat/pgbackweb:${{ github.event.inputs.tag }}-arm64
78+
79+
docker manifest push eduardolat/pgbackweb:${{ github.event.inputs.tag }}
80+
81+
if [ "${{ github.event.inputs.latest }}" == "yes" ]; then
82+
docker manifest create eduardolat/pgbackweb:latest \
83+
eduardolat/pgbackweb:${{ github.event.inputs.tag }}-amd64 \
84+
eduardolat/pgbackweb:${{ github.event.inputs.tag }}-arm64
85+
86+
docker manifest push eduardolat/pgbackweb:latest
87+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dist/
1313

1414
# Temp files/folders
1515
tmp/
16+
temp/
1617
.task/
1718

1819
# Binaries for programs and plugins

.vscode/extensions.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)