I have a basic app, as per my last blog post. Now I need to host it somewhere. I have changed the app to only listen on local host, I have iptables on my servers to hopefully prevent me exposing ports I don’t want to expose, but better to not push my luck. I’m using a server running apache and using systemd as the init system. So for SSL termination we’ll use apache as the revers proxy. For this we need a vhost with mod_proxy enabled and the following config in a vhost

        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/

We then need to create a user to run the app, we want an unprivileged user

sudo adduser --system\
             --shell /bin/false\
             --gecos 'Location Finder App'\
             --group\
             --disabled-password\
             --home /opt/location location

With that we need to create a systemd system file (I’ve added an example systemd file to the app repo) and to move a built copy of the binary onto the system, along with the HTML template file. And that is what I have done.

The next steps will be more complicated. I need to turn this into something useful, and for that I’m going to need some server side storage, an API that takes the location and stores it, and an API that reads it.

posted at 9:26 pm on 25 Aug 2019 by Craig Stewart

Tags:project sysadmin location-finder