Merge pull request 'main' (#1) from colin-admin/server-config:main into main

Reviewed-on: #1
This commit is contained in:
colin
2023-04-17 04:10:43 +00:00
16 changed files with 120 additions and 80 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
nginx-reverse-proxy/ssl nginx-reverse-proxy/ssl
bitwarden/data bitwarden/data
vaultwarden/data
web/** web/**
!web/blog !web/blog
web/blog/** web/blog/**

7
README.md Normal file
View File

@@ -0,0 +1,7 @@
# Steps to reinstall
- Clone this repo onto new server
- Run light-install.sh
- Update the hosts file as mentioned in the output of the light-install
- Run start.sh
That should do it.

View File

@@ -7,7 +7,7 @@ networks:
services: services:
server: server:
image: gitea/gitea:1.13.6 image: gitea/gitea:latest
container_name: gitea container_name: gitea
environment: environment:
- USER_UID=1000 - USER_UID=1000

View File

@@ -1,18 +0,0 @@
version: '3'
services:
homeassistant:
image: homeassistant/raspberrypi4-homeassistant:stable
container_name: homeassistant
restart: unless-stopped
expose:
- '8123'
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config:/config
networks:
- homeassistant
networks:
homeassistant:
external:
name: homeassistant

View File

@@ -23,9 +23,8 @@ echo ">>Done"
echo "Don't forget to edit /etc/hosts to add the new sites echo "Don't forget to edit /etc/hosts to add the new sites
172.31.30.78 blog 172.31.30.78 blog
172.31.30.78 bitwarden 172.31.30.78 vaultwarden
172.31.30.78 gitea 172.31.30.78 gitea
172.31.30.78 motioneye
172.31.30.78 homeassistant" 172.31.30.78 homeassistant"
echo "Also, get the blog code deployed to the git instance and pull it back down here to get the blog running." echo "Also, get the blog code deployed to the git instance and pull it back down here to get the blog running."
echo "The blog is tricky, because it needs the theme to work, don't forget to clone that as well." echo "The blog is tricky, because it needs the theme to work, don't forget to clone that as well."

View File

@@ -1,22 +0,0 @@
version: "3.5"
services:
motioneye:
image: ccrisan/motioneye:master-armhf
container_name: motioneye
networks:
- motioneye
expose:
- "8081"
- "8765"
volumes:
- etc_motioneye:/etc/motioneye
- var_lib_motioneye:/var/lib/motioneye
volumes:
etc_motioneye:
var_lib_motioneye:
networks:
motioneye:
external:
name: motioneye

8
my_services.service Normal file
View File

@@ -0,0 +1,8 @@
[Unit]
Description=Launch Service for my self-hosted services.
[Service]
ExecStart=/home/ubuntu/start.sh &
[Install]
WantedBy=multi-user.target

View File

@@ -2,5 +2,6 @@
<head><title>Proxy Backend Not Found</title></head> <head><title>Proxy Backend Not Found</title></head>
<body > <body >
<h2>Proxy Backend Not Found</h2> <h2>Proxy Backend Not Found</h2>
<p>This is a test.</p>
</body> </body>
</html> </html>

View File

@@ -30,7 +30,7 @@ include /etc/nginx/includes/ssl.conf;
location / { location / {
include /etc/nginx/includes/proxy.conf; include /etc/nginx/includes/proxy.conf;
proxy_pass http://bitwarden; proxy_pass http://vaultwarden;
} }
access_log /var/log/nginx/bitwarden-access.log combined; access_log /var/log/nginx/bitwarden-access.log combined;
@@ -55,18 +55,18 @@ error_log /var/log/nginx/gitea-error.log error;
} }
# Motioneye config # Motioneye config
server { # server {
listen 80; # listen 80;
server_name eye.colindiem.com; # server_name eye.colindiem.com;
location / { # location / {
include /etc/nginx/includes/proxy.conf; # include /etc/nginx/includes/proxy.conf;
proxy_pass http://motioneye:8765; # proxy_pass http://motioneye:8765;
} # }
access_log /var/log/nginx/motioneye-access.log combined; # access_log /var/log/nginx/motioneye-access.log combined;
error_log /var/log/nginx/motioneye-error.log error; # error_log /var/log/nginx/motioneye-error.log error;
} # }
# Nextcloud config # Nextcloud config
server { server {
@@ -102,20 +102,75 @@ server {
include /etc/nginx/includes/proxy.conf; include /etc/nginx/includes/proxy.conf;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade"; proxy_set_header Connection "Upgrade";
proxy_pass http://homeassistant:8123; proxy_pass http://192.168.1.204:8123;
} }
location /api/websocket { location /api/websocket {
include /etc/nginx/includes/proxy.conf; include /etc/nginx/includes/proxy.conf;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade"; proxy_set_header Connection "Upgrade";
proxy_pass http://homeassistant:8123/api/websocket; proxy_pass http://192.168.1.204:8123/api/websocket;
} }
access_log /var/log/nginx/ha-access.log; access_log /var/log/nginx/ha-access.log;
error_log /var/log/nginx/ha-error.log; error_log /var/log/nginx/ha-error.log;
} }
# Foundry config
server {
listen 80;
listen 443;
server_name foundry.colindiem.com;
location / {
include /etc/nginx/includes/proxy.conf;
proxy_pass http://192.168.1.249:40001;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
access_log /var/log/nginx/foundry-access.log combined;
error_log /var/log/nginx/foundry-error.log error;
}
# Bookstack config
server {
listen 80;
listen 443;
server_name wiki.colindiem.com;
location / {
include /etc/nginx/includes/proxy.conf;
proxy_pass http://192.168.1.204:2665;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
access_log /var/log/nginx/wikiaccess.log combined;
error_log /var/log/nginx/wiki-error.log error;
}
# Minecraft server config
server {
listen 80;
listen 443;
server_name mc.colindiem.com;
location / {
include /etc/nginx/includes/proxy.conf;
proxy_pass http://192.168.1.249:25565;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
access_log /var/log/nginx/minecraft_access.log combined;
error_log /var/log/nginx/minecraft_error.log error;
}
# Default # Default
server { server {
listen 80 default_server; listen 80 default_server;

View File

@@ -2,10 +2,11 @@ version: '2'
services: services:
proxy: proxy:
container_name: rev-proxy container_name: rev-proxy
restart: unless-stopped
build: ./ build: ./
networks: networks:
- blog - blog
- bitwarden - vaultwarden
- gitea - gitea
- motioneye - motioneye
- homeassistant - homeassistant
@@ -17,9 +18,9 @@ networks:
blog: blog:
external: external:
name: blog_default name: blog_default
bitwarden: vaultwarden:
external: external:
name: bitwarden_default name: vaultwarden_default
gitea: gitea:
external: external:
name: gitea name: gitea
@@ -28,4 +29,4 @@ networks:
name: motioneye name: motioneye
homeassistant: homeassistant:
external: external:
name: homeassistant name: homeassistant

View File

@@ -1,6 +1,6 @@
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off; proxy_buffering off;
proxy_request_buffering off; proxy_request_buffering off;

19
reboot.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
clear
cd /home/ubuntu/
cd vaultwarden/
docker-compose up -d
cd /home/ubuntu/
cd gitea/
docker-compose up -d
cd /home/ubuntu/
cd web/blog/
docker-compose up -d
cd /home/ubuntu/
cd nginx-reverse-proxy/
docker-compose up -d
cd /home/ubuntu/

View File

@@ -7,8 +7,8 @@ cd nginx-reverse-proxy/
docker-compose build docker-compose build
cd /home/ubuntu/ cd /home/ubuntu/
echo "Starting Bitwarden..." echo "Starting Vaultwarden..."
cd bitwarden/ cd vaultwarden/
docker-compose up -d docker-compose up -d
cd /home/ubuntu/ cd /home/ubuntu/
echo "Done" echo "Done"
@@ -19,24 +19,12 @@ docker-compose up -d
cd /home/ubuntu/ cd /home/ubuntu/
echo "Done" echo "Done"
echo "Starting MotionEye..."
cd motioneye/
docker-compose up -d
cd /home/ubuntu/
echo "Done"
echo "Starting blog..." echo "Starting blog..."
cd web/blog/ cd web/blog/
docker-compose up -d docker-compose up -d
cd /home/ubuntu/ cd /home/ubuntu/
echo "Done" echo "Done"
echo "Starting Home Assistant..."
cd homeassistant/
docker-compose up -d
cd /home/ubuntu/
echo "Done"
echo "Starting reverse proxy..." echo "Starting reverse proxy..."
cd nginx-reverse-proxy/ cd nginx-reverse-proxy/
docker-compose up -d docker-compose up -d

View File

@@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
echo "Stopping all of the containers" echo "Stopping all of the containers"
docker stop bitwarden motioneye gitea gitea_db_1 blog homeassistant rev-proxy docker stop vaultwarden gitea gitea_db_1 blog rev-proxy

View File

@@ -1,13 +1,13 @@
version: '3' version: '3'
services: services:
bitwarden: vaultwarden:
container_name: bitwarden container_name: vaultwarden
image: bitwardenrs/server image: vaultwarden/server
restart: always restart: always
volumes: volumes:
- ./data:/data - ./data:/data
expose: expose:
- '80' - 80
environment: environment:
WEBSOCKET_ENABLED: 'true' WEBSOCKET_ENABLED: 'true'
SIGNUPS_ALLOWED: 'true' SIGNUPS_ALLOWED: 'true'

View File

@@ -3,6 +3,7 @@ version: "3.3"
services: services:
blog: blog:
container_name: blog container_name: blog
restart: unless-stopped
image: nginx:1.16.0-alpine image: nginx:1.16.0-alpine
volumes: volumes:
- "./public:/usr/share/nginx/html/" - "./public:/usr/share/nginx/html/"