Skip to content

Commit 1c71024

Browse files
committed
first commit
0 parents  commit 1c71024

File tree

89 files changed

+18337
-0
lines changed

Some content is hidden

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

89 files changed

+18337
-0
lines changed

.air.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
root = "."
2+
testdata_dir = "testdata"
3+
tmp_dir = "tmp"
4+
5+
[build]
6+
args_bin = []
7+
bin = "./tmp/main"
8+
cmd = "go build -o ./tmp/main cmd/server/main.go"
9+
delay = 1000
10+
exclude_dir = ["assets", "tmp", "vendor", "testdata", "bin", "logs"]
11+
exclude_file = []
12+
exclude_regex = ["_test.go"]
13+
exclude_unchanged = false
14+
follow_symlink = false
15+
full_bin = ""
16+
include_dir = []
17+
include_ext = ["go", "tpl", "tmpl", "html", "json", "env"]
18+
include_file = []
19+
kill_delay = "0s"
20+
log = "build-errors.log"
21+
rerun = false
22+
rerun_delay = 500
23+
send_interrupt = false
24+
stop_on_root = false
25+
26+
[color]
27+
app = ""
28+
build = "yellow"
29+
main = "magenta"
30+
runner = "green"
31+
watcher = "cyan"
32+
33+
[log]
34+
main_only = false
35+
time = false
36+
37+
[misc]
38+
clean_on_exit = false
39+
40+
[screen]
41+
clear_on_rebuild = false
42+
keep_scroll = true

.env.example

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# API Configuration
2+
PORT=8080
3+
API_KEY=your-secure-api-key-here
4+
5+
# S3 Configuration (Hetzner Object Storage example)
6+
S3_ENDPOINT=https://hel1.your-objectstorage.com
7+
S3_REGION=hel1
8+
S3_BUCKET=your-bucket-name
9+
S3_ACCESS_KEY_ID=your-s3-access-key
10+
S3_SECRET_ACCESS_KEY=your-s3-secret-key
11+
S3_USE_SSL=true
12+
13+
# S3 Configuration (AWS S3 example - uncomment and modify)
14+
# S3_ENDPOINT=
15+
# S3_REGION=us-east-1
16+
# S3_BUCKET=your-aws-bucket
17+
# S3_ACCESS_KEY_ID=your-aws-access-key
18+
# S3_SECRET_ACCESS_KEY=your-aws-secret-key
19+
# S3_USE_SSL=true
20+
21+
# S3 Configuration (MinIO example - uncomment and modify)
22+
# S3_ENDPOINT=http://localhost:9000
23+
# S3_REGION=us-east-1
24+
# S3_BUCKET=postgres-backups
25+
# S3_ACCESS_KEY_ID=minioadmin
26+
# S3_SECRET_ACCESS_KEY=minioadmin
27+
# S3_USE_SSL=false
28+
29+
# Application Configuration
30+
LOG_LEVEL=info
31+
BACKUP_TEMP_DIR=/tmp/postgres-backups

.github/workflows/docker-build.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
strategy:
22+
matrix:
23+
include:
24+
- component: api
25+
dockerfile: Dockerfile.api
26+
context: .
27+
- component: worker
28+
dockerfile: Dockerfile.worker
29+
context: .
30+
- component: frontend
31+
dockerfile: frontend/Dockerfile
32+
context: frontend
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Log in to Container Registry
42+
if: github.event_name != 'pull_request'
43+
uses: docker/login-action@v3
44+
with:
45+
registry: ${{ env.REGISTRY }}
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Extract metadata
50+
id: meta
51+
uses: docker/metadata-action@v5
52+
with:
53+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.component }}
54+
tags: |
55+
type=ref,event=branch
56+
type=ref,event=pr
57+
type=semver,pattern={{version}}
58+
type=semver,pattern={{major}}.{{minor}}
59+
type=raw,value=latest,enable={{is_default_branch}}
60+
61+
- name: Build and push Docker image
62+
uses: docker/build-push-action@v5
63+
with:
64+
context: ${{ matrix.context }}
65+
file: ${{ matrix.dockerfile }}
66+
platforms: linux/amd64,linux/arm64
67+
push: ${{ github.event_name != 'pull_request' }}
68+
tags: ${{ steps.meta.outputs.tags }}
69+
labels: ${{ steps.meta.outputs.labels }}
70+
cache-from: type=gha
71+
cache-to: type=gha,mode=max
72+
73+
# Job para criar release notes se for tag
74+
release:
75+
if: startsWith(github.ref, 'refs/tags/')
76+
needs: build
77+
runs-on: ubuntu-latest
78+
permissions:
79+
contents: write
80+
steps:
81+
- name: Checkout
82+
uses: actions/checkout@v4
83+
84+
- name: Create Release
85+
uses: actions/create-release@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
with:
89+
tag_name: ${{ github.ref_name }}
90+
release_name: Release ${{ github.ref_name }}
91+
body: |
92+
## 🚀 PostgreSQL Backup Service ${{ github.ref_name }}
93+
94+
### 📦 Docker Images Published:
95+
- `ghcr.io/${{ github.repository }}-api:${{ github.ref_name }}`
96+
- `ghcr.io/${{ github.repository }}-worker:${{ github.ref_name }}`
97+
- `ghcr.io/${{ github.repository }}-frontend:${{ github.ref_name }}`
98+
99+
### 🏗️ Architectures:
100+
- linux/amd64
101+
- linux/arm64
102+
103+
### 📋 Usage:
104+
```bash
105+
# Pull images
106+
docker pull ghcr.io/${{ github.repository }}-api:${{ github.ref_name }}
107+
docker pull ghcr.io/${{ github.repository }}-worker:${{ github.ref_name }}
108+
docker pull ghcr.io/${{ github.repository }}-frontend:${{ github.ref_name }}
109+
110+
# Or use docker-compose with registry images
111+
```
112+
draft: false
113+
prerelease: false

.gitignore

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
bin/
8+
dist/
9+
10+
# Test binary, built with `go test -c`
11+
*.test
12+
13+
# Output of the go coverage tool, specifically when used with LiteIDE
14+
*.out
15+
coverage.html
16+
17+
# Dependency directories (remove the comment below to include it)
18+
vendor/
19+
20+
# Go workspace file
21+
go.work
22+
23+
# Environment variables
24+
.env
25+
.env.local
26+
.env.production
27+
28+
# IDE
29+
.vscode/
30+
.idea/
31+
*.swp
32+
*.swo
33+
*~
34+
35+
# OS generated files
36+
.DS_Store
37+
.DS_Store?
38+
._*
39+
.Spotlight-V100
40+
.Trashes
41+
ehthumbs.db
42+
Thumbs.db
43+
44+
# Logs
45+
*.log
46+
logs/*
47+
48+
# Temporary files
49+
tmp/
50+
temp/
51+
/tmp/postgres-backups/
52+
53+
# Air live reload
54+
build-errors.log
55+
56+
# Application specific
57+
postgres-backup
58+
evolution-postgres-backup
59+
60+
# Docker
61+
.dockerignore
62+
63+
# Development tools
64+
air_tmp/
65+
66+
# Data
67+
./backup-data/*
68+
./backup-temp/.*

0 commit comments

Comments
 (0)