7893
Comment: Emphasise LXC, and some other cleanups.
|
9069
update Python version requirement
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
'''Building and running Launchpad requires a computer running [[http://www.ubuntu.com/|Ubuntu]]. The production Launchpad.net site runs on Ubuntu 12.04 LTS. Developers mostly run 12.04 LTS, 14.04 LTS or 14.10 but others may work.''' | '''Building and running Launchpad requires a computer running [[http://www.ubuntu.com/|Ubuntu]]. The production Launchpad.net site runs on Ubuntu 16.04 LTS. Developers mostly run 16.04 LTS, but others may work.''' |
Line 8: | Line 8: |
The recommended development configuration is Ubuntu 14.04 LTS or later running Launchpad [[Running/LXC|in an Ubuntu 12.04 LTS LXC container]] to minimise its impact on the wider system. | The recommended development configuration is Ubuntu 16.04 LTS or later running Launchpad [[Running/LXD|in an Ubuntu 16.04 LTS LXD container]] to minimise its impact on the wider system. Launchpad requires at least Python 3.5 (i.e. newer than Ubuntu 14.04 LTS). |
Line 10: | Line 10: |
If you're not running a supported Ubuntu release you might choose to use an LXC or virtual machine with an installation of one of these Ubuntu releases. | If you're not running a supported Ubuntu release you might choose to use an LXC/LXD container or virtual machine with an installation of one of these Ubuntu releases. |
Line 14: | Line 14: |
'''''Note:''' the changes introduced by the install script may break your current web development setup, so it is advisable to try Launchpad in an LXC container or a virtual machine, as described above.'' |
'''''Note:''' the changes introduced by the install script may break your current web development setup, so it is advisable to try Launchpad in an LXC/LXD container or a virtual machine, as described above.'' |
Line 19: | Line 18: |
If you're using an LXC container or a virtual machine, make sure you're performing all these steps inside it. | Make sure you're performing all these steps inside an LXC/LXD container or a virtual machine If your Launchpad username differs from your local one, then put this in `~/.ssh/config` in the container/VM before doing anything else, replacing `LPUSERNAME` with your Launchpad username: {{{ Host bazaar.launchpad.net User LPUSERNAME Host git.launchpad.net User LPUSERNAME }}} Then: |
Line 24: | Line 34: |
$ bzr --no-plugins cat http://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/utilities/rocketfuel-setup > rocketfuel-setup | $ curl https://git.launchpad.net/launchpad/plain/utilities/rocketfuel-setup >rocketfuel-setup ## Read through the rocketfuel-setup script and make sure you're ## OK with what it's going to do. |
Line 57: | Line 71: |
lp-branches/ lp-sourcedeps/ $ cd lp-branches |
launchpad/ lp-sourcedeps/ $ cd launchpad |
Line 60: | Line 74: |
## You are now in a newly-created Bazaar repository, with one ## branch ('devel'), into whose working tree the other |
## You are now in a newly-cloned Git repository, with one ## branch ('master'), into whose working tree the other |
Line 66: | Line 80: |
<<Anchor(pre-commit)>> == Installing the pre-commit hook == If you intend to make any changes to Launchpad, you should also set up [[https://pre-commit.com/|pre-commit]] now: 1. Install `pre-commit` itself. If your host system is Ubuntu 20.10 or newer, then `sudo apt install pre-commit` is enough; otherwise, you can install it in your user account ([[https://pypi.org/project/pipsi/|pipsi]] works well to keep it isolated; whatever you do, don't run `pip` system-wide as root!). We require this to be installed separately rather than including it in Launchpad's virtual environment because developers commonly run `git commit` outside the container used for running Launchpad. 1. Install the `pre-commit` git hook by running `pre-commit install` in your newly-cloned `launchpad` repository. |
|
Line 68: | Line 91: |
First, be in the top level of the source tree: {{{ $ cd devel }}} |
|
Line 102: | Line 119: |
Point your usual web browser at `https://launchpad.dev`, and accept the local self-signed certificate. You can log in as `admin@canonical.com` without a password. | Assuming you're running Launchpad inside a container or virtual machine (as previously instructed), you'll need to follow the steps at [[/RemoteAccess]] to be able to connect from the host. Point your usual web browser at `https://launchpad.test`, and accept the local self-signed certificate. You can log in as `admin@canonical.com` without a password. |
Line 121: | Line 140: |
= Subpage Index = * [[/RemoteAccess]] -> How to set things up so you can use it from another host. |
|
Line 128: | Line 144: |
The '''`rocketfuel-setup`''' script first determines what release of Ubuntu you're running, then installs various lines into files under '''`/etc`''', to enable you to run Launchpad services locally. For example, it adds entries for "launchpad.dev", "bazaar.launchpad.dev", "lists.launchpad.dev", and others to your '''`/etc/hosts`''' file, so that after you build launchpad you can browse to '''`launchpad.dev`''' and see a locally-running instance. It also installs some packages, dependencies that Launchpad needs in order to run. This is why the sudo access is necessary; consult the script for details of what it's doing. | The '''`rocketfuel-setup`''' script first determines what release of Ubuntu you're running, then installs various lines into files under '''`/etc`''', to enable you to run Launchpad services locally. For example, it adds entries for "launchpad.test", "bazaar.launchpad.test", "lists.launchpad.test", and others to your '''`/etc/hosts`''' file, so that after you build launchpad you can browse to '''`launchpad.test`''' and see a locally-running instance. It also installs some packages, dependencies that Launchpad needs in order to run. This is why the sudo access is necessary; consult the script for details of what it's doing. |
Line 130: | Line 146: |
Once it's got the system preparation out of the way, the script initializes a Bazaar repository (that's the '''`lp-branches`''' directory above), and pulls down a development trunk ('''`lp-branches/devel`'''). That will take a while. | Once it's got the system preparation out of the way, the script clones Launchpad's Git repository (that's the '''`launchpad`''' directory above). That will take a while. |
Line 132: | Line 148: |
After it gets that, it fetches the other dependencies, the third-party libraries, by invoking a separate script, '''`lp-branches/devel/utilities/rocketfuel-get`'''. That will take a while too, as there are almost thirty such libraries. | After it gets that, it fetches the other dependencies, the third-party libraries, by invoking a separate script, '''`launchpad/utilities/rocketfuel-get`'''. That will take a while too, as there are over 200 such libraries. |
Line 134: | Line 150: |
Once it has all the dependencies, it links them into the trunk working tree, using the script '''`lp-branches/devel/utilities/link-external-sourcecode`'''. | Once it has all the dependencies, it links them into the trunk working tree, using the script '''`launchpad/utilities/link-external-sourcecode`'''. |
Line 142: | Line 158: |
You'll need packages from two PPAs: `ppa:launchpad` and `ppa:bzr`. | You'll need packages from a PPA: `ppa:launchpad/ppa`. |
Line 145: | Line 161: |
sudo apt-add-repository ppa:launchpad sudo apt-add-repository ppa:bzr |
sudo apt-add-repository ppa:launchpad/ppa |
Line 153: | Line 168: |
bzr branch lp:launchpad | git clone https://git.launchpad.net/launchpad |
Line 156: | Line 171: |
bzr co --lightweight lp:lp-source-dependencies download-cache mkdir eggs |
git clone --depth=1 https://git.launchpad.net/lp-source-dependencies download-cache |
This page tells you how to build and run Launchpad on your own machine. Ask for help right away if you run into problems. |
System Requirements
Building and running Launchpad requires a computer running Ubuntu. The production Launchpad.net site runs on Ubuntu 16.04 LTS. Developers mostly run 16.04 LTS, but others may work.
The recommended development configuration is Ubuntu 16.04 LTS or later running Launchpad in an Ubuntu 16.04 LTS LXD container to minimise its impact on the wider system. Launchpad requires at least Python 3.5 (i.e. newer than Ubuntu 14.04 LTS).
If you're not running a supported Ubuntu release you might choose to use an LXC/LXD container or virtual machine with an installation of one of these Ubuntu releases.
We'd like Launchpad to run on other operating systems, especially Debian GNU/Linux, so that more people can contribute to Launchpad development. If you're interested in working on Launchpad portability, please let us know. Note that our focus is on getting Launchpad to build easily so more people can participate in Launchpad development. Running a stable production instance would be much harder than running a single-developer test instance, and we don't recommend it. Unlike many open source projects, we're not seeking to maximize the number of installations; our goal is to improve the instance we're already running at Launchpad.net.
Note: the changes introduced by the install script may break your current web development setup, so it is advisable to try Launchpad in an LXC/LXD container or a virtual machine, as described above.
Getting
Make sure you're performing all these steps inside an LXC/LXD container or a virtual machine
If your Launchpad username differs from your local one, then put this in ~/.ssh/config in the container/VM before doing anything else, replacing LPUSERNAME with your Launchpad username:
Host bazaar.launchpad.net User LPUSERNAME Host git.launchpad.net User LPUSERNAME
Then:
$ mkdir ~/launchpad $ cd ~/launchpad $ curl https://git.launchpad.net/launchpad/plain/utilities/rocketfuel-setup >rocketfuel-setup ## Read through the rocketfuel-setup script and make sure you're ## OK with what it's going to do. $ chmod a+x rocketfuel-setup $ ./rocketfuel-setup ## This will take a while -- maybe a few hours to get everything, ## depending on your Internet connection. ## ## Note that you will be prompted for your 'sudo' password, and for ## a Launchpad login ID. The sudo access is necessary to get ## Launchpad running on your box; the Launchpad.net login is not ## strictly necessary, and you can just hit Return there if you ## want; see below for an explanation. ## ## Note that this will make changes to your Apache configuration if ## you already have an Apache server on your box. It will also add ## entries to /etc/hosts and it will setup a postgresql server on ## your box. ## If you want to play safe with regards to your existing Apache, ## try this out in a virtual environment first. ## ## If you are running rocketfuel-setup to bring up a new machine ## you can pass --no-workspace to only perform the system-wide setup. ## ## Note that if rocketfuel-setup bails out with instructions to fix ## something you just need to run it again and it should pickup where ## it left off. $ sudo apt-get dist-upgrade ## This is just to make doubly-sure everything from the launchpad PPA ## gets installed. $ ls launchpad/ lp-sourcedeps/ $ cd launchpad ## You are now in a newly-cloned Git repository, with one ## branch ('master'), into whose working tree the other ## source dependencies have been symlinked. The sourcedeps ## actually live in ../lp-sourcedeps, though.
Installing the pre-commit hook
If you intend to make any changes to Launchpad, you should also set up pre-commit now:
Install pre-commit itself. If your host system is Ubuntu 20.10 or newer, then sudo apt install pre-commit is enough; otherwise, you can install it in your user account (pipsi works well to keep it isolated; whatever you do, don't run pip system-wide as root!). We require this to be installed separately rather than including it in Launchpad's virtual environment because developers commonly run git commit outside the container used for running Launchpad.
Install the pre-commit git hook by running pre-commit install in your newly-cloned launchpad repository.
Building
Before you can run Launchpad for the first time, you need to set up PostgreSQL.
WARNING! |
DO NOT run the database setup script below if you use PostgreSQL for anything other than Launchpad! Running the script will destroy any PostgreSQL databases on your system. See DatabaseSetup for details. |
$ ./utilities/launchpad-database-setup $USER
(Please have read the previous comment before you run the above command!)
Finally, build the database schema:
$ make schema
Running
Now you should be able to start up Launchpad:
$ make run
This only runs the basic web application. Codehosting and Soyuz require additional steps.
For subsequent builds, you can just do make run right away. You don't need to do make schema every time, and you should avoid it because it's expensive and because it will clean out any data you might have put into your test instance (through the web UI or by running other scripts).
Assuming you're running Launchpad inside a container or virtual machine (as previously instructed), you'll need to follow the steps at /RemoteAccess to be able to connect from the host.
Point your usual web browser at https://launchpad.test, and accept the local self-signed certificate. You can log in as admin@canonical.com without a password.
Stopping
You can stop Launchpad by hitting Control-C in the terminal where you started it:
^C [...shutting down Launchpad...] $
Or you can be at a prompt in the same directory and run this:
$ make stop
Details
What the Installation Process Does
The rocketfuel-setup script first determines what release of Ubuntu you're running, then installs various lines into files under /etc, to enable you to run Launchpad services locally. For example, it adds entries for "launchpad.test", "bazaar.launchpad.test", "lists.launchpad.test", and others to your /etc/hosts file, so that after you build launchpad you can browse to launchpad.test and see a locally-running instance. It also installs some packages, dependencies that Launchpad needs in order to run. This is why the sudo access is necessary; consult the script for details of what it's doing.
Once it's got the system preparation out of the way, the script clones Launchpad's Git repository (that's the launchpad directory above). That will take a while.
After it gets that, it fetches the other dependencies, the third-party libraries, by invoking a separate script, launchpad/utilities/rocketfuel-get. That will take a while too, as there are over 200 such libraries.
Once it has all the dependencies, it links them into the trunk working tree, using the script launchpad/utilities/link-external-sourcecode.
Do-it-yourself installation
We only support using rocketfuel-setup to set up Launchpad. It adjusts a lot of things to get the development process running smoothly, as summarized above. However, sometimes you might want to just get a build of Launchpad to run its tests, or to run a script packaged with Launchpad, or to do your own manual changes of the files that rocketfuel-setup would normally touch. These are the basics of what needs to be done for that route -- unsupported hints.
Install launchpad-developer-dependencies
You'll need packages from a PPA: ppa:launchpad/ppa.
sudo apt-add-repository ppa:launchpad/ppa
Then install the launchpad-developer-dependencies package.
Get the code
git clone https://git.launchpad.net/launchpad cd launchpad utilities/update-sourcecode git clone --depth=1 https://git.launchpad.net/lp-source-dependencies download-cache make