Rollback to master #3
@@ -0,0 +1,4 @@
|
||||
PGDATA=/var/lib/postgresql/data
|
||||
POSTGRES_USER=expdbuser
|
||||
POSTGRES_PASSWORD=expDBPass
|
||||
POSTGRES_DB=expenses
|
||||
@@ -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) .
|
||||
|
||||
|
||||
@@ -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
|
||||
```
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user