From cc6f043f9e8868a757ae2fd90b48619c740d313a Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Tue, 28 Sep 2021 02:06:22 +0000 Subject: [PATCH] Added CT's NodeJS, NodeRed, z2mqtt & nextcloud --- .gitignore | 2 + CT-Build/Alpine.Jenkinsfile | 2 +- CT-Build/Alpine.yaml | 107 ++++++++++++++++ CT-Files/nextcloud/Configs/nginx.conf | 114 ++++++++++++++++++ CT-Files/nextcloud/Configs/php.conf | 45 +++++++ CT-Files/nextcloud/Scripts/FirstRun.sh | 41 +++++++ CT-Files/nextcloud/Scripts/Init.sh | 28 +++++ CT-Files/nodered/Scripts/Init.sh | 24 ++++ CT-Files/nodered/Scripts/Update-NodeRed.sh | 9 ++ CT-Files/z2mqtt/Scripts/Init.sh | 32 +++++ CT-Files/z2mqtt/Scripts/Update-Zigbee2Mqtt.sh | 10 ++ CT-Files/z2mqtt/Scripts/Update-Zwave2mqtt.sh | 11 ++ Readme.md | 77 +++++++++--- Scripts/GetExternalResources.sh | 4 +- 14 files changed, 486 insertions(+), 20 deletions(-) create mode 100644 CT-Files/nextcloud/Configs/nginx.conf create mode 100644 CT-Files/nextcloud/Configs/php.conf create mode 100644 CT-Files/nextcloud/Scripts/FirstRun.sh create mode 100644 CT-Files/nextcloud/Scripts/Init.sh create mode 100644 CT-Files/nodered/Scripts/Init.sh create mode 100644 CT-Files/nodered/Scripts/Update-NodeRed.sh create mode 100644 CT-Files/z2mqtt/Scripts/Init.sh create mode 100644 CT-Files/z2mqtt/Scripts/Update-Zigbee2Mqtt.sh create mode 100644 CT-Files/z2mqtt/Scripts/Update-Zwave2mqtt.sh diff --git a/.gitignore b/.gitignore index 557bbf4..98ff80a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ CT-Files/transfersh/transfersh-linux-amd64 CT-Files/transfersh/transfershVersion CT-Files/domoticz/domoticz.tgz CT-Files/omadaV3/omada.deb +CT-Files/nextcloud/nginx_signing.rsa.pub +CT-Files/nextcloud/nextcloud.tar.bz2 \ No newline at end of file diff --git a/CT-Build/Alpine.Jenkinsfile b/CT-Build/Alpine.Jenkinsfile index 30a2107..5827f04 100644 --- a/CT-Build/Alpine.Jenkinsfile +++ b/CT-Build/Alpine.Jenkinsfile @@ -1,4 +1,4 @@ -String[] ImgVariantList = ['minimal', 'default' , 'gitea' , 'nginx' , 'ddns' , 'transfersh' , 'iscsi' ] +String[] ImgVariantList = ['minimal', 'default' , 'gitea' , 'nginx' , 'ddns' , 'transfersh' , 'iscsi' , 'z2mqtt' , 'nodered' , 'nodejs' ] pipeline { agent { label 'LXCBuilder' } diff --git a/CT-Build/Alpine.yaml b/CT-Build/Alpine.yaml index 4225cf8..cc227b2 100644 --- a/CT-Build/Alpine.yaml +++ b/CT-Build/Alpine.yaml @@ -265,6 +265,8 @@ files: To setup this container edit and run the FirstRun script `/opt/Setup/Scripts/FirstRun.sh` variants: - gitea + - nextcloud + ## for run only version - path: /root/ReadMe generator: dump @@ -301,6 +303,27 @@ files: variants: - transfersh +#FileForZigbee2mqtt&Zwavejs2mqtt +- path: /opt/Setup + generator: copy + source: CT-Files/z2mqtt + variants: + - z2mqtt + +#FileForNodeRed +- path: /opt/Setup + generator: copy + source: CT-Files/nodered + variants: + - nodered + +#FileForNextcloud +- path: /opt/Setup + generator: copy + source: CT-Files/nextcloud + variants: + - nextcloud + packages: manager: apk update: true @@ -318,6 +341,7 @@ packages: action: install variants: - nginx + - nextcloud #PKGS for Default - packages: @@ -358,6 +382,68 @@ packages: variants: - iscsi + #Base PKGS NodeJS + - packages: + - nodejs + - npm + - sudo + action: install + variants: + - z2mqtt + - nodered + - nodejs + + #PKGS for z2mqtt + - packages: + - gcc + - g++ + - git + - make + - python3 + - linux-headers + action: install + variants: + - z2mqtt + + #PKGS for nextcloud + - packages: + - php8-pdo_mysql + - php8-pecl-imagick + - php8-cli + - php8-pecl-apcu + - php8-pecl-redis + - php8-fpm + - php8-cgi + - php8-common + - php8-mbstring + - php8-curl + - php8-gd + - php8-intl + - php8-soap + - php8-xml + - php8-zip + - php8-pear + - php8-session + - php8-posix + - php8-pdo + - php8-dom + - php8-simplexml + - php8-xmlreader + - php8-xmlwriter + - php8-opcache + - php8-pcntl + - php8-fileinfo + - php8-bcmath + - php8-gmp + - libpng + - zlib + - imagemagick + - redis + - sudo + action: install + variants: + - nextcloud + repositories: - name: /etc/apk/repositories url: |- @@ -395,6 +481,24 @@ actions: echo "Europe/Amsterdam" > /etc/timezone ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime +#Run init script for NodeJS CT +- trigger: post-files + action: |- + #!/bin/sh + #Install pm2 + npm install -g pm2 + #Add NodeJS `node` service user + addgroup node + adduser -S -s /bin/ash -h /home/node -D -G node node + mkdir /opt/node + chown node:node /opt/node + env PATH=$PATH:/usr/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup openrc -u node --hp /home/node + echo "alias pm2='sudo -u node pm2'" >> ~/.profile + variants: + - z2mqtt + - nodered + - nodejs + #Run provided init script - trigger: post-files action: |- @@ -406,6 +510,9 @@ actions: - nginx - ddns - transfersh + - z2mqtt + - nodered + - nextcloud - trigger: post-files action: |- diff --git a/CT-Files/nextcloud/Configs/nginx.conf b/CT-Files/nextcloud/Configs/nginx.conf new file mode 100644 index 0000000..c7ff036 --- /dev/null +++ b/CT-Files/nextcloud/Configs/nginx.conf @@ -0,0 +1,114 @@ +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + server_tokens off; + client_body_buffer_size 10K; + client_header_buffer_size 1k; + client_max_body_size 8m; + large_client_header_buffers 4 4k; + server_names_hash_bucket_size 64; + root /usr/share/nginx/html; + include /etc/nginx/mime.types; + default_type application/octet-stream; + access_log off; + error_log /var/log/nginx/error.log; + #Server config for Nextcloud + server { + listen 80 default_server; + listen [::]:80 default_server; + server_name _; + root /opt/nextcloud; + # Set max upload size + client_max_body_size 1G; + + #SetupBlockStart + add_header Content-Type text/html; + return 200 'To setup this container edit and run the FirstRun script `/opt/Setup/Scripts/FirstRun.sh`'; + #SetupBlockEnd + add_header Referrer-Policy "no-referrer" always; + add_header X-Download-Options "noopen" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "none" always; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_hide_header X-Powered-By; + fastcgi_buffers 64 4K; + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + location ^~ /.well-known { + location = /.well-known/carddav { return 301 /remote.php/dav/; } + location = /.well-known/caldav { return 301 /remote.php/dav/; } + location ^~ /.well-known { return 301 /index.php$uri; } + try_files $uri $uri/ =404; + } + + location / { + rewrite ^ /index.php; + } + + location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { + deny all; + } + location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) { + deny all; + } + + location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) { + fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; + set $path_info $fastcgi_path_info; + try_files $fastcgi_script_name =404; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + fastcgi_param HTTPS on; + fastcgi_param modHeadersAvailable true; + fastcgi_param front_controller_active true; + fastcgi_pass unix:/run/php-fpm8/php-fpm.sock; + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + + location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) { + try_files $uri/ =404; + index index.php; + } + + location ~ \.(?:css|js|woff2?|svg|gif|map)$ { + try_files $uri /index.php$request_uri; + add_header Cache-Control "public, max-age=15778463"; + add_header Referrer-Policy "no-referrer" always; + add_header X-Download-Options "noopen" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "none" always; + access_log off; + } + + location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { + try_files $uri /index.php$request_uri; + access_log off; + } + } +} \ No newline at end of file diff --git a/CT-Files/nextcloud/Configs/php.conf b/CT-Files/nextcloud/Configs/php.conf new file mode 100644 index 0000000..67ff6ed --- /dev/null +++ b/CT-Files/nextcloud/Configs/php.conf @@ -0,0 +1,45 @@ +[nextcloud] +user = nginx +group = nginx +listen = /run/php-fpm8/php-fpm.sock +listen.owner = nginx +listen.group = nginx +php_admin_value[disable_functions] = exec,passthru,system +php_admin_value[error_log] = /var/log/php-fpm.error.log +; OPCACHE SETTINGS +php_admin_value[opcache.memory_consumption] = 256 +php_admin_value[opcache.enable] = 1 +php_admin_value[opcache.interned_strings_buffer] = 32 +php_admin_value[opcache.max_accelerated_files] = 50000 +php_admin_value[opcache.max_wasted_percentage] = 5 +php_admin_value[opcache.revalidate_freq] = 0 +php_admin_value[opcache.validate_timestamps] = 1 + +; PERFORMANCE LIMITS +php_admin_value[max_input_vars] = 1000 +php_admin_value[upload_max_filesize] = 1G +php_admin_value[post_max_size] = 1G +php_admin_value[max_input_time] = 60 +php_admin_value[memory_limit] = 512M + +; SECURITY +php_admin_value[cgi.fix_pathinfo] = 0 +php_admin_value[allow_url_fopen] = Off +php_admin_value[file_uploads] = on +php_admin_value[open_basedir] = /opt/nextcloud/:/var/nextcloud:/run/php-fpm8/php-fpm.sock:/run/redis/redis.sock:/proc/meminfo:/proc/cpuinfo:/dev/urandom:/tmp +php_admin_value[session.use_strict_mode] = 1 +php_admin_value[session.cookie_httponly] = 1 +;HTTPSONLY php_admin_value[session.cookie_samesite] = Strict +;HTTPSONLY php_admin_value[session.cookie_secure] = 1 + +pm = dynamic +pm.max_children = 30 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 5 +chdir = / +env[HOSTNAME] = $HOSTNAME +env[PATH] = /usr/local/bin:/usr/bin:/bin +env[TMP] = /tmp +env[TMPDIR] = /tmp +env[TEMP] = /tmp \ No newline at end of file diff --git a/CT-Files/nextcloud/Scripts/FirstRun.sh b/CT-Files/nextcloud/Scripts/FirstRun.sh new file mode 100644 index 0000000..34605de --- /dev/null +++ b/CT-Files/nextcloud/Scripts/FirstRun.sh @@ -0,0 +1,41 @@ +#!/bin/ash +#UserSettings +ThisScriptConfigured=no +## Nextcloud Admin user +NextcloudUsername= +NexcloudPassword= +##Nextcloud +NextcloudWebProto=http +##DB +MysqlIP=127.0.0.1 +MysqlPort=3306 +MysqlUsername=nextcloud +MysqlDatabase=nextcloud +MysqlPassword= + +#Check if script is configured +if [ $ThisScriptConfigured = no ]; then + echo "Script is not configured" + exit +fi +sudo -u nginx php8 /opt/nextcloud/occ maintenance:install --database mysql --database-name "$MysqlDatabase" --database-host "$MysqlIP" --database-port "$MysqlPort" --database-user "$MysqlUsername" --database-pass "$MysqlPassword" --database-table-space "" --admin-user "$NextcloudUsername" --admin-pass "$NexcloudPassword" --data-dir /var/nextcloud + +sed -n -i '/#SetupBlockStart/{:a;N;/#SetupBlockEnd/!ba;N;s/.*//};p' /etc/nginx/nginx.conf +service nginx reload + +sudo -u nginx php8 /opt/nextcloud/occ db:convert-filecache-bigint +sudo -u nginx php8 /opt/nextcloud/occ db:add-missing-indices +sudo -u nginx php8 /opt/nextcloud/occ app:disable firstrunwizard +sudo -u nginx php8 /opt/nextcloud/occ config:system:set default_language --value=nl +sudo -u nginx php8 /opt/nextcloud/occ config:system:set default_locale --value=nl +sudo -u nginx php8 /opt/nextcloud/occ config:system:set default_phone_region --value=nl +sudo -u nginx php8 /opt/nextcloud/occ config:system:set skeletondirectory --value= +sudo -u nginx php8 /opt/nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\APCu' +sudo -u nginx php8 /opt/nextcloud/occ config:system:set trashbin_retention_obligation --value=30,30 +sudo -u nginx php8 /opt/nextcloud/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis' +sudo -u nginx php8 /opt/nextcloud/occ config:system:set memcache.locking --value='\OC\Memcache\Redis' +sudo -u nginx php8 /opt/nextcloud/occ config:system:set redis host --value=localhost +sudo -u nginx php8 /opt/nextcloud/occ config:system:set redis port --value=6379 +sudo -u nginx php8 /opt/nextcloud/occ config:system:set trusted_domains 1 --value="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" +sudo -u nginx php8 /opt/nextcloud/occ config:system:set overwrite.cli.url --value="$NextcloudWebProto://$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" +sudo -u nginx php8 /opt/nextcloud/occ config:system:set overwriteprotocol --value="$NextcloudWebProto" \ No newline at end of file diff --git a/CT-Files/nextcloud/Scripts/Init.sh b/CT-Files/nextcloud/Scripts/Init.sh new file mode 100644 index 0000000..2b31e05 --- /dev/null +++ b/CT-Files/nextcloud/Scripts/Init.sh @@ -0,0 +1,28 @@ +#!/bin/ash +#Setup Nginx repo +echo "@nginx http://nginx.org/packages/mainline/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories +mv /opt/Setup/nginx_signing.rsa.pub /etc/apk/keys/nginx_signing.rsa.pub + +#Install Nginx +apk add nginx@nginx + +#Configure Nginx +rm -rf /etc/nginx/conf.d +mv /opt/Setup/Configs/nginx.conf /etc/nginx/nginx.conf + +#Configure Php-Fpm +rm -rf /etc/php8/php-fpm.d/* +mv /opt/Setup/Configs/php.conf /etc/php8/php-fpm.d/nextcloud.conf + +#Install Nextcloud +mkdir /opt/nextcloud /var/nextcloud +tar jxf /opt/Setup/nextcloud.tar.bz2 -C /opt/nextcloud --strip 1 +rm -rf /opt/Setup/nextcloud.tar.bz2 +chown -R nginx:nginx /opt/nextcloud +chown -R nginx:nginx /var/nextcloud +echo "*/5 * * * * php8 -f /opt/nextcloud/cron.php > /dev/null 2>&1" >> /etc/crontabs/nginx +echo "apc.enable_cli=1" >> /etc/php8/php.ini +#Enable services on boot +rc-update add nginx +rc-update add php-fpm8 +rc-update add redis \ No newline at end of file diff --git a/CT-Files/nodered/Scripts/Init.sh b/CT-Files/nodered/Scripts/Init.sh new file mode 100644 index 0000000..3629965 --- /dev/null +++ b/CT-Files/nodered/Scripts/Init.sh @@ -0,0 +1,24 @@ +#!/bin/ash +#Run folowing commands as 'node' user +sudo -u node ash << EOF +#Install nodered +mkdir -p /opt/node/node-red/app +npm install --prefix /opt/node/node-red/app node-red @node-red-contrib-themes/midnight-red +##Add to startup + + +#Save PM2 statup config +pm2 start --name nodered --cwd /opt/node/node-red/app ./node_modules/node-red/red.js -- -u /opt/node/node-red/data +pm2 save +pm2 kill +#Enable node-red dark theme +sed -i -e 's#//theme: "",#theme: "midnight-red",#g' /opt/node/node-red/data/settings.js +#Disable Node-red flow encription +sed -i -e 's#//credentialSecret: "a-secret-key",#credentialSecret: false,#g' /opt/node/node-red/data/settings.js +EOF + +#Adding update scipt +mv /opt/Setup/Configs/Scripts/Update-NodeRed.sh /opt/Update-NodeRed.sh + +#Cleanup +rm -rf /home/node/.npm/_cacache \ No newline at end of file diff --git a/CT-Files/nodered/Scripts/Update-NodeRed.sh b/CT-Files/nodered/Scripts/Update-NodeRed.sh new file mode 100644 index 0000000..c03e285 --- /dev/null +++ b/CT-Files/nodered/Scripts/Update-NodeRed.sh @@ -0,0 +1,9 @@ +#!/bin/ash +#Run folowing commands as 'node' user +sudo -u node ash << EOF +pm2 stop nodered +npm install --prefix /opt/node/node-red/app node-red @node-red-contrib-themes/midnight-red +npm update --prefix /opt/node/node-red/app +pm2 start nodered +EOF + diff --git a/CT-Files/z2mqtt/Scripts/Init.sh b/CT-Files/z2mqtt/Scripts/Init.sh new file mode 100644 index 0000000..08ca3ce --- /dev/null +++ b/CT-Files/z2mqtt/Scripts/Init.sh @@ -0,0 +1,32 @@ +#!/bin/ash +#Install Yarn Globaly for zwavejs2mqtt +npm install -g yarn + +#Run folowing commands as 'node' user +sudo -u node ash << EOF +#Install zigbee2mqtt +git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/node/zigbee2mqtt +npm --prefix /opt/node/zigbee2mqtt ci +##Update config +sed -i -e '/port:/c\ port: \/dev\/ttyACM-Zigbee' /opt/node/zigbee2mqtt/data/configuration.yaml +printf "frontend:\n port: 5002" >> /opt/node/zigbee2mqtt/data/configuration.yaml + +#Install zwavejs2mqtt +git clone https://github.com/zwave-js/zwavejs2mqtt /opt/node/zwavejs2mqtt +yarn --cwd /opt/node/zwavejs2mqtt install +yarn --cwd /opt/node/zwavejs2mqtt run build + +#Save PM2 statup config +pm2 start npm --name zigbee2mqtt --cwd /opt/node/zigbee2mqtt -- start +pm2 start yarn --name zwavejs2mqtt --cwd /opt/node/zwavejs2mqtt -- start +pm2 save +pm2 kill +EOF + +#Adding update scipts +mv /opt/Setup/Scripts/Update-Zigbee2Mqtt.sh /opt/Update-Zigbee2Mqtt.sh +mv /opt/Setup/Scripts/Update-Zwave2mqtt.sh /opt/Update-Zwave2Mqtt.sh + +#Cleanup +rm -rf /home/node/.npm/_cacache +rm -rf /home/node/.cache \ No newline at end of file diff --git a/CT-Files/z2mqtt/Scripts/Update-Zigbee2Mqtt.sh b/CT-Files/z2mqtt/Scripts/Update-Zigbee2Mqtt.sh new file mode 100644 index 0000000..0bb49be --- /dev/null +++ b/CT-Files/z2mqtt/Scripts/Update-Zigbee2Mqtt.sh @@ -0,0 +1,10 @@ +#!/bin/ash + + +#Run folowing commands as 'node' user +sudo -u node ash << EOF +pm2 stop zigbee2mqtt +cd /opt/node/zigbee2mqtt +ash update.sh +pm2 start zigbee2mqtt +EOF \ No newline at end of file diff --git a/CT-Files/z2mqtt/Scripts/Update-Zwave2mqtt.sh b/CT-Files/z2mqtt/Scripts/Update-Zwave2mqtt.sh new file mode 100644 index 0000000..833f07e --- /dev/null +++ b/CT-Files/z2mqtt/Scripts/Update-Zwave2mqtt.sh @@ -0,0 +1,11 @@ +#!/bin/ash + +#Run folowing commands as 'node' user +sudo -u node ash << EOF +pm2 stop zwavejs2mqtt +cd /opt/node/zwavejs2mqtt +git pull +yarn install +yarn run build +pm2 start zwavejs2mqtt +EOF \ No newline at end of file diff --git a/Readme.md b/Readme.md index 45bf113..29a2932 100644 --- a/Readme.md +++ b/Readme.md @@ -33,29 +33,33 @@ This can be done on a Minimal debian CT (make sure to enable nesting) on the new | ddns | Alpine | DDNS client configured for OVH/OVH-Cloud | | transfersh | Alpine | transfer.sh instance | | iscsi | Alpine | iSCSI server | +| z2mqtt | Alpine | Mqtt bridges for Zigbee and ZWave | +| nodered | Alpine | Node-Red | +| nodejs | Alpine | Basic nodejs install with pm2 | ## TODO **Begin original list** -Hass+Mqtt -Z2mqtt+zw2mqtt -SMB +Hass +Mqtt + +SMB -Nextcloud +Nextcloud -AptCacherNG -NodeRed +AptCacherNG + + +~Unifi~ Not supported in debian 11 -~Unifi~ Not supported in debian 11 -Docker MailBackup* -~FileShelter~ Not supported in debian 11 /transfer.sh As alternative +~FileShelter~ Not supported in debian 11 /transfer.sh As alternative WS(x2go-xfce) **End original list** @@ -93,13 +97,13 @@ Then select the created credential and click save ## colabora * Update the configuration in /etc/loolwsd/loolwsd.xml and reload the service `systemctl restart loolwsd` ## jellyfin -* To set-up the system follow the inital set-up wizard on http://:8096 +* To set-up the system follow the inital set-up wizard on http://``:8096 ## domoticz -* Avalible on http://:8080 +* Avalible on http://``:8080 ## transfersh -* Avalible on http://:8080 +* Avalible on http://``:8080 ## omadaV3 -* To set-up the system follow the inital set-up wizard on http://:8088 +* To set-up the system follow the inital set-up wizard on http://``:8088 ## docker * Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh` This container can be set up in two ways @@ -113,7 +117,7 @@ This container can be set up in two ways modprobe target_core_mod printf "#Load iSCSI module at boot\ntarget_core_mod" > /etc/modules-load.d/iSCSI-target.conf ``` -* Add the following to /etc/pve/lxc/.conf +* Add the following to /etc/pve/lxc/``.conf ``` lxc.apparmor.profile: unconfined ``` @@ -127,6 +131,43 @@ create exit ``` +## z2mqtt +**Do not start this container after cration, follow these steps first** +* Recomended to give CT 1-2GB of RAM (Required for updating) +### In Proxmox +* Add the folling to `/etc/udev/rules.d/99-CustomHome.rules` +``` +KERNEL=="ttyUSB[0-9]*", MODE="0666" +KERNEL=="ttyACM[0-9]*", MODE="0666" + +SUBSYSTEM=="tty", ACTION=="change", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="ttyACM-Zigbee" +SUBSYSTEM=="tty", ACTION=="add", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="ttyACM-Zigbee" + +SUBSYSTEM=="tty", ACTION=="change", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyACM-Zwave" +SUBSYSTEM=="tty", ACTION=="add", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyACM-Zwave" +``` +* Run `udevadm trigger` +* Add the folling to /etc/pve/lxc/``.conf +``` +lxc.cgroup2.devices.allow: c 166:* rwm +lxc.mount.entry: /dev/ttyACM-Zigbee dev/ttyACM-Zigbee none bind,optional,create=file +lxc.mount.entry: /dev/ttyACM-Zwave dev/ttyACM-Zwave none bind,optional,create=file +``` +* Zigbee2mqtt avalible on http://``:5002 +* ZWave2mqtt avalible on http://``:8091 +* in the ZWave2mqtt web ui set the Zwave serial port to /dev/ttyACM-Zwave +* If a `Cannot lock port` error shows, please reboot the CT, if that does not fix it try rebooting the Proxmox server + +## nodered +* Avalible on http://``:1880 + +## nextcloud +**MountPoint for data folder `/var/nextcloud`** +1. Edit the parameters in the FistRun script in the container `vi /opt/Setup/Scripts/FirstRun.sh` +2. Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh` +3. Avalible on http://`` + + # Further CT documentation ## iscsi @@ -143,17 +184,17 @@ exit ### Add Drive #### In Proxmox -* Create LVM Volume (Avalible @ /dev//) +* Create LVM Volume (Avalible @ /dev/``/``) ``` lvcreate --name --size G ``` -* Create ZFS Volume (Avalible @ /dev//) +* Create ZFS Volume (Avalible @ /dev/``/``) ``` zfs create -o volblocksize=32k -V G / zfs set sync=disabled / ``` -* Get id by using ls -l /dev/ -* Add the folling to /etc/pve/lxc/.conf +* Get id by using ls -l /dev/`` +* Add the folling to /etc/pve/lxc/``.conf ``` lxc.cgroup2.devices.allow: b : rwm lxc.mount.entry: /dev/ dev/ none bind,optional,create=file diff --git a/Scripts/GetExternalResources.sh b/Scripts/GetExternalResources.sh index 6476482..59481d5 100644 --- a/Scripts/GetExternalResources.sh +++ b/Scripts/GetExternalResources.sh @@ -21,4 +21,6 @@ echo "transfershVersion=$transfershVersion" > CT-Files/transfersh/transfershVers GetResource transfersh transfersh-linux-amd64 https://github.com/dutchcoders/transfer.sh/releases/download/"$transfershVersion"/transfersh-"$transfershVersion"-linux-amd64 #ForFutureDarkTheme#GetResource transfersh CustomTheme.tar.gz https://git.bprieshof.nl/attachments/e014dc2e-8b43-48bb-a771-da34e4d6fdef -GetResource omadaV3 omada.deb https://static.tp-link.com/2020/202012/20201225/Omada_v3.2.14_linux_x64.deb \ No newline at end of file +GetResource omadaV3 omada.deb https://static.tp-link.com/2020/202012/20201225/Omada_v3.2.14_linux_x64.deb +GetResource nextcloud nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub +GetResource nextcloud nextcloud.tar.bz2 https://download.nextcloud.com/server/releases/latest.tar.bz2 \ No newline at end of file