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
diff --git a/README b/README
index 4f51776..a46b125 100644
--- a/README
+++ b/README
@@ -103,7 +103,7 @@ Run the following::
103 sudo apt-get update103 sudo apt-get update
104 cat system-dependencies.txt charm/packages.txt | sudo xargs apt-get install -y --no-install-recommends104 cat system-dependencies.txt charm/packages.txt | sudo xargs apt-get install -y --no-install-recommends
105 make bootstrap105 make bootstrap
106106 mkdir -p /var/tmp/git.launchpad.test
107107
108Running108Running
109-------109-------
@@ -117,6 +117,93 @@ The HTTP API can be started with:
117 make run-api 117 make run-api
118118
119119
120Running LP locally as a Git client to Turnip
121--------------------------------------------
122
123Turnip container needs to be able to talk to xmlrpc-private.launchpad.test.
124
125In the Turnip container the hosts file needs to point to the LP container (x.x.x.x is the IP address of LP):
126
127 user@turnip-bionic:~/turnip$ cat /etc/hosts
128 127.0.0.1 localhost
129 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
130 # The following lines are desirable for IPv6 capable hosts
131 ::1 ip6-localhost ip6-loopback
132 fe00::0 ip6-localnet
133 ff00::0 ip6-mcastprefix
134 ff02::1 ip6-allnodes
135 ff02::2 ip6-allrouters
136 ff02::3 ip6-allhosts
137
138A 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:
139 user@launchpad:~$ lxc exec turnip python
140 ...
141 >>> from xmlrpclib import ServerProxy
142 >>> proxy = ServerProxy('http://xmlrpc-private.launchpad.test:8087/git')
143 >>> proxy.translatePath('1', 'read', {})
144 Traceback (most recent call last):
145 ...
146 xmlrpclib.Fault: <Fault 290: "Repository '1' not found.">
147 >>> exit()
148 root@turnip-bionic:~#
149
150In your LP container edit ~/.gitconfig and add these lines, where USER is your Launchpad username:
151
152 [url "git+ssh://USER@git.launchpad.test/"]
153 insteadof = lptest:
154
155Create a new repository locally (user@launchpad:~/repo in LP container in below example) and push it to LP&Turnip:
156
157 user@launchpad:~/repo$ git remote add origin git+ssh://user@git.launchpad.test:9422/~user/+git/repo
158 user@launchpad:~/repo$ git push --set-upstream origin master
159 Counting objects: 3, done.
160 Writing objects: 100% (3/3), 231 bytes | 231.00 KiB/s, done.
161 Total 3 (delta 0), reused 0 (delta 0)
162 To git+ssh://git.launchpad.test:9422/~user/+git/repo
163 * [new branch] master -> master
164 Branch 'master' set up to track remote branch 'master' from 'origin'.
165 user@launchpad:~/repo$
166
167
168The LP log for above push:
169
170 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"
171
172 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
173
174 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}
175 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"
176
177 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
178
179 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'])]
180 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"
181
182 2019-12-16T13:41:18 INFO lp.code.xmlrpc.git [request-id=2f4f61d3-8e58-4fd9-9d45-1949e08ad297] Request received: notify('5')
183
184 2019-12-16T13:41:18 INFO lp.code.xmlrpc.git [request-id=2f4f61d3-8e58-4fd9-9d45-1949e08ad297] notify succeeded
185 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"
186
187
188Your local LP user must exist in LP - created with "utilities/make-lp-user USER" - and have an ssh key in local LP.
189When adding the SSH key to LP if emails can't go out the SSH key addition will fail.
190One possible workaround is to use Fakeemail: https://github.com/tomwardill/fakeemail
191It is recommended that this is done in a venv (https://pypi.org/project/pipsi/):
192
193 sudo apt install pipsi
194 pipsi install fakeemail
195 ~/.local/bin/fakeemail 25 8082 0.0.0.0
196 Message stored for: root@localhost
197
198When 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).
199On production, this happens via the magic of cron.
200Locally you can make it happen by running in your launchpad directory:
201
202 cronscripts/process-job-source.py IGitRefScanJobSource
203
204Now 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.
205
206
120Deployment207Deployment
121==========208==========
122209

Subscribers

People subscribed via source and target branches