Skip to content

Commit

Permalink
Adding postgres and mssql DB support
Browse files Browse the repository at this point in the history
  • Loading branch information
leodip committed Nov 23, 2024
1 parent f10265f commit aacf243
Show file tree
Hide file tree
Showing 76 changed files with 4,985 additions and 121 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Goiabada makes user management easy for app developers. You can set up users, gr
- Self-service account page for users to update their details
- OAuth2 support, including authorization code flow and client credentials flow
- OpenID Connect support
- Compatible with MySQL and SQLite databases (other DBs coming soon)
- Databases supported: MySQL, PostgreSQL, Microsoft SQL Server, SQLite

Documentation: [https://goiabada.dev](https://goiabada.dev).

Expand Down
2 changes: 1 addition & 1 deletion mkdocs/docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Flag: `--db-type`

Default: sqlite

Description: Currently `mysql` and `sqlite` are supported.
Description: Currently `mysql`, `postgres`, `mssql`, `sqlite` are supported.

---

Expand Down
2 changes: 2 additions & 0 deletions mkdocs/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Save this [docker compose file](https://github.com/leodip/goiabada/tree/main/src
docker compose -f docker-compose-mysql.yml up -d
```

We also support postgres, mssql and sqlite.

If you want to test it with sqlite you can use this [docker compose file](https://github.com/leodip/goiabada/tree/main/src/build/docker-compose-sqlite.yml) instead.

```
Expand Down
2 changes: 1 addition & 1 deletion mkdocs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Goiabada makes user management easy for app developers. You can set up users, gr
- Self-service account page for users to update their details
- OAuth2 support, including authorization code flow and client credentials flow
- OpenID Connect support
- Compatible with MySQL and SQLite databases (other DBs coming soon)
- Databases supported: MySQL, PostgreSQL, Microsoft SQL Server, SQLite

## Screenshots

Expand Down
30 changes: 24 additions & 6 deletions src/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,33 @@ ENV GOIABADA_AUTHSERVER_STATICDIR=""
ENV GOIABADA_AUTHSERVER_TEMPLATEDIR=""

# mysql
ENV GOIABADA_DB_TYPE="mysql"
ENV GOIABADA_DB_USERNAME="root"
ENV GOIABADA_DB_PASSWORD="abc123"
ENV GOIABADA_DB_HOST="mysql-server"
ENV GOIABADA_DB_PORT="3306"
ENV GOIABADA_DB_NAME="goiabada"
# ENV GOIABADA_DB_TYPE="mysql"
# ENV GOIABADA_DB_USERNAME="root"
# ENV GOIABADA_DB_PASSWORD="abc123"
# ENV GOIABADA_DB_HOST="mysql-server"
# ENV GOIABADA_DB_PORT="3306"
# ENV GOIABADA_DB_NAME="goiabada"

# sqlite
#ENV GOIABADA_DB_TYPE="sqlite"
#ENV GOIABADA_DB_DSN="file:/workspaces/goiabada/goiabada.db?_pragma=busy_timeout=5000&_pragma=journal_mode=WAL"

# postgres
# ENV GOIABADA_DB_TYPE="postgres"
# ENV GOIABADA_DB_USERNAME="postgres"
# ENV GOIABADA_DB_PASSWORD="abc123"
# ENV GOIABADA_DB_HOST="postgres-server"
# ENV GOIABADA_DB_PORT="5432"
# ENV GOIABADA_DB_NAME="goiabada"

# mssql
ENV GOIABADA_DB_TYPE="mssql"
ENV GOIABADA_DB_USERNAME="sa"
ENV GOIABADA_DB_PASSWORD="YourStr0ngPassw0rd!"
ENV GOIABADA_DB_HOST="mssql-server"
ENV GOIABADA_DB_PORT="1433"
ENV GOIABADA_DB_NAME="goiabada"

ENV GOIABADA_DB_DSN="file::memory:?cache=shared"

ENV GOIABADA_ADMINCONSOLE_BASEURL="http://localhost:9091"
Expand Down
30 changes: 30 additions & 0 deletions src/.devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@ services:
networks:
- goiabada-network

postgres-server:
image: postgres:latest
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: abc123
networks:
- goiabada-network

mssql-server:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: YourStr0ngPassw0rd! # Must be at least 8 characters including uppercase, lowercase, digits
MSSQL_PID: Developer
ports:
- 1433:1433
volumes:
- mssql-data:/var/opt/mssql
networks:
- goiabada-network
deploy:
resources:
limits:
memory: 2GB # SQL Server requires at least 2GB of RAM

mailhog:
image: mailhog/mailhog
ports:
Expand All @@ -32,6 +60,8 @@ services:

volumes:
mysql-data:
postgres-data:
mssql-data:

networks:
goiabada-network:
Expand Down
16 changes: 16 additions & 0 deletions src/adminconsole/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,35 @@ replace github.com/leodip/goiabada/core => ../core

require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/boombuler/barcode v1.0.2 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-chi/cors v1.2.1 // indirect
github.com/go-chi/httprate v0.14.1 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang-migrate/migrate/v4 v4.18.1 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/huandu/go-sqlbuilder v1.32.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/microsoft/go-mssqldb v1.7.2 // indirect
github.com/mileusna/useragent v1.3.5 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -46,7 +60,9 @@ require (
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/text v0.20.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/gc/v3 v3.0.0-20241004144649-1aea3fae8852 // indirect
modernc.org/libc v1.61.2 // indirect
Expand Down
Loading

0 comments on commit aacf243

Please sign in to comment.