Rollback to master #3

Merged
esilva merged 7 commits from rollback_to_master into master 2026-10-15 14:37:29 +01:00
5 changed files with 42 additions and 6 deletions
Showing only changes of commit d4e45858aa - Show all commits
+4
View File
@@ -0,0 +1,4 @@
PGDATA=/var/lib/postgresql/data
POSTGRES_USER=expdbuser
POSTGRES_PASSWORD=expDBPass
POSTGRES_DB=expenses
+9
View File
@@ -13,6 +13,15 @@ build_release_alpine:
mkdir -p $(build)/data/
find $(build) -name "*.ttf" ! -name DejaVuSansMono.ttf -delete
devdb_start:
podman compose start database
devdb_status:
podman compose stats database
devdb_stop:
podman compose stop database
build_image: build_release_alpine
docker buildx build -t $(registry)/$(repo)/expensesweb:$(tag) .
+15
View File
@@ -0,0 +1,15 @@
# Download a production database's data
```bash
docker exec -i <container-name> \
pg_dump -U <db-user> -a -d <database> > outputfile.sql
```
# Start a local development database
# Upload a database
```bash
# delete the pgsql-data-dev directory contents
# restart the container
psql -h 127.0.0.1 -p 5431 -U expdbuser -d expenses -f ./data.sql
```
+10
View File
@@ -0,0 +1,10 @@
services:
database:
image: docker.io/library/postgres:16
container_name: expenses-dev-db
hostname: expenses-dev-db
env_file:
- .pgenv
ports:
- "5431:5432"
restart: unless-stopped
+4 -6
View File
@@ -23,10 +23,8 @@ type ExpApp struct {
TypeRepo repo.TypeRepository
}
var (
// App provides access to the expenses main service.
App *ExpApp
)
// App provides access to the expenses main service.
var App *ExpApp
// NewExpenseApp returns a new instance of our core App.
func NewExpenseApp(dbPool *pgxpool.Pool, luaVM *lua.LState) *ExpApp {
@@ -103,7 +101,7 @@ func createPGXPoolConn(ctx context.Context) (*pgxpool.Pool, error) {
var result int
err = conn.QueryRow(ctx, "SELECT 1").Scan(&result)
if err != nil {
panic("connection test query failed: " + err.Error())
return nil, err
}
return conn, nil
@@ -123,7 +121,7 @@ func StartApp() error {
// Run the migrations
err = runMigrations(luaVM)
if err != nil {
log.Printf("Unable to run migrations: %v", err)
log.Fatalf("Unable to run migrations: %v", err)
}
// Create our final app thing