Skip to content

Commit db1f329

Browse files
committed
feat: add support for postgresql
1 parent 3f9316f commit db1f329

File tree

5 files changed

+229
-3
lines changed

5 files changed

+229
-3
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5-
"name": "Launch Package",
5+
"name": "Run API (SQLite)",
66
"type": "go",
77
"request": "launch",
88
"mode": "auto",

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,62 @@ Envelope Zero is fundamentally rooted in two ideas:
55
- Using the [envelope method](https://en.wikipedia.org/wiki/Envelope_system) to budget expenses into envelopes.
66
- Zero Based Budeting, meaning that you assign all your money to an envelope. Saving for a vacation? Create an envelope and archive it after your vacation. Rent? Create an envelope that gets a fixed amount of money added every month.
77

8+
## Usage
9+
10+
The recommended and only supported way for production deployments is to run the backend with [the OCI image](https://github.com/envelope-zero/backend/pkgs/container/backend).
11+
12+
### Deployment methods
13+
14+
If you want to deploy with a method not listed here, you are welcome to open a discussion to ask any questions needed so that this documentation can be improved.
15+
16+
#### On Kubernetes
17+
18+
You can run the backend on any Kubernetes cluster with a supported version using the [morremeyer/generic]() helm chart with the following values:
19+
20+
```yaml
21+
image:
22+
repository: ghcr.io/envelope-zero/backend
23+
tag: v0.2.1
24+
25+
# Only set this when you want to use sqlite as database backend.
26+
# In this case, you need to make sure the database is regularly backed up!
27+
persistence:
28+
enabled: true
29+
mountPath: /app/data
30+
31+
ports:
32+
- name: http
33+
containerPort: 8080
34+
protocol: TCP
35+
36+
ingress:
37+
enabled: true
38+
hosts:
39+
- host: envelope-zero.example.com
40+
paths:
41+
- path: /api
42+
tls:
43+
- hosts:
44+
- envelope-zero.example.com
45+
```
46+
47+
### Database backends
48+
49+
Envelope Zero currently supports sqlite and postgresql as database backends. While sqlite is supported, it is highly recommended to use postgresql for production purposes.
50+
51+
#### sqlite
52+
53+
No configuration is needed, but you need to mount a persistent volume to the `/app/data` directory or the backend won’t start.
54+
55+
#### postgresql
56+
57+
Set the following environment variables:
58+
59+
- `DB_HOST`: The hostname for the postgresql instance
60+
- `DB_USER`: The username to connect with
61+
- `DB_PASSWORD`: The password for `DB_USER`
62+
- `DB_NAME`: The name of the database to use
63+
864
## Supported Versions
965

1066
This project is under heavy development. Therefore, only the latest release is supported.

go.mod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ require (
1111

1212
require (
1313
github.com/davecgh/go-spew v1.1.1 // indirect
14+
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
15+
github.com/jackc/pgconn v1.10.1 // indirect
16+
github.com/jackc/pgio v1.0.0 // indirect
17+
github.com/jackc/pgpassfile v1.0.0 // indirect
18+
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
19+
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
20+
github.com/jackc/pgtype v1.9.1 // indirect
21+
github.com/jackc/pgx/v4 v4.14.1 // indirect
1422
github.com/pmezard/go-difflib v1.0.0 // indirect
1523
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
1624
)
@@ -36,6 +44,7 @@ require (
3644
golang.org/x/text v0.3.7 // indirect
3745
google.golang.org/protobuf v1.27.1 // indirect
3846
gopkg.in/yaml.v2 v2.4.0 // indirect
47+
gorm.io/driver/postgres v1.3.1
3948
)
4049

4150
replace github.com/envelope-zero/backend/internal/routing => ./internal/routing

0 commit comments

Comments
 (0)