Skip to content

Setup FreeCC Domain

Chunhua "Leo" Liao edited this page Nov 18, 2019 · 12 revisions

The FreeCC domain freecompilercamp.org is managed on GoDaddy. Assume the IP of server hosting the play-with-compiler server is <aws_ip> and GitPages is used to host the main classroom website.

Two Domain Names

We need two domain names

Setting Up FreeCC domains

On the Godaddy website, go to the DNS setting of freecompilercamp.org. Add new records and values

  • @, It refers to domains freecompilercamp.org., value set to <github_ip>, Type A
    • github IPs have four values. So four entries are needed. 185.199.108.153, 185.199.109.153, 185.199.110.153, 185.199.111.153
  • www , this is for www.freecompilercamp.org, value set to freecompilercamp.github.io, Type CNAME, pointing GitPages
  • lab , this is for lab.freecompilercamp.org, used for hosting the PWC engine, value set to <aws_ip>, Type A
  • .lab , value set to <aws_ip> Keep the rest sections as default values. Save and wait for one hour or more until the entries take effect.

Setup Forwarding among Domain Names

Essentially we want establish the following forwarding relations

  • lab:80 -> lab:5010

The PWD server exposes one special port.

  • <pt1>: for the PWC sandbox server . We use port 5010 for the container running the PWC sandbox server

When a regular request from port 80 to sandbox is coming, we need first forward that request to the unique port <pt1>. To do this, add the following code to Apache configuration, which is located at /etc/apache2/sites-available/000-default.conf.

<VirtualHost *:80>
        ServerName lab.freecompilercamp.org
        ProxyPass / http://lab.freecompilercamp.org:5010/
</VirtualHost>

So, any access to lab.freecompilercamp.org will be passed to lab.freecompilercamp.org:5010.

Restart Apache server to apply the new configuration. Users don't need to handle any special port, they can input the original web address freecompilercamp.org as usual. The server will automatically forward the requests to proper docker containers.