8350
Comment:
|
2363
Update Apache config file name
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
||<tablestyle="width: 100%;" colspan=3 style="background: #2a2929; font-weight: bold; color: #f6bc05;">This page tells you how to change the Launchpad so you can access it on your own machine. [[Help|Ask for help]] right away if you run into problems. || | ## page was renamed from Running/LocalNetwork ||<tablestyle="width: 100%;" colspan=3 style="background: #2a2929; font-weight: bold; color: #f6bc05;">This page tells you how to modify a development Launchpad so you can access it from other machines. [[Help|Ask for help]] right away if you run into problems. || |
Line 3: | Line 4: |
<<Anchor(change)>> | = Accessing launchpad.test from anywhere on the LAN = |
Line 5: | Line 6: |
= Changing Interfaces = | These instructions assume that you already have Launchpad working for local access, and now you want it to be accessible from other machines on the same LAN, or perhaps the virtual machine or LXC host. |
Line 7: | Line 8: |
Assuming you already the Launchpad running and you want it to be accessable from your external network. | == Amending the Apache configuration == Launchpad's default development Apache config (`/etc/apache2/sites-available/local-launchpad.conf`) only listens on 127.0.0.88. This can be overridden with the LISTEN_ADDRESS environment variable when running `make install`. You probably want to make it listen on everything: {{{ sudo make LISTEN_ADDRESS=* install }}} note: `zsh` users receiving the error `no matches found: LISTEN_ADDRESS=*` may need to `noglob` this: {{{ noglob sudo make LISTEN_ADDRESS=* install }}} |
Line 9: | Line 18: |
We'll be doing 4 steps to make it accessable from the outside. This includes installation of a simple DNS server so you can resolve the subdomains correctly. | == Amending the hosts file == Launchpad makes extensive use of virtual hosts, so you'll need to add entries to `/etc/hosts` on any machine from which you want to access the Launchpad instance. You'll see the relevant hostnames in `/etc/hosts` on the machine running the instance -- they need to be added to the remote machine, mapped to the server machine or container's external IP address. |
Line 11: | Line 21: |
''''For this tutorial i'm assuming that you have the ability to sudo as root'''' | If some of those other machines run Windows, it may be helpful to know that the Windows equivalent of `/etc/hosts` is located at `C:\WINDOWS\system32\drivers\etc\hosts`. Note that Windows' version has a line length limit, so you might have to split it across multiple lines or only include the hostnames that you need. == That's it! == If you did everything above, you should new be able to access `https://launchpad.test/` in a web browser on a suitably configured remote computer. |
Line 14: | Line 27: |
First, we're going to change the network interfaces. For this to work we need static IP addresses assigned to the server. | = Accessing launchpad.test from a single host over SSH = |
Line 16: | Line 29: |
{{{ $ cd /etc/network }}} |
SSH provides a SOCKS proxy. By running that proxy on the target machine, you can view its Launchpad web site as if you were on that machine, without having to open non-SSH ports to a wider network. To do so: |
Line 20: | Line 31: |
Then we'll open up the interfaces file with your favorite editor: | ssh -D8110 target-machine |
Line 22: | Line 33: |
{{{ # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 10.10.0.x netmask 255.0.0.0 gateway 10.10.0.1 # dns-* options are implemented by the resolvconf package, if installed }}} We'll add 2 additional ip addresses like this {{{ auto eth0:0 iface eth0:0 inet static address 10.10.0.88 netmask 255.0.0.0 gateway 10.10.0.1 auto eth0:1 iface eth0:1 inet static address 10.10.0.99 netmask 255.0.0.0 gateway 10.10.0.1 }}} Save the changes, then issue a restart of the networking daemon {{{ $ /etc/init.d/networking restart }}} If we check the ifconfig output now, you'll see that there's 2 new interfaces added to the list {{{ eth0:0 Link encap:Ethernet HWaddr 00:0c:29:bc:96:ad inet addr:10.10.0.88 Bcast:10.255.255.255 Mask:255.0.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:18 Base address:0x2000 eth0:1 Link encap:Ethernet HWaddr 00:0c:29:bc:96:ad inet addr:10.10.0.99 Bcast:10.255.255.255 Mask:255.0.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:18 Base address:0x2000 }}} <<Anchor(update)>> = Updating the local-launchpad file = And now we're gonna be changing the /etc/apache2/sites-available/local-launchpad file to reflect the changes in the IP addresses {{{ $ cd /etc/apache2/sites-available }}} For this change to be done, we need to disable the local-launchpad temporary and clean up the file {{{ $ a2dissite local-launchpad }}} After that, we open up local-launchpad and start to edit the values inside {{{ NameVirtualHost 10.10.0.88:80 RewriteLock /var/tmp/rewrite-lock <VirtualHost 10.10.0.88:80> ServerName xmlrpc-private.launchpad.dev ServerName xmlrpc.launchpad.dev <Proxy *> Order deny,allow Allow from 10.10.0.0/255.0.0.0 </Proxy> ProxyPreserveHost on ProxyPass / http://10.10.0.88:8087/ retry=1 </VirtualHost> <VirtualHost 10.10.0.88:80> ServerName lists.launchpad.dev Alias / /var/tmp/mailman/mhonarc/ <Directory /var/tmp/mailman/mhonarc> AllowOverride None DirectoryIndex maillist.html </Directory> </VirtualHost> <VirtualHost 10.10.0.99:80> ServerName bazaar.launchpad.dev LogLevel debug ProxyRequests off <Proxy *> Order deny,allow Allow from localhost 10.10.0.0/255.0.0.0 </Proxy> ProxyTimeout 20 RewriteEngine On RewriteMap branch-rewrite prg:/root/launchpad/lp-branches/devel/scripts/branch-rewrite.py RewriteMap escape int:escape RewriteRule ^/$ http://launchpad.dev [L] RewriteRule ^(/.*)$ ${branch-rewrite:${escape:$1}} [L,P,NE] DocumentRoot /var/tmp/bazaar.launchpad.dev/static/ <Directory /var/tmp/bazaar.launchpad.dev/static/> Options SymLinksIfOwnerMatch AllowOverride None Options Indexes </Directory> <Location /> ProxyPassReverse http://10.10.0.88:8080/ </Location> </VirtualHost> <VirtualHost 10.10.0.99:443> ServerName bazaar.launchpad.dev LogLevel debug SSLEngine On SSLProxyEngine On SSLCertificateFile /etc/apache2/ssl/launchpad.crt SSLCertificateKeyFile /etc/apache2/ssl/launchpad.key ProxyRequests off <Proxy *> Order deny,allow Allow from localhost 10.10.0.0/255.0.0.0 </Proxy> ProxyTimeout 20 RewriteEngine On RequestHeader add X-Forwarded-Scheme https RewriteRule ^/$ http://launchpad.dev [L] RewriteRule ^/(.*)$ http://10.10.0.88:8080/$1 [L,P] <Location /> ProxyPassReverse http://10.10.0.88:8080/ </Location> </VirtualHost> <VirtualHost 10.10.0.88:80> ServerName bazaar-internal.launchpad.dev LogLevel debug DocumentRoot /var/tmp/bazaar.launchpad.dev/mirrors <Directory /var/tmp/bazaar.launchpad.dev/mirrors/> Order Deny,Allow Deny from all Allow from 10.10.0.0/255.0.0.0 Options SymLinksIfOwnerMatch AllowOverride None Options Indexes </Directory> </VirtualHost> <VirtualHost 10.10.0.88:80> ServerName ppa.launchpad.dev ServerAlias private-ppa.launchpad.dev LogLevel debug DocumentRoot /var/tmp/ppa <Directory /var/tmp/ppa/> Order Deny,Allow Deny from all Allow from 10.10.0.0/255.0.0.0 AllowOverride AuthConfig Options Indexes </Directory> </VirtualHost> <VirtualHost 10.10.0.88:443> ServerName launchpad.dev ServerAlias *.launchpad.dev ServerAlias shipit.edubuntu.dev ServerAlias shipit.kubuntu.dev ServerAlias shipit.ubuntu.dev <Proxy *> Order deny,allow Allow from 10.10.0.0/255.0.0.0 </Proxy> SSLEngine On SSLCertificateFile /etc/apache2/ssl/launchpad.crt SSLCertificateKeyFile /etc/apache2/ssl/launchpad.key ProxyPreserveHost on ProxyPass / http://10.10.0.88:8086/ retry=1 <Location /> # Insert filter SetOutputFilter DEFLATE # Don't compress images SetEnvIfNoCase Request_URI \ \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Don't gzip anything that starts /@@/ and doesn't end .js (ie images) SetEnvIfNoCase Request_URI ^/@@/ no-gzip dont-vary SetEnvIfNoCase Request_URI ^/@@/.*\.js$ !no-gzip !dont-vary </Location> </VirtualHost> <VirtualHost 10.10.0.88:80> ServerName launchpad.dev ServerAlias *.launchpad.dev ServerAlias shipit.edubuntu.dev ServerAlias shipit.kubuntu.dev ServerAlias shipit.ubuntu.dev RewriteEngine On RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </VirtualHost> }}} For this example you can just copy-paste the whole file from above and save it. Then we'll re-enable the local-launchpad again {{{ $ a2ensite local-launchpad }}} Restart your Apache server and try to connect to your launchpad using http://launchpad.dev (This might not work as we don't have any DNS records set at this moment) <<Anchor(dnschange)>> = How to setup DNS on Windows = For the people that are using Windows, this step is the easiest step. Open up a Explorer window and go to {{{ C:\WINDOWS\system32\drivers\etc }}} Then open up the file hosts. It will look a bit like this: {{{ 127.0.0.1 localhost }}} Then add the following completly to the file {{{ 10.10.0.88 launchpad.dev 10.10.0.88 answers.launchpad.dev 10.10.0.88 api.launchpad.dev 10.10.0.88 bazaar-internal.launchpad. 10.10.0.88 dev beta.launchpad.dev 10.10.0.88 blueprints.launchpad.dev 10.10.0.88 bugs.launchpad.dev 10.10.0.88 code.launchpad.dev 10.10.0.88 feeds.launchpad.dev 10.10.0.88 id.launchpad.dev 10.10.0.88 keyserver.launchpad.dev 10.10.0.88 lists.launchpad.dev 10.10.0.88 openid.launchpad.dev 10.10.0.88 ppa.launchpad.dev 10.10.0.88 private-ppa.launchpad.dev 10.10.0.88 shipit.edubuntu.dev 10.10.0.88 shipit.kubuntu.dev 10.10.0.88 shipit.ubuntu.dev 10.10.0.88 translations.launchpad.dev 10.10.0.88 xmlrpc-private.launchpad.dev 10.10.0.88 xmlrpc.launchpad.dev 10.10.0.99 bazaar.launchpad.dev }}} Then save the file and try to open http://launchpad.dev (If you did this well, you will see the local Launchpad appearing) |
Then set your browser's SOCKS proxy settings to use target-machine:8110 |
This page tells you how to modify a development Launchpad so you can access it from other machines. Ask for help right away if you run into problems. |
Accessing launchpad.test from anywhere on the LAN
These instructions assume that you already have Launchpad working for local access, and now you want it to be accessible from other machines on the same LAN, or perhaps the virtual machine or LXC host.
Amending the Apache configuration
Launchpad's default development Apache config (/etc/apache2/sites-available/local-launchpad.conf) only listens on 127.0.0.88. This can be overridden with the LISTEN_ADDRESS environment variable when running make install. You probably want to make it listen on everything:
sudo make LISTEN_ADDRESS=* install
note: zsh users receiving the error no matches found: LISTEN_ADDRESS=* may need to noglob this:
noglob sudo make LISTEN_ADDRESS=* install
Amending the hosts file
Launchpad makes extensive use of virtual hosts, so you'll need to add entries to /etc/hosts on any machine from which you want to access the Launchpad instance. You'll see the relevant hostnames in /etc/hosts on the machine running the instance -- they need to be added to the remote machine, mapped to the server machine or container's external IP address.
If some of those other machines run Windows, it may be helpful to know that the Windows equivalent of /etc/hosts is located at C:\WINDOWS\system32\drivers\etc\hosts. Note that Windows' version has a line length limit, so you might have to split it across multiple lines or only include the hostnames that you need.
That's it!
If you did everything above, you should new be able to access https://launchpad.test/ in a web browser on a suitably configured remote computer.
Accessing launchpad.test from a single host over SSH
SSH provides a SOCKS proxy. By running that proxy on the target machine, you can view its Launchpad web site as if you were on that machine, without having to open non-SSH ports to a wider network. To do so:
- ssh -D8110 target-machine
Then set your browser's SOCKS proxy settings to use target-machine:8110