A friend recently wanted to give me photos that he had taken at a party. Copying them to an old usb stick just took too long and so I offered to send him a link where he could upload the pictures.

Yes, there are numerous online services that could be considered, but I was also tempted to realize the whole thing on my VPS with K8s and nextcloud.

First I tried deploying owncloud but the pod would just fail to start with a permission error. Since I couldn't find any solution I uninstalled it and used nextcloud. This worked out of the box without any issues.

Let's quickly add the chart repo

helm repo add nextcloud https://nextcloud.github.io/helm/
helm repo update

Next we created a config file. I use K3s and Let's Encrypt. Simply change password, hostnames and pv size to your needs.

cat > nextcloud.yaml << EOF
nextcloud:
  host: nextcloud.example.com
  username: adminuser
  password: changeme123
persistence:
  enabled: true
  nextcloudData:
    enabled: true
    size: 60Gi
ingress:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: 600m
    nginx.org/client-max-body-size: 600m
  className: nginx
  enabled: true
  hosts:
  - host: nextcloud.example.com
    paths:
    - /
  tls:
  - hosts:
    - nextcloud.example.com
    secretName: nextcloud.example.com
service:
  type: ClusterIP

EOF

Finally we deploy the chart in namespace nextcloud

helm upgrade --install -n nextcloud --create-namespace nextcloud nextcloud/nextcloud -f nextcloud.yaml

We can see that an ingress has been created

[user@machine ~]$ kubectl get ingress -n nextcloud
NAME        CLASS   HOSTS                   ADDRESS          PORTS     AGE
nextcloud   nginx   nextcloud.example.com   123.123.123.123   80, 443   2m

That's it. We can now log in to our Nextcloud with the credentials that we specified in the nextcloud.yaml file under the following URL:

https://nextcloud.example.com

There we can quickly create a new user

We log in as that new user and create a folder "Upload" that we can share with someone to upload data

To create a link that we can share we click on the dots next to the folder

We can set the permissions for the link. I chose edit.

Finally we copy the link to our clipboard

We can now share this link with other people so that they can upload files.

Out of curiosity, I also checked if it would be possible to get some statistics using Plausible. For this an additonal app called JSLoader is needed. Install via the Nextcloud WebUI is very simple, but the App only supports a Nextcloud version of 1.22. At the time of writing the version is 1.29.x. I will keep an eye on the Github project. Hopefully there will be a new version soon. That's if for today. Enjoy.

Sources

helm/charts/nextcloud/README.md at main ยท nextcloud/helm
A community maintained helm chart for deploying Nextcloud on Kubernetes. - nextcloud/helm
GitHub - nextcloud/jsloader: :chart_with_upwards_trend: App to load JavaScript on every Nextcloud page
:chart_with_upwards_trend: App to load JavaScript on every Nextcloud page - nextcloud/jsloader