You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initial commit of auth proxy and user management (#154)
* Initial commit of auth proxy and user management
Using Ory Kratos and Oathkeeper.
Added Zero module parameter to enable or disable.
Still need to add proper DB and mail support.
Not including oathkeeper rules for now, as since we are using the operator we can define them in the backend project.
* Adds licensing info (#157)
* user_access: all users to have replicaset access (#158)
* user_access: all users to have replicaset access
to check rollout status for deployments, permission to list replicaset
is needed
* typo: fix missing semicolon for sql statement
* fixup! typo: fix missing semicolon for sql statement
* Add proper creation of auth database, a bunch of refactoring to the db creation process.
* Set hostname in kratos flows, a couple other changes from David
* Change cors allow to frontend domain
Copy file name to clipboardExpand all lines: db-ops/job-create-db-postgres.yml.tpl
+16-21Lines changed: 16 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -2,52 +2,46 @@ apiVersion: v1
2
2
kind: Namespace
3
3
metadata:
4
4
name: db-ops
5
+
5
6
---
6
7
apiVersion: v1
7
8
kind: Secret
8
9
metadata:
9
10
name: db-create-users
10
11
namespace: db-ops
11
12
type: Opaque
12
-
stringData:
13
+
stringData:
14
+
RDS_MASTER_PASSWORD: $MASTER_RDS_PASSWORD
13
15
create-user.sql: |
14
-
REVOKE ALL PRIVILEGES ON DATABASE $DB_NAME FROM $DB_APP_USERNAME;
15
-
DROP USER $DB_APP_USERNAME;
16
+
SELECT 'CREATE DATABASE $DB_NAME' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$DB_NAME');\gexec
17
+
SELECT 'REVOKE ALL PRIVILEGES ON DATABASE $DB_NAME FROM $DB_APP_USERNAME;' WHERE EXISTS (SELECT FROM pg_roles WHERE rolname = '$DB_APP_USERNAME');\gexec
18
+
SELECT 'DROP USER $DB_APP_USERNAME;' WHERE EXISTS (SELECT FROM pg_user WHERE usename = '$DB_APP_USERNAME');\gexec
16
19
CREATE USER $DB_APP_USERNAME WITH ENCRYPTED PASSWORD '$DB_APP_PASSWORD';
17
20
GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_APP_USERNAME;
18
-
RDS_MASTER_PASSWORD: $MASTER_RDS_PASSWORD
21
+
19
22
---
20
23
apiVersion: v1
21
24
kind: Namespace
22
25
metadata:
23
-
name: $PROJECT_NAME
24
-
---
25
-
apiVersion: v1
26
-
kind: Secret
27
-
metadata:
28
-
name: $PROJECT_NAME
29
-
namespace: $PROJECT_NAME
30
-
type: Opaque
31
-
stringData:
32
-
DATABASE_USERNAME: $DB_APP_USERNAME
33
-
DATABASE_PASSWORD: $DB_APP_PASSWORD
26
+
name: $NAMESPACE
27
+
34
28
---
35
29
apiVersion: batch/v1
36
30
kind: Job
37
31
metadata:
38
-
name: db-create-users-$JOB_ID
32
+
name: db-create-users-$NAMESPACE-$JOB_ID
39
33
namespace: db-ops
40
34
spec:
41
35
template:
42
36
spec:
43
37
containers:
44
38
- name: create-rds-user
45
39
image: $DOCKER_IMAGE_TAG
46
-
command:
40
+
command:
47
41
- sh
48
-
args:
49
-
- '-c'
50
-
- psql -U$MASTER_RDS_USERNAME -h $DB_ENDPOINT$DB_NAME -a -f/db-ops/create-user.sql > /dev/null
Copy file name to clipboardExpand all lines: templates/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,9 +91,9 @@ $ curl --request POST \
91
91
For Application use, see [Sendgrid resources][sendgrid-send-mail] on how to setup templates to send dynamic transactional emails. To setup emailing from your application deployment, you should create a kubernetes secret with your Sendgrid API Key(already stored in [AWS secret-manager](./terraform/bootstrap/secrets/main.tf)) in your application's namespace. Then mount the secret as an environment variable in your deployment.
92
92
93
93
#### Application database user creation
94
-
A database user will automatically be created for a backend application with a random password, and the credentials will be stored in a kubernetes secret so they are available to the application.
94
+
A database user will automatically be created for a backend application with a random password, and the credentials will be stored in a kubernetes secret in the application namespace so they are available to the application.
95
95
96
-
_Note: the user creation only happens once during `zero apply`. If you want to run this process again to create a new password, you can run the script `sh dp-ops/create-db-user.sh` manually, though be aware that this will cause the user and its privileges to be removed and recreated, and may disrupt your application until it is restarted.
96
+
_Note: the user creation only happens once during `zero apply`. The creation happens in the script `zero-aws-eks-stack/dp-ops/create-db-user.sh`. This script should most likely not be run again as it could remove any subsequent changes to the db user or kubernetes secret._
0 commit comments