Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to do all the (first time) database initialisation #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pmeulen
Copy link
Member

@pmeulen pmeulen commented Sep 21, 2023

The script can be safely run multiple times, e.g. to upgrade the database schema for new versions, or to update the middleware configuration

@pmeulen pmeulen requested a review from quartje September 21, 2023 12:52
@pmeulen pmeulen force-pushed the feature/add-db-init-script branch from fe8a7ae to 78f380c Compare September 21, 2023 12:56
Copy link
Contributor

@quartje quartje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, this will make the initial setup easier. We also need to update the README.md to reflect this?

The script vcan be safely run multiple times, e.g. to upgrade the database schema for new versions, or to update the middleware configuration
@pmeulen pmeulen force-pushed the feature/add-db-init-script branch from 4422b75 to f15fc55 Compare September 22, 2023 11:33
@pmeulen
Copy link
Member Author

pmeulen commented Sep 22, 2023

nice, this will make the initial setup easier. We also need to update the README.md to reflect this?

Yes, I had held back this change because #5 modified the README as well. I've now rebased and updated the README with the new instructions.

@pmeulen
Copy link
Member Author

pmeulen commented Sep 22, 2023

As discussed in OpenConext/Stepup-Middleware#410, running the console command as root is troublesome because it messes op the ownership of the Symfony cache. I've added chowns the the init script to fix that.

Another option would be to use sudo, but that would require adding the sudo package to the base container(s). That could be a better solution to cache ownership issue.

Copy link
Contributor

@quartje quartje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, let's merge! As discussed, I will add a story to the backlog to make an entrypoint on the Symfony dockers that creates and chowns cache during startup of the container

Copy link
Member

@MKodde MKodde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice optimizations!

127.0.0.1 selfservice.dev.openconext.local webauthn.dev.openconext.local ssp.dev.openconext.local gateway.dev.openconext.local middleware.dev.openconext.local ra.dev.openconext.local demogssp.dev.openconext.local
```

Secondly you need to create the `stepup/gateway/surfnet_yubikey.yaml` filewith your Yubikey API credentials. If you do not have API credentials, you can get them at <https://upgrade.yubico.com/getapikey/>. You require a Yubikey to get an API key.
Secondly you need to create the `stepup/gateway/surfnet_yubikey.yaml` filew ith your Yubikey API credentials. If you do not have API credentials, you can get them at <https://upgrade.yubico.com/getapikey/>. You require a Yubikey to get an API key.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: filew ith file with

@@ -0,0 +1,25 @@
#!/bin/bash

set -e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curiosity: why do you instruct the script to immediately exit upon error in this script, and not in the others? Is there a distinct advantage for doing it here?

TIL: set -x is going to help me in the future while writing bash

This associates the admin account with your Yubikey. The account has SRAA rights. You can then use your Yubikey to log in as user `admin` with password `admin`. Note that you must run this command before the first time you log in with the admin account to the SA or RA, otherwise this command will fail because the admin identity already exists.

```shell
docker compose exec middleware /var/www/html/bin/console middleware:bootstrap:identity-with-yubikey urn:collab:person:dev.openconext.local:admin dev.openconext.local "Your Name" Your@email en_GB Yubikey_ID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intentionally not move this to a script? I'm totally fine with having it in the README as it also ensures you need to remain engaged in order to not mis a step.

Mailcatcher is included. You can view the email by going to http://localhost:1080
You can now login to the self-service portal at <https://selfservice.dev.openconext.local> and login to the RA portal at <https://ra.dev.openconext.local> using your admin/admin account.

Mailcatcher is included. You can view the email by going to <http://localhost:1080>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR: @quartje can we give her a hostname?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants