diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..db2a792 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +ve_* +/server/scripts/docker-images/tagspace/tagspaces +/server/scripts/docker-images/tagspace/*.zip +*.img \ No newline at end of file diff --git a/server/readme.md b/server/readme.md new file mode 100644 index 0000000..c5f6472 --- /dev/null +++ b/server/readme.md @@ -0,0 +1,6 @@ + +Select Boot device +================== + +Bios accessible using [F2] + diff --git a/server/scripts/docker-images/influxdb.run b/server/scripts/docker-images/influxdb.run new file mode 100644 index 0000000..6ebbde0 --- /dev/null +++ b/server/scripts/docker-images/influxdb.run @@ -0,0 +1 @@ +docker run -d --restart=always --name home_influx -p 8086:8086 -v /volumes/influxdb_data/:/var/lib/influxdb influxdb diff --git a/server/scripts/docker-images/tagspace/Dockerfile b/server/scripts/docker-images/tagspace/Dockerfile new file mode 100644 index 0000000..a628679 --- /dev/null +++ b/server/scripts/docker-images/tagspace/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu +MAINTAINER "Martin Bauer" + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update +RUN apt-get upgrade -y && apt-get install -y nginx + +ADD tagspaces /var/www/ + +RUN echo "daemon off;" >> /etc/nginx/nginx.conf +RUN rm /etc/nginx/sites-enabled/* +ADD nginx.conf /etc/nginx/conf.d/tagspaces.conf + +CMD nginx + + diff --git a/server/scripts/docker-images/tagspace/nginx.conf b/server/scripts/docker-images/tagspace/nginx.conf new file mode 100644 index 0000000..58b10d5 --- /dev/null +++ b/server/scripts/docker-images/tagspace/nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + server_name ""; + root /var/www/; + + location / { + index index.html; + } +} + diff --git a/server/scripts/files_to_backup.txt b/server/scripts/files_to_backup.txt new file mode 100644 index 0000000..15b2160 --- /dev/null +++ b/server/scripts/files_to_backup.txt @@ -0,0 +1,6 @@ +/root/scripts +/etc/nginx/sites-enabled/reverse-proxy +/etc/letsencrypt/ +/etc/samba/smb.conf +/etc/environment + diff --git a/server/scripts/make_btrfs_snapshots.sh b/server/scripts/make_btrfs_snapshots.sh new file mode 100755 index 0000000..41a19a1 --- /dev/null +++ b/server/scripts/make_btrfs_snapshots.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +BASE=/media/passport4/ +TARGET=/media/passport4/snapshots + +DATE=`date +%F` + +btrfs subvolume snapshot -r $BASE/main_data $TARGET/main_data/$DATE +btrfs subvolume snapshot -r $BASE/films_and_software $TARGET/films_and_software/$DATE +btrfs subvolume snapshot -r $BASE/docker_volume_backup $TARGET/docker_volume_backup/$DATE + diff --git a/server/scripts/renew_certificates.sh b/server/scripts/renew_certificates.sh new file mode 100755 index 0000000..c516783 --- /dev/null +++ b/server/scripts/renew_certificates.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# certificate obtained with +#letsencrypt certonly --standalone -d home.bauer.tech + +service nginx stop +sleep 30 +letsencrypt renew +service nginx start diff --git a/server/scripts/restart_home_dbs.sh b/server/scripts/restart_home_dbs.sh new file mode 100755 index 0000000..9aa544a --- /dev/null +++ b/server/scripts/restart_home_dbs.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + +echo "-------- InfluxDB ------------" +docker pull influxdb +docker rm -f home_influx +docker run -d --restart=always --name home_influx -p 8086:8086 -v /volumes/influxdb_data/:/var/lib/influxdb influxdb + +echo "------- MongoDB ------------" +docker pull mongo:4 +docker rm -f homemongo +docker run --restart=always --name homemongo -p 27017:27017 -v /volumes/mongo/:/data/db -d mongo:4 + +echo "------ Grafana -------------" +docker pull grafana/grafana +docker rm -f grafana +docker run --restart=always -d --name=grafana -p 3000:3000 -v /volumes/grafana:/var/lib/grafana grafana/grafana diff --git a/server/scripts/restart_owncloud.sh b/server/scripts/restart_owncloud.sh new file mode 100755 index 0000000..5db07c8 --- /dev/null +++ b/server/scripts/restart_owncloud.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +docker pull owncloud +docker rm -f owncloud +docker run -d --restart=always --name=owncloud -v /volumes/owncloud/apps:/var/www/html/apps -v /volumes/owncloud/config:/var/www/html/config -v /volumes/owncloud/data:/var/www/html/data -p 5555:80 owncloud + diff --git a/server/scripts/restart_smarthome.sh b/server/scripts/restart_smarthome.sh new file mode 100755 index 0000000..e01da22 --- /dev/null +++ b/server/scripts/restart_smarthome.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker rm -f mypysmarthome +docker run -d --restart=always --privileged -v /dev/serial/by-id/usb-busware.de_CUL868-if00:/dev/ttyACM0 -p 0.0.0.0:51826:51826 -p 0.0.0.0:7072:7072 -p 0.0.0.0:6720:6720 -p 0.0.0.0:2222:2222 -p 0.0.0.0:8080:8080 --net=host --name=mypysmarthome pysmarthome diff --git a/server/scripts/restart_squeezeserver.sh b/server/scripts/restart_squeezeserver.sh new file mode 100755 index 0000000..0dce5bd --- /dev/null +++ b/server/scripts/restart_squeezeserver.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# To build +# cd /root/scripts/docker-images/squeezeserver +# docker build -t squeezeserver791 . + +docker rm -f squeezeserver +docker run -d --name squeezeserver --restart=always -p 9090:9090 -p 9000:9000 -p 3483:3483 -p 3483:3483/udp -v /volumes/squeezeserver/state/:/mnt/state -v /volumes/squeezeserver/music/:/home/martin/Musik -v /volumes/squeezeserver/playlists/:/home/martin/Playlists squeezeserver791 diff --git a/server/scripts/restart_squid_proxy.sh b/server/scripts/restart_squid_proxy.sh new file mode 100755 index 0000000..46da145 --- /dev/null +++ b/server/scripts/restart_squid_proxy.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +docker pull sameersbn/squid +docker rm -f squid +docker run --name squid -d --restart=always --publish 3128:3128 --volume /volumes/squid:/var/spool/squid --volume /root/scripts/squid.conf:/etc/squid/squid.conf sameersbn/squid + diff --git a/server/scripts/rsync_to_disk.sh b/server/scripts/rsync_to_disk.sh new file mode 100755 index 0000000..c542bc0 --- /dev/null +++ b/server/scripts/rsync_to_disk.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +SRC=/volumes +DST=/media/passport4/docker_volume_backup/ + +echo "Owncloud Backup" +rsync -azW --delete $SRC/owncloud $DST + +echo "Squeezebox Music Backup" +rsync -azW --delete $SRC/squeezeserver $DST + +echo "MongoDB Homeautomation Backup" +rsync -azW --delete $SRC/mongo $DST + +echo "InfluxDB Homeautomation Backup" +rsync -azW --delete $SRC/influxdb_data $DST + +echo "WWW" +rsync -azW --delete $SRC/www $DST + +echo "Other files" +rsync -arW --delete --files-from=/root/scripts/files_to_backup.txt / $DST/other diff --git a/server/scripts/squid.conf b/server/scripts/squid.conf new file mode 100644 index 0000000..7dcb82f --- /dev/null +++ b/server/scripts/squid.conf @@ -0,0 +1,49 @@ +# ----------------- Default from https://gist.github.com/hpcorona/5065634 ---------- + +#Recommended minimum configuration: +acl manager proto cache_object +acl localhost src 127.0.0.1/32 +acl to_localhost dst 127.0.0.0/8 +acl localnet src 0.0.0.0/8 192.168.178.0/24 +acl SSL_ports port 443 +acl Safe_ports port 80 # http +acl Safe_ports port 21 # ftp +acl Safe_ports port 443 # https +acl Safe_ports port 70 # gopher +acl Safe_ports port 210 # wais +acl Safe_ports port 1025-65535 # unregistered ports +acl Safe_ports port 280 # http-mgmt +acl Safe_ports port 488 # gss-http +acl Safe_ports port 591 # filemaker +acl Safe_ports port 777 # multiling http + +acl CONNECT method CONNECT + +http_access allow manager localhost +http_access deny manager +http_access deny !Safe_ports + +icp_access deny all +htcp_access deny all + +http_port 3128 +hierarchy_stoplist cgi-bin ? + + +#Suggested default: +refresh_pattern ^ftp: 1440 20% 10080 +refresh_pattern ^gopher: 1440 0% 1440 +refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 +refresh_pattern . 0 20% 4320 +# Leave coredumps in the first cache dir +coredump_dir /var/spool/squid3 + +# Allow all machines to all sites +http_access allow all + + +# ------------ Custom stuff -------------------------------- +cache_mem 512 MB # RAM usage +cache_dir aufs /var/spool/squid 200000 16 256 # 200 GB cache +maximum_object_size 5120 MB # dont store objects larger than 5 GB +