Merge ~ilasc/turnip:doc-running-with-LP into turnip:master

Proposed by Ioana Lasc
Status: Merged
Approved by: Colin Watson
Approved revision: 8060d7d3b30fea7e2ca98d9f1b101acc5185604a
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ilasc/turnip:doc-running-with-LP
Merge into: turnip:master
Diff against target: 106 lines (+88/-1)
1 file modified
README (+88/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Kristian Glass (community) Approve
Review via email: mp+376986@code.launchpad.net

Commit message

Update doc on running Turnip alongside local LP

Description of the change

Added documentation and troubleshooting tips to run Turnip and LP locally and be able to push new repositories to the local setup.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Colin Watson (cjwatson) :
Revision history for this message
Kristian Glass (doismellburning) wrote :

I haven't tested it, but I've read it, and I'm glad to see it added - thank you!

review: Approve
Revision history for this message
Colin Watson (cjwatson) :
Revision history for this message
Ioana Lasc (ilasc) wrote :

Thanks Colin! Addressed code review comments and added the cron script information for scanning the Git repos.

README file is now Ready for another look.

Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :
~ilasc/turnip:doc-running-with-LP updated
8060d7d... by Ioana Lasc

Corrected RST syntax checks failures in README.

Revision history for this message
Ioana Lasc (ilasc) wrote :

There were indeed RST syntax checks that were failing, make lint now passes locally in full (without warnings).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/README b/README
2index 4f51776..a46b125 100644
3--- a/README
4+++ b/README
5@@ -103,7 +103,7 @@ Run the following::
6 sudo apt-get update
7 cat system-dependencies.txt charm/packages.txt | sudo xargs apt-get install -y --no-install-recommends
8 make bootstrap
9-
10+ mkdir -p /var/tmp/git.launchpad.test
11
12 Running
13 -------
14@@ -117,6 +117,93 @@ The HTTP API can be started with:
15 make run-api
16
17
18+Running LP locally as a Git client to Turnip
19+--------------------------------------------
20+
21+Turnip container needs to be able to talk to xmlrpc-private.launchpad.test.
22+
23+In the Turnip container the hosts file needs to point to the LP container (x.x.x.x is the IP address of LP):
24+
25+ user@turnip-bionic:~/turnip$ cat /etc/hosts
26+ 127.0.0.1 localhost
27+ x.x.x.x launchpad.test launchpad.test answers.launchpad.test archive.launchpad.test api.launchpad.test bazaar.launchpad.test bazaar-internal.launchpad.test blueprints.launchpad.test bugs.launchpad.test code.launchpad.test feeds.launchpad.test keyserver.launchpad.test lists.launchpad.test ppa.launchpad.test private-ppa.launchpad.test testopenid.test translations.launchpad.test xmlrpc-private.launchpad.test xmlrpc.launchpad.test
28+ # The following lines are desirable for IPv6 capable hosts
29+ ::1 ip6-localhost ip6-loopback
30+ fe00::0 ip6-localnet
31+ ff00::0 ip6-mcastprefix
32+ ff02::1 ip6-allnodes
33+ ff02::2 ip6-allrouters
34+ ff02::3 ip6-allhosts
35+
36+A basic test that can be performed by dropping into the Turnip container shell. Below exception is expected as Repository '1' did not exist when the RPC call was performed, it does show however that Turnip is able to resolve xmlrpc-private.launchpad.test and there is connectivity between LP and Turnip:
37+ user@launchpad:~$ lxc exec turnip python
38+ ...
39+ >>> from xmlrpclib import ServerProxy
40+ >>> proxy = ServerProxy('http://xmlrpc-private.launchpad.test:8087/git')
41+ >>> proxy.translatePath('1', 'read', {})
42+ Traceback (most recent call last):
43+ ...
44+ xmlrpclib.Fault: <Fault 290: "Repository '1' not found.">
45+ >>> exit()
46+ root@turnip-bionic:~#
47+
48+In your LP container edit ~/.gitconfig and add these lines, where USER is your Launchpad username:
49+
50+ [url "git+ssh://USER@git.launchpad.test/"]
51+ insteadof = lptest:
52+
53+Create a new repository locally (user@launchpad:~/repo in LP container in below example) and push it to LP&Turnip:
54+
55+ user@launchpad:~/repo$ git remote add origin git+ssh://user@git.launchpad.test:9422/~user/+git/repo
56+ user@launchpad:~/repo$ git push --set-upstream origin master
57+ Counting objects: 3, done.
58+ Writing objects: 100% (3/3), 231 bytes | 231.00 KiB/s, done.
59+ Total 3 (delta 0), reused 0 (delta 0)
60+ To git+ssh://git.launchpad.test:9422/~user/+git/repo
61+ * [new branch] master -> master
62+ Branch 'master' set up to track remote branch 'master' from 'origin'.
63+ user@launchpad:~/repo$
64+
65+
66+The LP log for above push:
67+
68+ 10.209.173.202 - "" "xmlrpc-private.launchpad.test" [16/Dec/2019:13:41:13 +0300] "POST /authserver HTTP/1.0" 200 1312 4 0.00622892379761 0.00250482559204 0.00320911407471 "Anonymous" "AuthServerApplication:" "" "Twisted/XMLRPClib"
69+
70+ 2019-12-16T13:41:17 INFO lp.code.xmlrpc.git [request-id=057364e1-9e12-48c6-857d-a228c56d88c2] Request received: translatePath('~user/+git/repo', 'write') for 243674
71+
72+ 2019-12-16T13:41:17 INFO lp.code.xmlrpc.git [request-id=057364e1-9e12-48c6-857d-a228c56d88c2] translatePath succeeded: {'writable': True, 'path': '5', 'trailing': '', 'private': False}
73+ 10.209.173.202 - "" "xmlrpc-private.launchpad.test" [16/Dec/2019:13:41:17 +0300] "POST /git HTTP/1.0" 200 899 21 0.0600020885468 0.00421810150146 0.0549690723419 "Anonymous" "GitApplication:" "" "Twisted/XMLRPClib"
74+
75+ 2019-12-16T13:41:18 INFO lp.code.xmlrpc.git [request-id=057364e1-9e12-48c6-857d-a228c56d88c2] Request received: checkRefPermissions('5', ['refs/heads/master']) for 243674
76+
77+ 2019-12-16T13:41:18 INFO lp.code.xmlrpc.git [request-id=057364e1-9e12-48c6-857d-a228c56d88c2] checkRefPermissions succeeded: [('refs/heads/master', ['create', 'push', 'force_push'])]
78+ 10.209.173.202 - "" "xmlrpc-private.launchpad.test" [16/Dec/2019:13:41:18 +0300] "POST /git HTTP/1.0" 200 880 10 0.0158808231354 0.00237107276917 0.0127749443054 "Anonymous" "GitApplication:" "" "Twisted/XMLRPClib"
79+
80+ 2019-12-16T13:41:18 INFO lp.code.xmlrpc.git [request-id=2f4f61d3-8e58-4fd9-9d45-1949e08ad297] Request received: notify('5')
81+
82+ 2019-12-16T13:41:18 INFO lp.code.xmlrpc.git [request-id=2f4f61d3-8e58-4fd9-9d45-1949e08ad297] notify succeeded
83+ 10.209.173.202 - "" "xmlrpc-private.launchpad.test" [16/Dec/2019:13:41:18 +0300] "POST /git HTTP/1.0" 200 588 7 0.0113499164581 0.00207781791687 0.00744009017944 "Anonymous" "GitApplication:" "" "Twisted/XMLRPClib"
84+
85+
86+Your local LP user must exist in LP - created with "utilities/make-lp-user USER" - and have an ssh key in local LP.
87+When adding the SSH key to LP if emails can't go out the SSH key addition will fail.
88+One possible workaround is to use Fakeemail: https://github.com/tomwardill/fakeemail
89+It is recommended that this is done in a venv (https://pypi.org/project/pipsi/):
90+
91+ sudo apt install pipsi
92+ pipsi install fakeemail
93+ ~/.local/bin/fakeemail 25 8082 0.0.0.0
94+ Message stored for: root@localhost
95+
96+When creating and pushing new branches to LP with this local setup, the branches need to be scanned (data about the branch copied into the Launchpad database).
97+On production, this happens via the magic of cron.
98+Locally you can make it happen by running in your launchpad directory:
99+
100+ cronscripts/process-job-source.py IGitRefScanJobSource
101+
102+Now you have a fully working and up-to-date branch -- you should be able to look at the branch page in Launchpad, view the source in codebrowse, and so on.
103+
104+
105 Deployment
106 ==========
107

Subscribers

People subscribed via source and target branches