Switch kratos from using mem to db

This commit is contained in:
Abin Simon
2022-01-12 17:35:38 +05:30
parent d8b8fab1ff
commit 21e06a0b6f
3 changed files with 11 additions and 6 deletions
+3 -4
View File
@@ -21,11 +21,11 @@ grant execute on function uuid_generate_v4() to admindbuser;
*This will grant the necessary permission to the newly created user to run uuid_generate_v4()*
### Run migrations
### Run application migrations
We use [`golang-migrate`](https://github.com/golang-migrate/migrate) to perform migrations.
### Install [`golang-migrate`](https://github.com/golang-migrate/migrate)
#### Install [`golang-migrate`](https://github.com/golang-migrate/migrate)
``` shell
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
@@ -35,7 +35,7 @@ go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@lat
You can refer to the [guide](https://github.com/golang-migrate/migrate/tree/master/cmd/migrate) for full details.
### Run migrations
#### Run migrations
Example for `admindb`:
@@ -45,4 +45,3 @@ migrate -path ./persistence/migrations/admindb -database "$POSTGRESQL_URL" up
```
See [cli-usage](https://github.com/golang-migrate/migrate#cli-usage) for more info.
+7 -1
View File
@@ -6,6 +6,13 @@ All user/auth related requests go through here.
## Development
### Run kratos migrations
``` shell
export DSN='postgres://admindbuser@localhost:5432/admindb?sslmode=disable'
kratos -c kratos.yaml migrate sql -e --yes
```
### Start kratos
``` shell
@@ -19,4 +26,3 @@ kratos serve -c kratos.yml
cd components/usermgmt/_kratos
go run main.go
```
+1 -1
View File
@@ -1,6 +1,6 @@
version: v0.7.1-alpha.1
dsn: memory
dsn: postgres://admindbuser@localhost:5432/admindb?sslmode=disable
serve:
public: