This project has a follow-up: https://github.com/AmmanVMS/dynamic-website-reverse-proxy/
This is a tool to make local services served in a community network available to the outside internet. The intention is to
- lower the bar to create internet services
- increase accessibility from inside and outside the community network and thus make services in the network more attractive
You create an http service in the local community network. Then, you go to this service installation for your community.
You put in your ip address, your server name and your port. When you submit, your website should be available under the hostname you entered.
You can setup the server for your community in case the server is not there.
- Install docker.
You will need a 64 bit computer.
wget -O- https://get.docker.com | sh
- Start the server replacing the configuration variables accordingly.
Now, the server should be available at http://localhost.
docker run -p "80:80" -e "DOMAIN=MY-DOMAIN" -d --rm niccokunzmann/freifunk-website-proxy
- Once the server is available, you need to configure the router of yours to forward the traffic. I.e. this could be your internet gateway available at http://192.168.0.1. Somewhere you can find the "Port Forwarding" (DE: Portfreigabe/Portweiterleitung) Here, you can configure the gateway to forward traffic from port 80 to your IP on port 80.
- Setup a domain name. In case you have just a home router, you can use e.g. http://selfhost.eu to get a free of charge dynamic domain name.
- In order for other people to reach not only your domain name but also other services on this domain,
you need to setup a cname record.
- Example:
You registered
quelltext.selfhost.eu
free of charge. Now, you pay 2€/year and you buyquelltext.eu
. Then, you setup the CNAME record*.quelltext.eu
to point toquelltext.selfhost.eu
. - You can also contact @niccokunzmann in an issue if you like to use a domain named
my-community.quelltext.eu
. - Your community has a website e.g.
freifunk-potsdam.de
. They can setupservice.freifunk-potsdam.de
and*.service.freifunk-potsdam.de
to point to your domain.
- Example:
You registered
- Configure your gateway to update the IP address behind the domain name. Your gateway usually has a dyndns configuration which you can configure. This will update the registered dynamic domain name once your provider switches your IP address.
Once these steps are undergone, you should be able to access your server from the internet using your domain and be able to register new clients. Note that this looks like a lot bot this would be necessary for many more people to provide their services. Once this is done, they have a much easier process to share their site.
The configuration of the service is done via environment variables. This is the configuration you should touch:
DOMAIN
defaultlocalhost
This is the domain your servers serves from. If DOMAIN is "test.freifunk.net", new a hostname "chocolate" is prepended so the website is served under "chocolate.test.freifunk.net".NETWORK
default10.0.0.0/8
This is the network address of the accepted services. I.e. Freifunk in Potsdam covers10.22.0.0/16
.
This is configuration you can touch:
DATABASE
This is the place the data is stored when the service restarts.- default for the Python app is `` and nothing will be saved to a file.
- default for the docker container is
/data/db.pickle
which holds the state of the proxy.
SOURCE_CODE
This is the directory the currently running source code can be obtained from.- default for the Python app is the module directory.
- default for the docker container is
/app
-
Run the server
python3 -m freifunk_website_proxy
Build the server and run it
docker build --tag niccokunzmann/freifunk-website-proxy . && docker run -p "9000:80" -e "DOMAIN=localhost:9000" -it --rm niccokunzmann/freifunk-website-proxy
Now, you can reach your server under http://localhost:9000.
Run the tests
watch -n 0.5 pytest