Diff for "Running/RemoteAccess"

Not logged in - Log In / Register

Differences between revisions 1 and 20 (spanning 19 versions)
Revision 1 as of 2009-08-13 20:41:03
Size: 8350
Editor: flyman
Comment:
Revision 20 as of 2022-06-17 12:37:30
Size: 100
Editor: cjwatson
Comment: update link
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. ||

<<Anchor(change)>>

= Changing Interfaces =

Assuming you already the Launchpad running and you want it to be accessable from your external network.

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.

''''For this tutorial i'm assuming that you have the ability to sudo as root''''


First, we're going to change the network interfaces. For this to work we need static IP addresses assigned to the server.

{{{
  $ cd /etc/network
}}}

Then we'll open up the interfaces file with your favorite editor:

{{{
# 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)
#refresh 0 https://launchpad.readthedocs.io/en/latest/how-to/running.html#setting-up-remote-access

Running/RemoteAccess (last edited 2022-06-17 12:37:30 by cjwatson)