Merge lp://staging/~bloodearnest/canonical-identity-provider/sso-dev into lp://staging/canonical-identity-provider/release
Status: | Work in progress |
---|---|
Proposed branch: | lp://staging/~bloodearnest/canonical-identity-provider/sso-dev |
Merge into: | lp://staging/canonical-identity-provider/release |
Diff against target: |
1052 lines (+803/-37) 16 files modified
.bzrignore (+5/-1) Makefile (+162/-0) Makefile.common (+35/-28) Makefile.juju (+120/-0) README.juju (+220/-0) django_project/deploy.yaml (+25/-0) django_project/paths.py (+3/-1) django_project/settings_base.py (+1/-1) django_project/settings_devel_juju.py (+54/-0) django_project/ssh_config (+8/-0) requirements_devel.txt (+1/-1) run-tests-juju (+52/-0) scripts/acceptance-dev-juju.sh (+66/-0) scripts/setup-localmail.sh (+47/-0) src/identityprovider/tests/test_command_cleanup.py (+4/-4) src/webui/tests/test_views_ui.py (+0/-1) |
To merge this branch: | bzr merge lp://staging/~bloodearnest/canonical-identity-provider/sso-dev |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Manrique (community) | Approve | ||
Review via email:
|
Description of the change
Merge juju dev work
Notes:
1) This MP supports side-by-side dev envs. The juju one is enabled with
I_CAN_
The following files are forks specific to juju dev env. When the juju dev
env becomes default, these will replace/merge with their original files.
./django_
./django_
./scripts/
./run-tests-juju
./Makefile.juju
./README.juju
2) The charm is checked out into ../sso-charm, and then used to deploy.
You can deploy a custom charm branch by specifying CHARM_BRANCH. The
following directories are bind mounted into the container
$PWD -> /srv/login.
$PWD/logs -> /srv/login.
$PWD/
$HOME -> $HOME
This means all logs will be available in ./logs, and the charm will
generate it's config into ./django_project, for easy inspection. $HOME
mounting is mainly for convienince.
3) bootstrap: this now effectively does two things, both separate make
targets in their own right.
make dependencies - this is what the old bootstrap did (venv, cfgmgr,
make deploy - this will setup juju repo and envoronemtn and deploy
So, for getting set up first time, we still use make bootstrap. But once
we're set up, we probably want to use make dependencies/deploy as needed,
but bootstrap will still work.
We shouldn't need to teardown the juju env often. If we do, make
juju-destroy will do that, and deploy will create it again and deploy.
4) config has changed quite a bit to support developing with the charm, but
has also simplified a lot in the process, for both the charm and sso
trunk.
- We use explicit DJANGO_
with normal django usage.
e.g. DJANGO_
This is exposed on the charm, and allows for explicit staging/prod
settings (in other projects, anyway - sso doesn't use them because it's
open source)
- all these modules import from 'settings', which are the charm generated
settings.
- the symlink from django_
gone (along with related issues)
- A developer can create and modify django_
modify settings in development - this file is bzrignored.
5) DB: postgres now runs as system postgres in the container, configured via
the charm and very close to the old db dev config. The big difference is
that it's not running on /dev/shm, as this added significant complexity
for little benefit. Happy to revisit this if people find it an issue.
So:
- start-db/stop-db are gone as now obsolete
- reset-db/setup-db are preserved, but are the same command - drop the db
and recreate it, run migrations
- have proposed db-setup/db-reset as better tab-completion friendly
names, but kept old names too
6) gunicorn: now runs constantly as charm configured service in the
container, on port 8080, like prod, but with code reloading enabled.
- gunicorn logs are in ./logs dir
- For debugging, use make run as before, It stops the system gunicorn,
and then runs it manually in the foreground on the same port. It uses
the same config, but timeout is increased and logging is directed to
stdout. When you've finished debugging, it will start gunicorn again
in the container.
7) localmail: this is now installed by default in the container, and the dev
configuration uses it by default. No more need to manually start up an
smtp server.
- logs will be in ./logs/
- mbox file at ./logs/
- simple web view at port 8880 on container
8) acceptance tests have been simplified a lot in the process
- in dev, we no longer need to run sso/localmail in screen - they are
always running
- all server and client side config for dev acceptance tests was moved to
the default development config. This means no config changes are need
to run acceptance tests against a local dev server. This involved changing the default test emails, so as not to leak it, and couple of test changes to match
No need to juggle files or change the server config at all :)
- For staging prod, we use an explicit config to run the tests
DJANGO_
- the acceptance db setup was moved into the Makefile
9) The Makefiles has seen a lot of work. It is more complex that it needs to
be, in order to support side-by-side dev envs, but that should only be
temporary.
- Makefile.common - the tasks that do sso stuff, shared between old and
new dev environments.
- Makefile.db - old env db tasks
- Makefile - new entrypoint that sshs into container if needed, and houses
the commands to manage the lxc. If using old env, it just includes
Makefile.common and Makefile.db, and the old env's definition of run and
bootstrap.
- Makefile.juju - the new juju specific commands, mainly about charms and
deploying.
Once this work has fully landed, it is anticipated that we will return to
just a single Makefile, which will include a base common ols Makefile as
a dependency.
I also added a make help command, since we'd discussed the idea before, and I was adding a whole bunch of new commands, so it seemed like a good plan
Unmerged revisions
- 1383. By Simon Davy
-
fix some small issues from user testing
- 1382. By Simon Davy
-
merging
- 1381. By Simon Davy
-
merging
- 1380. By Simon Davy
-
merging
- 1379. By Simon Davy
-
merging
- 1378. By Simon Davy
-
merging
- 1377. By Simon Davy
-
merging properly this time
- 1376. By Simon Davy
-
merging
- 1375. By Simon Davy
-
merging
- 1374. By Simon Davy
-
make clean now works properly again
Awesome, thanks for this.
Maybe you want review by someone more familiar with all the makefile wizardry. In general it looks OK to me, the code looks sensible and the thing works very nicely (and I tried some uncommon scenarios). I made some minor comments below, mainly typos. There's one thing that may need clarification so I didn't "Approve" outright.