Skip to content

Commit 2fda047

Browse files
authored
Merge pull request #37 from mittwald/update/postgres
Update/postgres
2 parents 6dd824f + b6cb742 commit 2fda047

File tree

26 files changed

+273
-128
lines changed

26 files changed

+273
-128
lines changed

.github/workflows/build.yaml

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,37 @@ on: [push]
55
jobs:
66

77
build:
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-24.04
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111

1212
- name: Set up Go
13-
uses: actions/setup-go@v4
13+
uses: actions/setup-go@v5
1414
with:
15-
go-version: "1.20"
15+
go-version: "1.23"
1616

1717
- name: Run GoReleaser
1818
uses: goreleaser/goreleaser-action@v2
1919
with:
2020
version: latest
21-
args: release --clean --snapshot --skip-publish -f build/ci/.goreleaser.yml
21+
args: release --clean --snapshot --skip publish -f build/ci/.goreleaser.yml
2222

2323
test:
24-
runs-on: ubuntu-20.04
24+
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2727

2828
- name: Set up Go
29-
uses: actions/setup-go@v4
29+
uses: actions/setup-go@v5
3030
with:
31-
go-version: "1.20"
31+
go-version: "1.23"
32+
33+
- name: install deps
34+
run: |
35+
sudo apt update
36+
sudo apt install -y libseccomp2
37+
sudo apt purge -y docker*
38+
curl -sS -L get.docker.com | sudo bash
3239
3340
- name: Install restic
3441
run: |
@@ -39,9 +46,33 @@ jobs:
3946
sudo chmod +x /usr/local/bin/restic
4047
4148
- name: install redis-cli
42-
run: sudo apt-get install redis-tools
49+
run: |
50+
sudo apt-get update
51+
sudo apt-get install redis-tools -y
52+
redis-cli --version
53+
54+
- name: install mongodb
55+
run: |
56+
sudo apt-get install gnupg curl -y
57+
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \
58+
sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
59+
--dearmor
60+
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
61+
sudo apt-get update
62+
sudo apt-get install mongodb-org-tools -y
63+
64+
- name: install postgresql
65+
run: |
66+
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
67+
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
68+
sudo apt update
69+
sudo apt install postgresql-client-17 -y
70+
71+
- name: install mariadb
72+
run: sudo apt install mariadb-client -y
4373

4474
- name: Test
45-
run: go test -v ./...
75+
run: go test -count=1 -failfast -v ./...
4676
env:
47-
RESTIC_PASSWORD: mongorepo
77+
RESTIC_PASSWORD: mongorepo
78+
DEBUG: true

.github/workflows/release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ on:
88
jobs:
99
build:
1010
name: Build and release image
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-24.04
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

1515
- name: Set up Go
16-
uses: actions/setup-go@v4
16+
uses: actions/setup-go@v5
1717
with:
18-
go-version: "1.20"
18+
go-version: "1.23"
1919

2020
- run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_TOKEN }}" quay.io
2121

Makefile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ build:
2222
-a main.go
2323

2424
test:
25-
go test -v ./...
25+
go test -count=1 -failfast -v ./...
2626

2727
lintci:
2828
docker run --rm \
2929
-v $(CURDIR):/app \
3030
-w /app \
3131
-e GOLANGCI_ADDITIONAL_YML=/app/build/ci/.golangci.yml \
32-
quay.io/mittwald/golangci-lint:0.0.29 \
32+
quay.io/mittwald/golangci-lint:0.0.37 \
3333
golangci-lint run -v --fix ./...
3434

3535
lint:
3636
docker run --rm \
3737
-v $(shell go env GOPATH):/go \
3838
-v ${CURDIR}:/app -w /app \
3939
-e GOLANGCI_ADDITIONAL_YML=/app/build/ci/.golangci.yml \
40-
quay.io/mittwald/golangci-lint:0.0.29 \
40+
quay.io/mittwald/golangci-lint:0.0.37 \
4141
golangci-lint run -v --fix ./...
4242

4343
goreleaser:
@@ -48,25 +48,35 @@ upTestMongo: downTestMongo
4848
docker-compose --file example/docker-compose/mongo.yml up -d
4949

5050
downTestMongo:
51-
docker-compose --file example/docker-compose/mongo.yml down -v --remove-orphans
51+
docker compose --file example/docker-compose/mongo.yml down -v --remove-orphans
5252

