OpenCloud
Cloud file storage, like dropbox, onedrive, etc. , is a great alternative to a full cloud application suite when you just need to work with files. You don’t get all the features, but it’s dramatically less work. Of these, OpenCloud is the best mix of simplicity and function. Importantly, your files are just saved to disk in the folder structure you created. You can directly access it making everything easy and portable.
Even better, if all you want is the web manager and text/markdown editor you can deploy it as a simply binary in just a few moments. No databases or docker needed.
Installation
- Create a debian instance (a LXC container works well)
- Download the lastest binary
- Create a simple service file
Download and Initialize
Check https://github.com/opencloud-eu/opencloud/releases/latest/ for the URL of the latest binary to download and adjust the wget below.
# Download the binary and make it executible
wget https://github.com/opencloud-eu/opencloud/releases/download/v5.0.2/opencloud-5.0.2-linux-amd64
chmod +x ./open*
# Move it to local bin directoy and create a symlink so we can launch it as just 'opencloud'
sudo mv open* /usr/local/bin
sudo ln -s /usr/local/bin/open* /usr/local/bin/opencloud
# Inistialize it right in your home folder. Maybe create a service account if you feel production-ish about it
cd
opencloud init --insecure true --admin-password admin
# Move the directory to /opt and create a symlink to it
sudo mv .opencloud /opt/opencloud
ln -s /opt/opencloud .opencloud
Create a Service
Important - you need to tell the binary about how it will be accessed via environment variables. Otherwise you’ll only be able to access it via localhost. Assuming you’re going to use a secure proxy like nginx or caddy, tell it about those too. You can ONLY access it this way. Anything else will give you a cryptic error message.
sudo vi /etc/systemd/system/opencloud.service
[Unit]
Description=OpenCloud
After=network.target
[Service]
Environment="OC_INSECURE=true"
Environment="OC_URL=https://docs.your.org"
Environment="PROXY_TLS=false"
ExecStart=/usr/local/bin/opencloud server
Restart=on-failure
User=allen
[Install]
WantedBy=multi-user.target
If you were only going to access it inside your LAN, you’d only need the single OC_URL setting.
Environment="OC_URL=https://docs.lan:9200"
Position Storage
You’ve setup OpenCloud in /opt/opencloud and it has a subfolder named storage where it saves user files. If you have any meaningful amout of data you should put that on dedicated storage. Especially if you’re running in a container. You don’t want all that user data gumming things up. If your back-end is local you can just use a bind mount. But if it’s network storage, you’ll want to be a but more granular to keep the metadata and lock files off the back-end.
# Disable OpenCloud while you work on it
sudo systemctl disable --now opencloud
# If you have local storage, you can move the whole storage folder and create a new one for the bind mount
sudo mv /opt/opencloud/storage /opt/opencloud/storage.orig
sudo mkdir /opt/opencloud/storage
# OR #
# For network storage move just the user folder.
sudo mv /opt/opencloud/storage/users /opt/opencloud/storage/users.orig
sudo mkdir /opt/opencloud/storage/users
# Now is the time to bind mount from your host or such to the new folder
# and bouce the instance so it can access the new location
# for gluster and incus you may need to adjust the user IDs with a
# sudo incus config set files raw.idmap "both 1000 1000"
# Copy the content over, preserving the XATTRs that OpenCloud uses
rsync -aHAXv /opt/opencloud/storage/users.orig/ /opt/opencloud/storage/users
After profiling thigs, the only interesting folders on the remote filesystem are
users/uploads users//.oc-nodes users//.oc-nodes/locks users/*/.oc-tmp i
It might be worth symlinking those to directores on a fast SSD but unless the OpenCloud server is busy it’s not worth the complexity out of the gate.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.