Skip to content

Improve Admin User bootstrap process #1

Description

@jjnaude

We currently use the little .bat shell script createAdminUser.bat to create the first admin user when a new instance of Detweb is brought up. That admin user can then create projects, promote other users to admins, add them to projects etc. This has a number of issues:

  • The use of a .bat shell script ties the development environment to windows. It would be preferred if we could do this in Node/Python
  • It needs to be run as a separate step. Ideally it should happen automatically as part of cdk deploy.
  • It requires two command line parameters (The ID of the Appsync API and the ID of the associated Cognito userpool). Currently the user must copy-paste these from CDK outputs. No reason why the code cannot fetch these values automatically.
  • It creates a user with a fixed name, email, temp password etc. The user should be prompted for this info in a user friendly way.
  • The regions of both cognito pool and dynamo db instances are hardcoded. These should be extracted automatically.
  • The existing script has no error-checking/error-handling.

Ideally this step could be implemented as part of the CDK script itself, but it really is a post-deploy action (we can't add a user to the cognito userpool before that pool has been created and similarly we cant write user metadata to the DynamoDB User Table before the table has been created. Still, CDK is powerful, this might be possible. I just couldn't see a quick way, so I wrote the bat script as a stopgap.

Alternatively this might be added to the existing post-deploy lambda. This is definitely possible, we might just have to add some additional rights for the lambda, get the user input with the CDK script and pass it to the Lambda as environment variables.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions