-
Notifications
You must be signed in to change notification settings - Fork 0
mrc-6454 Replace Orderly Web with Packit #33
Changes from all commits
0016010
4c7e3ce
4cd2360
93b3e99
1a6c7df
5b4c6e1
4704cc4
b42f347
fa89f7f
cb48cbe
0aa75e9
d52cb05
750de03
d3cd758
bfddf84
6608905
f410ce6
cbe6a1d
45849eb
38ed60b
d513733
06a27b8
8b96c89
396f6f4
bdc725e
a005b68
d15f84e
5da4c60
66eac4a
a0d2ff4
b68e5f7
9e74440
50a5d1c
bb6b22d
dfb4f01
8f3d24d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,6 @@ celery[redis] | |
| future | ||
| pyyaml | ||
| montagu>=0.0.2 | ||
| orderlyweb-api>=1.0.0 | ||
| git+https://github.com/reside-ic/youtrack-rest-python-library | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should get that on pypi if we still want to use it (separate to this ofc) |
||
| constellation | ||
| requests-mock | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| set -x | ||
|
|
||
| docker stop $(docker ps -aq) | ||
| docker rm $(docker ps -aq) | ||
| docker network prune --force | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| container_prefix: montagu | ||
|
|
||
| protect_data: false | ||
|
|
||
| repo: ghcr.io/mrc-ide | ||
|
|
||
| network: montagu_default | ||
|
|
||
| volumes: | ||
| outpack: montagu_outpack_volume | ||
| packit_db: montagu_packit_db | ||
| orderly_library: montagu_orderly_library | ||
| orderly_logs: montagu_orderly_logs | ||
|
|
||
| outpack: | ||
| server: | ||
| name: outpack_server | ||
| tag: main | ||
| migrate: | ||
| name: outpack.orderly | ||
| tag: main | ||
|
|
||
| packit: | ||
| base_url: https://localhost | ||
| api: | ||
| name: packit-api | ||
| tag: main | ||
| app: | ||
| name: montagu-packit | ||
| tag: main | ||
| db: | ||
| name: packit-db | ||
| tag: main | ||
| user: packituser | ||
| password: changeme | ||
| auth: | ||
| enabled: true | ||
| auth_method: preauth | ||
| # We'll get this from the vault on production | ||
| jwt: | ||
| secret: "0b4g4f8z4mdsrhoxfde2mam8f00vmt0f" | ||
| expiry_days: 1 | ||
|
|
||
| orderly-runner: | ||
| image: | ||
| name: orderly.runner | ||
| tag: main | ||
| git: | ||
| url: https://github.com/reside-ic/orderly2-example.git | ||
| workers: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| here=$(dirname $0) | ||
| export REGISTRY=vimc | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we not have things on ghcr yet? I guess not for montagu...something else to add to the backlog :( |
||
|
|
||
| here=$(dirname $0) | ||
| ./scripts/clear-docker.sh | ||
| docker network prune -f | ||
|
|
||
| export REGISTRY=vimc | ||
| export NETWORK=montagu_default | ||
|
|
||
| # Run the API and database | ||
| docker-compose pull | ||
| docker-compose --project-name montagu up -d | ||
| docker compose pull | ||
| docker compose --project-name montagu up -d | ||
|
|
||
| # Clear redis | ||
| docker exec montagu_mq_1 redis-cli FLUSHALL | ||
|
|
||
| # Install orderly-web | ||
| pip3 install constellation | ||
| pip3 install orderly-web | ||
| orderly-web start $here | ||
| docker exec montagu-mq-1 redis-cli FLUSHALL | ||
|
|
||
| # Start the APIs | ||
| docker exec montagu_api_1 mkdir -p /etc/montagu/api/ | ||
| docker exec montagu_api_1 touch /etc/montagu/api/go_signal | ||
| docker exec montagu-api-1 mkdir -p /etc/montagu/api/ | ||
| docker exec montagu-api-1 touch /etc/montagu/api/go_signal | ||
|
|
||
| # Wait for the database | ||
| docker exec montagu_db_1 montagu-wait.sh | ||
| docker exec montagu-db-1 montagu-wait.sh | ||
|
|
||
| # migrate the database | ||
| migrate_image=${REGISTRY}/montagu-migrate:master | ||
|
|
@@ -40,6 +35,41 @@ $here/montagu_cli.sh add "Test User" test.user \ | |
|
|
||
| $here/montagu_cli.sh addRole test.user user | ||
|
|
||
| # Add user to orderlyweb | ||
| $here/orderlyweb_cli.sh add-users test.user@example.com | ||
| $here/orderlyweb_cli.sh grant test.user@example.com */reports.read */reports.run */reports.review | ||
| # Run packit | ||
| hatch env run pip3 install constellation | ||
| hatch env run pip3 install packit-deploy | ||
|
Comment on lines
+39
to
+40
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we're using hatch, why not add these to the pyproject.toml so they're installed when hatch builds the env?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't actually see how this is working - I'll follow up in person |
||
| # For some reason packit is emitting exit code 1 despite apparently succeeding. Allow this for now... | ||
| set +e | ||
| hatch env run -- packit start --pull $here | ||
| echo Packit deployed with exit code $? | ||
| set -e | ||
|
|
||
| docker exec montagu-packit-db wait-for-db | ||
|
|
||
| # Run the proxy here, not through docker compose - it needs packit to be running before it will start up | ||
| MONTAGU_PROXY_TAG=vimc/montagu-reverse-proxy:master | ||
| docker pull $MONTAGU_PROXY_TAG | ||
| docker run -d \ | ||
| -p "443:443" -p "80:80" \ | ||
| --name reverse-proxy \ | ||
| --network montagu_default\ | ||
| $MONTAGU_PROXY_TAG 443 localhost | ||
|
|
||
| # give packit api some time to migrate the db... | ||
| sleep 5 | ||
|
|
||
| # create roles to publish to... | ||
| docker exec -i montagu-packit-db psql -U packituser -d packit --single-transaction <<EOF | ||
| insert into "role" (name, is_username) values ('Funders', FALSE); | ||
| insert into "role" (name, is_username) values ('minimal.modeller', FALSE); | ||
| insert into "role" (name, is_username) values ('other.modeller', FALSE); | ||
| EOF | ||
|
|
||
| # Add user to packit, as admin | ||
| USERNAME='test.user' | ||
| EMAIL='test.user@example.com' | ||
| DISPLAY_NAME='Test User' | ||
| ROLE='ADMIN' | ||
| docker exec montagu-packit-db create-preauth-user --username "$USERNAME" --email "$EMAIL" --displayname "$DISPLAY_NAME" --role "$ROLE" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| ./scripts/run-dependencies.sh | ||
|
|
||
| # From now on, if the user presses Ctrl+C we should teardown gracefully | ||
| function cleanup() { | ||
| docker container stop reverse-proxy | ||
| docker container rm reverse-proxy -v | ||
| # Same exit code issue for packit stop as packit start.... | ||
| set +e | ||
| hatch env run -- packit stop ./scripts | ||
| set -e | ||
| # remove db volume manually rather than --volumes flag to packit, to avoid requiring user confirmation | ||
| docker volume rm montagu_packit_db montagu_orderly_library montagu_outpack_volume montagu_orderly_logs | ||
| docker compose --project-name montagu down -v | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| # Wait for Ctrl+C | ||
| echo "Ready to use. Press Ctrl+C to teardown." | ||
| sleep infinity |
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 fix this name too