-
Notifications
You must be signed in to change notification settings - Fork 28
Require fewer secrets for local dev #216
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
Conversation
Set up ldap 'mock' to allow for testing without access to actual ldap, and for mocking out fake accounts to test various features
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! We should do the same on a few other projects to enable easier local dev after we've graduated
That's the plan, once I remember to get around to it. |
You can use an existing database, like the instance used for the dev branch, use a database on another server, or spin up a container using docker or podman. | ||
To get setup using docker, run | ||
```bash | ||
docker run --name packet-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not just toss this into a docker-compose file, like I did for self-service?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use podman, so docker-compose is not something I default to yet.
After the container starts up, you should be able to connect with the connection string `postgresql://postgres:mysecretpassword@localhost:5432/postgres`, which is the default connection string in `config.env.py`. | ||
Once the container is up, run the following to set up the database tables. | ||
```bash | ||
flask db upgrade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really get in the habit of having the application itself run migrations automatically when it starts. I'm not sure there is any reason not to.
This PR gets most of the way to enabling secretless local development, but not quite.
I haven't wrapped SSO to enable developing completely offline, but this PR adds:
SSO will need a wrapper or overrides for the core methods, similar to LDAPWrapper, which is beyond what I'm prepared to do at the moment.
This should make hacktoberfest somewhat simpler, as well as making it easier to work in codespaces (though this is still heavily limited by sso).