Skip to content

Setting up a temporary file server#

On this page we are gonna use partage from z3bra.

Requirements#

  • go toolchain
  • mk (can be from 9base, plan9port, whatever, or standalone)
  • nginx
  • git

Building#

Fetch the repo by running git clone git://z3bra.org/partage.git and cd to it. Then just run mk as usual.\ You might want to run mk install afterward

Configuring#

This is kinda the tricky part here, because the first time I tried it did not really work out because of file permissions and such.

  • Copy the default config from example/partage.conf to /etc/partage.conf (modify when appropriate)
  • Run install -g daemon -o www -d /usr/local/partage
  • Create the required directories on /usr/local/partage, those being files, meta, static and templates. Give those dirs the same user:group too.
  • Copy the templates and static files from example to templates and static at /usr/local/partage respectively. Repeat the ownership step just in case.

Reverse proxy#

This is the nginx snippet for partage.

server {
        listen 80;
        listen [::]:80;
        server_name <your domain name here>;

        location ^~ /.well-known/acme-challenge {
                alias /var/www/acme;
        }
}
server {
        listen 443 ssl;
        listen [::]:443 ssl;
        server_name <your domain name here>;

        ssl_certificate /etc/dehydrated/certs/<your domain name here>/fullchain.pem;
        ssl_certificate_key /etc/dehydrated/certs/<your domain name here>/privkey.pem;

        client_max_body_size 100m;

        location / {
                proxy_pass http://127.0.0.1:<port specified on partage.conf>;
        }
}

Start-up#

This is the rc.d(8) script for partage.

#!/bin/ksh
daemon="/usr/local/bin/partage"
daemon_flags="-f /etc/partage"
# no need to specify daemon_user here, as it drops privileges anyway

. /etc/rc.d/rc.subr

rc_bg=YES

rc_cmd "$1"

And if everything went good, it's done, you have your temporary file server!