5353
upTestMysql: downTestMysql
5454
trap 'cd $(CURDIR) && make downTestMysql' 0 1 2 3 6 9 15
55-
docker-compose --file example/docker-compose/mysql.yml up -d
55+
docker compose --file example/docker-compose/mysql.yml up -d
5656

5757
downTestMysql:
58-
docker-compose --file example/docker-compose/mysql.yml down -v --remove-orphans
58+
docker compose --file example/docker-compose/mysql.yml down -v --remove-orphans
5959

6060
upTestPostgres: downTestPostgres
6161
trap 'cd $(CURDIR) && make downTestPostgres' 0 1 2 3 6 9 15
62-
docker-compose --file example/docker-compose/postgresql.yml up -d
62+
docker compose --file example/docker-compose/postgresql.yml up -d
6363

6464
downTestPostgres:
65-
docker-compose --file example/docker-compose/postgresql.yml down -v --remove-orphans
65+
docker compose --file example/docker-compose/postgresql.yml down -v --remove-orphans
6666

6767
upTestRedis: downTestRedis
6868
trap 'cd $(CURDIR) && make downTestRedis' 0 1 2 3 6 9 15
69-
docker-compose --file example/docker-compose/redis.yml up -d
69+
docker compose --file example/docker-compose/redis.yml up -d
7070

7171
downTestRedis:
72-
docker-compose --file example/docker-compose/redis.yml down -v --remove-orphans
72+
docker compose --file example/docker-compose/redis.yml down -v --remove-orphans
73+
74+
runLocalPostgres:
75+
make build
76+
docker build -f build/docker/Dockerfile . -t brudi
77+
docker run --rm --add-host=host.docker.internal:host-gateway -v ./example/config/.brudi.postgresql.yaml:/home/brudi/.brudi.yaml brudi pgdump
78+
79+
runLocalMysql:
80+
make build
81+
docker build -f build/docker/Dockerfile . -t brudi
82+
docker run --rm --add-host=host.docker.internal:host-gateway -v ./example/config/.brudi.mysql.yaml:/home/brudi/.brudi.yaml brudi mysqldump

build/ci/.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ run:
88
linters:
99
disable:
1010
- forcetypeassert
11+
- perfsprint
12+
- intrange
13+
- musttag
14+
- mnd
1115

1216
linters-settings:
1317
cyclop:

build/docker/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.18
1+
FROM alpine:3.21
22

33
LABEL maintainer="Mittwald CM Service <https://github.com/mittwald>"
44

@@ -15,6 +15,7 @@ RUN apk add --no-cache --upgrade \
1515
mongodb-tools \
1616
mysql-client \
1717
postgresql-client \
18+
gcompat \
1819
&& \
1920
addgroup \
2021
-S "${BRUDI_USER}" \

example/config/.brudi.mysql.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
mysqldump:
22
options:
33
flags:
4-
host: 127.0.0.1
4+
host: host.docker.internal
55
port: 3306
66
password: mysqlroot
77
user: root
88
opt: true
99
allDatabases: true
1010
resultFile: /tmp/test.sqldump
11+
skipSsl: true
1112
additionalArgs: []

example/config/.brudi.postgresql.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pgdump:
22
options:
33
flags:
4-
host: 127.0.0.1
4+
host: host.docker.internal
55
port: 5432
66
password: postgresroot
77
username: postgresuser

example/docker-compose/mysql.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ volumes:
66

77
services:
88
mysql:
9-
image: mysql:8
9+
image: mysql:5.7
1010
environment:
1111
MYSQL_ROOT_PASSWORD: mysqlroot
1212
MYSQL_DATABASE: mysql
1313
MYSQL_USER: mysqluser
1414
MYSQL_PASSWORD: mysql
15-
command: --default-authentication-plugin=mysql_native_password
15+
JDBC_PARAMS: 'useSSL=false'
16+
command: --default-authentication-plugin=mysql_native_password --skip-ssl
1617
volumes:
1718
- mysql-data:/var/lib/mysql
1819
ports:

example/docker-compose/postgresql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ volumes:
66

77
services:
88
postgres:
9-
image: postgres:12
9+
image: postgres:17
1010
volumes:
1111
- postgres-data:/var/lib/postgresql/data
1212
environment:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/mittwald/brudi
22

3-
go 1.20
3+
go 1.23
44

55
require (
66
github.com/docker/go-connections v0.4.0

0 commit comments

Comments
 (0)