- Copy systemd service file to default folder and run it:
cp nextcloud-rootless-compose.service ~/.config/systemd/user/
systemctl --user enable --now nextcloud-rootless-compose.service- Open port
80and443:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
# or if you are using iptables
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 443 -j ACCEPT
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 80 -j ACCEPT
sudo iptables-save > /etc/iptables/rules.v4This compose file based on example from oficial nextcloud docker repository, link. I chose compose file with mariadb and nginx proxy.
Before running rename all .exapmle files, leave redis-session.ini empty, set all environment variables in nc.env and web.env.
Also, you should run cronjob on machine, not docker. Run crontab -e and insert this, change nextcloud container name:
*/5 * * * * DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock docker exec -u www-data:www-data NEXTCLOUD_CONTAINER_NAME php ./cron.php Database and proxy run in separate service, so I can use it in other services. Check out this repository for more information.
Install preview generator app and add cronjob:
*/50 * * * * DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock docker exec -u www-data:www-data rootless-nextcloud-compose_app_1 php ./occ preview:pre-generateThis will prevent server crashing when generating a lot of previews wnen opening folder with a lot of images.
- Rootless (non-root user) Docker and Docker Compose running NGINX on Debian 10
- Run the Docker daemon as a non-root user (Rootless mode)
- How to run cron job in rootless mode
- Solve problem with redis not running in rootless mode
- Solution to "You are accessing your instance over a secure connection..." problem