Merge lp://qastaging/~danilo/landscape-charm/archive-url into lp://qastaging/~landscape/landscape-charm/trunk

Proposed by Данило Шеган
Status: Merged
Approved by: Данило Шеган
Approved revision: 379
Merged at revision: 375
Proposed branch: lp://qastaging/~danilo/landscape-charm/archive-url
Merge into: lp://qastaging/~landscape/landscape-charm/trunk
Diff against target: 339 lines (+138/-23)
8 files modified
lib/relations/haproxy.py (+16/-14)
lib/relations/hosted.py (+9/-0)
lib/relations/tests/test_hosted.py (+51/-7)
lib/services.py (+1/-1)
lib/tests/test_templates.py (+17/-0)
lib/tests/test_utils.py (+24/-1)
lib/utils.py (+19/-0)
templates/service.conf (+1/-0)
To merge this branch: bzr merge lp://qastaging/~danilo/landscape-charm/archive-url
Reviewer Review Type Date Requested Status
Chad Smith Approve
Free Ekanayaka (community) Approve
🤖 Landscape Builder test results Approve
Review via email: mp+309947@code.qastaging.launchpad.net

Commit message

Set archive-url in [pppa-proxy] section of service.conf when hosted relation is there. Based on value of root-url if there, otherwise uses special value "RELATIVE".

Description of the change

Set archive-url in [pppa-proxy] section of service.conf when hosted relation is there. If root-url is not set, use special value "RELATIVE".

See the following MP for more background: https://code.launchpad.net/~danilo/landscape/archive-url-from-configuration/+merge/309945

Testing instructions:

1. Deploy Landscape with landscape-hosted with gpg configuration and by putting the standalone source tarball generated from the above tarball inside the landscape-server charm tree. Eg. something like the following bundle (but don't use those branches, instead, construct a local charm store to be able to put standalone tarball in there).

  https://pastebin.canonical.com/168741/

  landscape-hosted/0 unit might end up in the error state because of unsigned landscape-hosted package, so install that one manually and then "juju resolved --retry landscape-hosted/0".

  Alternatively, you should be able to stage Landscape charm from the Landscape branch, then upgrade to a charm in this branch. You will need to juju add landscape-hosted charm manually in that case.

2. Log into Landscape, create a trial account (company "foo"), and generate API credentials on your account page.

3. Grant the AccountManager role to your user in Landscape:

  juju ssh postgresql/0 sudo -u postgres 'psql landscape-main -c "insert into person_access values (1, 6, NULL);"'

3. Pull landscape_server_ca.crt from the Landscape unit:

  juju ssh landscape-server/0 sudo cat /etc/ssl/certs/landscape_server_ca.crt > landscape-ca.crt

4. Generate a license using the API:

export LANDSCAPE_API_URI=https://10.0.3.41/api/
export LANDSCAPE_API_KEY=...
export LANDSCAPE_API_SECRET=...

landscape-api --ssl-ca-file landscape-ca.crt EnableLDS account_name=foo
landscape-api --ssl-ca-file landscape-ca.crt AddLicense seats=4 account_name=foo expiration_date=2099-01-01 role=BasicFeatures

5. Browse to https://<haproxy-IP>/account/foo/how-to-get-dedicated and check out the deb source line: going to the URL should work

6. juju set landscape-server root-url=https://landscape.dev/

7. Add /etc/hosts entries for archive.landscape.dev and landscape.dev to point to haproxy IP

8. Repeat 5 replacing haproxy-IP with landscape.dev: how-to-get-dedicated page should have deb lines using archive.landscape.dev and that should work

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 378
Branch: lp:~danilo/landscape-charm/archive-url
Jenkins: https://ci.lscape.net/job/latch-test-trusty/23/

review: Approve (test results)
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

+1

IIUC/IIRC, I guess we'll then need to set up the archive.edge.lscape.net subdomain at some point and include it as alt hostname in the SSL certificate for edge.lscape.net.

And for archive.landscape.canonical.com, since it has already its DNS configured, I guess we'll need only the alt hostname modification in the SSL certificate (but of course only in case they have separate certificates at the moment, needs to be verified).

review: Needs Information
Revision history for this message
Данило Шеган (danilo) wrote :

archive.landscape.canonical.com is, I guess, using the wildcard certificate that applies to all eg. staging.landscape.canonical.com (which is why it's also archive-staging.l.c.c instead of archive.staging.l.c.c). The desire here is to get the code landed that makes the charm set the actual archive URL that it sets up and have Landscape show that on the how-to-get-dedicated page. Once we deploy this to edge, we can fix the certificates (since pppa-proxy is not even exposed there yet, there's no regression).

Revision history for this message
Free Ekanayaka (free.ekanayaka) :
review: Approve
Revision history for this message
Chad Smith (chad.smith) wrote :

Excelent writeup Danilo. Thanks for the detailed description here. Sorry it took so long. My only stumbling block was relearning how to deploy the initial 'bundle' and relate services to get this up and running.

The incorrect way I currently deployed and related theses services was to manually recreate a service.yaml from your initial pastebin, download charms locally to my ./local-charm-store path and manually juju-2.0 deploy ./local-charm-store/haproxy --config my.yaml. I'll be referencing this MP in the future when test-deploying edge in the future. Thanks again for detailing all the steps.

+1

review: Approve
Revision history for this message
Данило Шеган (danilo) wrote :

Thanks for the review: sorry if I haven't made this clear, but edge is currently deployed with juju 1, so I haven't tested with juju 2: I am sure some of the small differences there made it harder for you. FWIW, I've tested using the above bundle-like file pointed at my local charm store, however, since Landscape with required changes is now in lds-trunk PPA, you could just make that bundle point to appropriate charm branches and it should just work.

379. By Данило Шеган

Improve docstring.

Revision history for this message
Данило Шеган (danilo) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches