Server scripts

This commit is contained in:
Martin Bauer 2021-09-11 10:18:47 +02:00
parent f1d104a224
commit 2a251d2700
15 changed files with 175 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
ve_*
/server/scripts/docker-images/tagspace/tagspaces
/server/scripts/docker-images/tagspace/*.zip
*.img

6
server/readme.md Normal file
View File

@ -0,0 +1,6 @@
Select Boot device
==================
Bios accessible using [F2]

View File

@ -0,0 +1 @@
docker run -d --restart=always --name home_influx -p 8086:8086 -v /volumes/influxdb_data/:/var/lib/influxdb influxdb

View File

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

View File

@ -0,0 +1,10 @@
server {
listen 80;
server_name "";
root /var/www/;
location / {
index index.html;
}
}

View File

@ -0,0 +1,6 @@
/root/scripts
/etc/nginx/sites-enabled/reverse-proxy
/etc/letsencrypt/
/etc/samba/smb.conf
/etc/environment

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

22
server/scripts/rsync_to_disk.sh Executable file
View File

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

49
server/scripts/squid.conf Normal file
View File

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