diff --git a/.gitignore b/.gitignore index dfdb08d..8b476b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -**.env.** -.env -localSettings +**.env.** +.env +localSettings diff --git a/README.md b/README.md index d83a2ad..be903b2 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,60 @@ -# cloud.limbosolutions.com - -Welcome to public repository of [https://cloud.limbosolutions.com](https://cloud.limbosolutions.com) - -Using [NextCloud](https://nextcloud.com/) - -## Setup - -- Docker -_Currently hosted on an ubuntu lxc container with docker and portainer [+ information](https://git.limbosolutions.com/kb/lxc)._ - -- [NextCloud Custom Docker Image](docker/Dockerfile) with smbclient extensions -- [Duplicati Image with mySql client](https://git.limbosolutions.com/kb/duplicati/src/branch/main/docker/mysqlclient/README.md) - -[Docker Compose File](docker-compose.yaml) - -[Check](doc/setup.md) for setup information. - -## NextCloud CLI - -``` bash - -#force file scan for specfic user -docker exec --user www-data nextcloud php occ files:scan USERNAME - -``` +# cloud.limbosolutions.com + +Welcome to public repository of [https://cloud.limbosolutions.com](https://cloud.limbosolutions.com) + +Using [NextCloud](https://nextcloud.com/) + + + +## Requirements + +- Docker +- Docker Compose +- Portainer (optional) +- [NextCloud Custom Docker Image](docker/Dockerfile) with smbclient extensions +- [Duplicati Image with mySql client](https://git.limbosolutions.com/kb/duplicati/src/branch/main/docker/mysqlclient/README.md) + + + +## NextCloud CLI + +``` bash + +#force file scan for specfic user +docker exec --user www-data nextcloud php occ files:scan USERNAME + +``` + + +## Setup + +[Docker Compose File](docker/ocker-compose.yaml) + +## Backup and Restore + +Using [custom duplicati image](https://git.limbosolutions.com/kb/duplicati) to daily backups files and databases. Every action (backup/restore) creates an measurement in influxdb for reporting and alerts. + + +### Duplicati - Default Options + +Notify Influxdb. + +--run-script-after=duplicati-influxdb-notify + +### Duplicati - wiki job Options + +Create db dump. + +run-script-before-required:duplicati-mysql-backup + +### Restore Database + +```bash +#select a file to import +ls /db-dumps +#select a file to import +DB_FILE= "file name to import" +mysql --host db -uroot -p ${MYSQL_DATABASE} < /db-dumps/$DB_FILE +#root password (root password is the enviromnent variable ${MYSQL_ROOT_PASSWORD}) +``` + diff --git a/docker/Dockerfile b/docker/Dockerfile index af2d949..c75f424 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,2 +1,3 @@ -FROM nextcloud:25.0 +#image name : nextcloud-smbclient:25.0 +FROM nextcloud:25.0 RUN apt update;apt install -y smbclient libsmbclient-dev;pecl install smbclient;echo "extension=smbclient.so" >> /usr/local/etc/php/conf.d/nextcloud.ini \ No newline at end of file diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index fd4cbf2..34a3e4a 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -1,69 +1,74 @@ -version: '2' -services: - db: - image: mariadb:10.5 - restart: always - command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW - volumes: - - db:/var/lib/mysql - environment: - - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - - MYSQL_PASSWORD=${MYSQL_PASSWORD} - - MYSQL_DATABASE=${MYSQL_DATABASE} - - MYSQL_USER=${MYSQL_USER} - app: - image: nextcloud-smbclient:latest - restart: always - ports: - - ${APP_PORT}:80 - links: - - db - volumes: - - html:/var/www/html - environment: - - MYSQL_PASSWORD=${MYSQL_PASSWORD} - - MYSQL_DATABASE=${MYSQL_DATABASE} - - MYSQL_USER=${MYSQL_USER} - - MYSQL_HOST=${MYSQL_HOST} - - PHP_MEMORY_LIMIT=2048M - duplicati: - image: duplicati-mysqlclient:latest - environment: - - DB_HOST=${MYSQL_HOST} - - DB_NAME=${MYSQL_DATABASE} - - DB_USER=${MYSQL_USER} - - DB_PASSWORD=${MYSQL_PASSWORD} - - DB_BACKUP_TARGETFOLDER=${DB_BACKUP_TARGETFOLDER} - volumes: - - duplicati_data:/data - - db:/backup/db_data:ro - - html:/backup/app_data:ro - - duplicati_data:/backup/duplicati_data:ro - - db-dumps:${DB_BACKUP_TARGETFOLDER} - ports: - - ${DUPLICATI_PORT}:8200 - restart: unless-stopped - code-server: - image: lscr.io/linuxserver/code-server:latest - environment: - #- PUID=1000 - #- PGID=1000 - - TZ=Europe/London - - PASSWORD=${ADMIN_PASSWORD} #optional - #- HASHED_PASSWORD= #optional - - SUDO_PASSWORD=${ADMIN_PASSWORD} #optional - #- SUDO_PASSWORD_HASH= #optional - #- PROXY_DOMAIN=code-server.my.domain #optional - - DEFAULT_WORKSPACE=/config/workspace #optional - volumes: - - code-server_config:/config - - html:/data/nextcloud_html - ports: - - 8445:8443 - restart: unless-stopped -volumes: - html: - db: - duplicati_data: - db-dumps: - code-server_config: +version: '2' +services: + db: + image: mariadb:10.5 + restart: always + command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW + volumes: + - db:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + app: + image: nextcloud-smbclient:25.0 + restart: always + ports: + - ${APP_PORT}:80 + links: + - db + volumes: + - html:/var/www/html + environment: + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_HOST=${MYSQL_HOST} + - PHP_MEMORY_LIMIT=2048M + duplicati: + image: duplicati-mysqlclient:latest + environment: + - MYSQL_HOST=${MYSQL_HOST} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - INFLUXDB_SERVER=${INFLUXDB_SERVER} + - INFLUXDB_BUCKET=${INFLUXDB_BUCKET} + - INFLUXDB_ORG=${INFLUXDB_ORG} + - INFLUXDB_TOKEN=${INFLUXDB_TOKEN} + - INFLUXDB_CLIENT_HOSTNAME=${INFLUXDB_CLIENT_HOSTNAME} + - DB_BACKUP_TARGETFOLDER=/bck/db_dumps + volumes: + - duplicati_data:/data + - db:/bck/db_data:ro + - html:/bck/app_data:ro + - duplicati_data:/bck/duplicati_data:ro + - db-dumps:/bck/db_dumps + ports: + - ${DUPLICATI_PORT}:8200 + restart: unless-stopped + code-server: + image: lscr.io/linuxserver/code-server:latest + environment: + #- PUID=1000 + #- PGID=1000 + - TZ=Europe/London + - PASSWORD=${ADMIN_PASSWORD} #optional + #- HASHED_PASSWORD= #optional + - SUDO_PASSWORD=${ADMIN_PASSWORD} #optional + #- SUDO_PASSWORD_HASH= #optional + #- PROXY_DOMAIN=code-server.my.domain #optional + - DEFAULT_WORKSPACE=/config/workspace #optional + volumes: + - code-server_config:/config + - html:/data/nextcloud_html + ports: + - 8445:8443 + restart: unless-stopped +volumes: + html: + db: + duplicati_data: + db-dumps: + code-server_config: diff --git a/docs/images/nextcloud-homessistant-dashboard.png b/docs/images/nextcloud-homessistant-dashboard.png deleted file mode 100644 index b0005f6..0000000 Binary files a/docs/images/nextcloud-homessistant-dashboard.png and /dev/null differ diff --git a/docs/setup.md b/docs/setup.md deleted file mode 100644 index 9ec7cba..0000000 --- a/docs/setup.md +++ /dev/null @@ -1,46 +0,0 @@ -# Setup - -- Docker -_Currently hosted on an ubuntu lxc container with docker and portainer [+ information](https://git.limbosolutions.com/kb/lxc)._ - -- [NextCloud Custom Docker Image](../docker/Dockerfile) with smbclient extensions -- [Duplicati Image with mySql client](https://git.limbosolutions.com/kb/duplicati/src/branch/main/docker/mysqlclient/README.md) - -[Docker Compose File](../docker/docker-compose.yaml) - -## Backup & Restore - -Using [duplicati](https://git.limbosolutions.com/kb/duplicati) to daily backups of files and databases. - - -### Restore Database - -```bash -#select a file to import -ls /db-dumps -#select a file to import -DB_FILE= "file name to import" -mysql --host db -uroot -p ${MYSQL_DATABASE} < /db-dumps/$DB_FILE -#root password (root password is the enviromnent variable ${MYSQL_ROOT_PASSWORD}) -``` - -## HomeAssistant DashBoard - -![Home Assistant Dashboard](images/nextcloud-homessistant-dashboard.png "Home Assistant Dashboard") - -```yaml -type: vertical-stack -cards: - - type: entities - entities: - - type: weblink - name: Homepage - url: http://cloud.limbosolutions.com - - type: weblink - name: Duplicati - url: http://wansrv01.dev.lan:8203 - - type: weblink - name: Git - url: https://git.limbosolutions.com/marcio.fernandes/nextcloud/ - title: cloud.limbosolutions.com -```