Compare commits

...

7 commits

6 changed files with 235 additions and 7 deletions

View file

@ -27,13 +27,6 @@ spec:
- image: visibilityspots/cloudflared
imagePullPolicy: IfNotPresent
name: cloudflared
ports:
- containerPort: 53
name: dns
protocol: TCP
- containerPort: 67
name: dns-udp
protocol: UDP
env:
- name: TUNNEL_METRICS
value: 127.0.0.1:3000

View file

@ -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

View file

@ -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"]

View file

@ -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
```

View file

@ -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:
- <path-to-data-dir|docker-volume>:/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:
- <path-to-data-dir|docker-volume>:/var/www/html
- <path-to-data-dir|docker-volume>:${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}

View file

@ -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