From 32b53da3947bb207c7c7fdc6b439c54b1af8a498 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Monroy Date: Wed, 24 Jul 2024 22:45:06 -0600 Subject: [PATCH 1/5] feat(Nextcloud/mariadb-redis-ffmpeg-example/supervisord.conf): Added supervisor file and config --- .../supervisord.conf | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Nextcloud/mariadb-redis-ffmpeg-example/supervisord.conf diff --git a/Nextcloud/mariadb-redis-ffmpeg-example/supervisord.conf b/Nextcloud/mariadb-redis-ffmpeg-example/supervisord.conf new file mode 100644 index 0000000..40757b2 --- /dev/null +++ b/Nextcloud/mariadb-redis-ffmpeg-example/supervisord.conf @@ -0,0 +1,22 @@ +[supervisord] +nodaemon=true +logfile=/var/log/supervisord/supervisord.log +pidfile=/var/run/supervisord/supervisord.pid +childlogdir=/var/log/supervisord/ +logfile_maxbytes=50MB ; maximum size of logfile before rotation +logfile_backups=10 ; number of backed up logfiles +loglevel=error + +[program:apache2] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=apache2-foreground + +[program:cron] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=/cron.sh \ No newline at end of file From 4e281ba62cefca1e245f5f20a341174f5bd71979 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Monroy Date: Wed, 24 Jul 2024 22:45:38 -0600 Subject: [PATCH 2/5] feat(Nextcloud/mariadb-redis-ffmpeg-example/Dockerfile): Added Dockerfile file and config --- .../mariadb-redis-ffmpeg-example/Dockerfile | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Nextcloud/mariadb-redis-ffmpeg-example/Dockerfile diff --git a/Nextcloud/mariadb-redis-ffmpeg-example/Dockerfile b/Nextcloud/mariadb-redis-ffmpeg-example/Dockerfile new file mode 100644 index 0000000..cbf2da9 --- /dev/null +++ b/Nextcloud/mariadb-redis-ffmpeg-example/Dockerfile @@ -0,0 +1,64 @@ +FROM nextcloud:latest + +# This step solves the issue if you want to mount a volume to the container and then use it as data dir +RUN groupmod --gid 10000 www-data && \ + usermod --uid 10000 www-data + +RUN set -ex; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ffmpeg \ + ghostscript \ + libmagickcore-6.q16-6-extra \ + procps \ + smbclient \ + supervisor \ +# libreoffice \ + ; \ + rm -rf /var/lib/apt/lists/* + +RUN set -ex; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libbz2-dev \ + libc-client-dev \ + libkrb5-dev \ + libsmbclient-dev \ + ; \ + \ + docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \ + docker-php-ext-install \ + bz2 \ + imap \ + ; \ + pecl install smbclient; \ + docker-php-ext-enable smbclient; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/* + +RUN mkdir -p \ + /var/log/supervisord \ + /var/run/supervisord \ +; + +COPY supervisord.conf / + +ENV NEXTCLOUD_UPDATE=1 + +CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"] \ No newline at end of file From 2c4c09eef015a966b7784096380984beb4c8aa01 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Monroy Date: Wed, 24 Jul 2024 22:46:10 -0600 Subject: [PATCH 3/5] feat(Nextcloud/mariadb-redis-ffmpeg-example/docker-compose.yml): Added docker-compose file and config --- .../docker-compose.yml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Nextcloud/mariadb-redis-ffmpeg-example/docker-compose.yml diff --git a/Nextcloud/mariadb-redis-ffmpeg-example/docker-compose.yml b/Nextcloud/mariadb-redis-ffmpeg-example/docker-compose.yml new file mode 100644 index 0000000..61d1bd9 --- /dev/null +++ b/Nextcloud/mariadb-redis-ffmpeg-example/docker-compose.yml @@ -0,0 +1,61 @@ +networks: + dbnet: + redisnet: + +services: + db: + image: mariadb:10.6 + container_name: mariadb + restart: always + command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW + volumes: + - :/var/lib/mysql + expose: + - 3306 + networks: + - dbnet + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:?err} + - MYSQL_PASSWORD=${MYSQL_PASSWORD:?err} + - MYSQL_DATABASE=${MYSQL_DATABASE:?err} + - MYSQL_USER=${MYSQL_USER:?err} + + redis: + image: redis:alpine + container_name: redis + restart: always + networks: + - redisnet + expose: + - 6379 + + app: + build: + context: . + dockerfile: ./Dockerfile + container_name: nextcloud + restart: always + ports: + - 8080:80 + links: + - db + - redis + depends_on: + - db + - redis + networks: + - redisnet + - dbnet + volumes: + - :/var/www/html + - :${NEXTCLOUD_DATA_DIR:?err}:rw,exec + environment: + - REDIS_HOST=redis + - MYSQL_PASSWORD=${MYSQL_PASSWORD:?err} + - MYSQL_DATABASE=${MYSQL_DATABASE:?err} + - MYSQL_USER=${MYSQL_USER:?err} + - MYSQL_HOST=db + - NEXTCLOUD_ADMIN_USER=${NEXTCLOUD_ADMIN_USER:?err} + - NEXTCLOUD_ADMIN_PASSWORD=${NEXTCLOUD_ADMIN_PASSWORD:?err} + - NEXTCLOUD_TRUSTED_DOMAINS=${NEXTCLOUD_TRUSTED_DOMAINS:?err} + - NEXTCLOUD_DATA_DIR=${NEXTCLOUD_DATA_DIR:?err} From 589ec2a785d8bcb4218f72d9067d75f17e9eb76b Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Monroy Date: Wed, 24 Jul 2024 22:46:48 -0600 Subject: [PATCH 4/5] feat(Nextcloud/mariadb-redis-ffmpeg-example/.env.example): Added env example file and content --- Nextcloud/mariadb-redis-ffmpeg-example/.env.example | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Nextcloud/mariadb-redis-ffmpeg-example/.env.example diff --git a/Nextcloud/mariadb-redis-ffmpeg-example/.env.example b/Nextcloud/mariadb-redis-ffmpeg-example/.env.example new file mode 100644 index 0000000..9a4bb80 --- /dev/null +++ b/Nextcloud/mariadb-redis-ffmpeg-example/.env.example @@ -0,0 +1,8 @@ +MYSQL_ROOT_PASSWORD=awesome-root-password +MYSQL_PASSWORD=awesome-password +MYSQL_DATABASE=nextcloud +MYSQL_USER=awesome-user +NEXTCLOUD_ADMIN_USER=awesome-admin +NEXTCLOUD_ADMIN_PASSWORD=awesome-admin-password +NEXTCLOUD_TRUSTED_DOMAINS="ocalhost" +NEXTCLOUD_DATA_DIR=/mnt/ncdata \ No newline at end of file From 5b046298ef5706ccee8fb7ee2bde2cae1715e0ad Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Monroy Date: Wed, 24 Jul 2024 22:47:10 -0600 Subject: [PATCH 5/5] docs(Nextcloud/mariadb-redis-ffmpeg-example/README.md): Added README file --- .../mariadb-redis-ffmpeg-example/README.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Nextcloud/mariadb-redis-ffmpeg-example/README.md diff --git a/Nextcloud/mariadb-redis-ffmpeg-example/README.md b/Nextcloud/mariadb-redis-ffmpeg-example/README.md new file mode 100644 index 0000000..ba5aebc --- /dev/null +++ b/Nextcloud/mariadb-redis-ffmpeg-example/README.md @@ -0,0 +1,80 @@ +# Nextcloud Docker Setup + +## Description +This project provides a Docker-based setup for Nextcloud with enhanced features including face recognition and memories. It's designed for easy deployment in home lab environments, particularly within LXC containers. + +## Features +- Docker-based Nextcloud instance +- MariaDB for database +- Redis for caching +- FFmpeg and other tools for advanced features +- Supervisor for process management +- Compatibility with LXC containers + +## Prerequisites +- Docker and Docker Compose installed on your system +- Basic understanding of Docker and command-line operations +- LXC container (if deploying in a containerized environment) + +## Installation and Setup + +1. Install Docker + If you haven't already, install Docker on your system. You can find instructions for your operating system [here](https://docs.docker.com/get-docker/). + +2. Create a user with specific UID and GID + Run the following command to create a new user with UID and GID set to 10000: + + ```bash + sudo useradd -u 10000 -g 10000 -m nextclouduser + ``` + +3. Add the user to the Docker group + This allows the user to run Docker commands without sudo: + + ```bash + sudo usermod -aG docker nextclouduser + ``` + +4. Map UID and GID of the LXC container + If you're using an LXC container, ensure that the UID and GID of the container match those of the host user. This typically involves editing the LXC container's configuration file to add: + + ```bash + # Map users + lxc.idmap: u 0 100000 65536 + lxc.idmap: g 0 100000 65536 + ``` + + Adjust these values according to your specific host UID/GID mappings. + +5. (Optional) Change app data storage + If you prefer to use a Docker volume instead of a local directory for app data, you can modify the `docker-compose.yml` file accordingly. + +6. Build the Nextcloud app image + Run the following command in the directory containing your Dockerfile and docker-compose.yml: + + ```bash + docker compose build app + ``` + +7. Start the Nextcloud stack + Launch the entire Nextcloud stack with: + + ```bash + docker compose up -d + ``` + +## Configuration +- Copy the `.env.example` file to `.env` and adjust the variables as needed. +- Modify the `docker-compose.yml` file if you need to change ports or volume mappings. + +## Usage +After the installation, you can access Nextcloud by navigating to `http://localhost:8080` in your web browser. Use the admin credentials specified in your `.env` file for the initial login. + +## Advanced Features +This setup includes support for Nextcloud's face recognition and memories apps. These can be enabled through the Nextcloud web interface after installation. + +## Troubleshooting +If you encounter issues, check the Docker logs: +```bash + docker compose logs +``` \ No newline at end of file