Add openSSH, fix perms volumes, improve homepage, rework makefile

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
Bensuperpc 2024-09-09 21:49:42 +02:00
parent 811f6ac7bb
commit 4818e18842
20 changed files with 212 additions and 115 deletions

View File

@ -16,11 +16,11 @@ DOCKER := docker
BLOG_SERVICES := wordpress
TORRENTS_SERVICES := qbittorrent transmission
SHARING_SERVICES := psitransfer picoshare privatebin projectsend jellyfin dufs gitea syncthing
ADMIN_SERVICES := yacht uptime-kuma adminer
ADMIN_SERVICES := yacht uptime-kuma adminer openssh
UTILS_SERVICES := it-tools stirlingpdf
# gitea-runner
PROFILES := caddy homepage $(BLOG_SERVICES) $(SHARING_SERVICES) $(TORRENTS_SERVICES) $(ADMIN_SERVICES) $(UTILS_SERVICES)
PROFILES := main_infrastructure caddy homepage $(BLOG_SERVICES) $(SHARING_SERVICES) $(TORRENTS_SERVICES) $(ADMIN_SERVICES) $(UTILS_SERVICES)
PROFILE_CMD := $(addprefix --profile ,$(PROFILES))
COMPOSE_FILES := $(shell find . -name 'docker-compose*.yml' -type f | sed -e 's/^/--file /')
@ -31,47 +31,49 @@ GID := 1000
ENV_ARG_VAR := PUID=$(UID) PGID=$(GID)
DOCKER_COMPOSE_COMMAND := $(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD)
.PHONY: build all
all: start
.PHONY: build
build:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) build
$(DOCKER_COMPOSE_COMMAND) build
.PHONY: start
start:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) up -d
$(DOCKER_COMPOSE_COMMAND) up -d
.PHONY: start-at
start-at:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) up
$(DOCKER_COMPOSE_COMMAND) up
.PHONY: docker-check
docker-check:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) config
$(DOCKER_COMPOSE_COMMAND) config
.PHONY: stop
stop: down
.PHONY: down
down:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) down
$(DOCKER_COMPOSE_COMMAND) down
.PHONY: restart
restart: stop start
.PHONY: logs
logs:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) logs
$(DOCKER_COMPOSE_COMMAND) logs
.PHONY: state
state:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) ps
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) top
$(DOCKER_COMPOSE_COMMAND) ps
$(DOCKER_COMPOSE_COMMAND) top
.PHONY: update-docker
update-docker:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) pull
$(DOCKER_COMPOSE_COMMAND) pull
.PHONY: update
update: update-docker
@ -80,8 +82,8 @@ update: update-docker
.PHONY: clean
clean:
$(ENV_ARG_VAR) $(DOCKER) images --filter=reference='bensuperpc/*' --format='{{.Repository}}:{{.Tag}}' | xargs -r $(DOCKER) rmi -f
docker system prune -f
.PHONY: purge
purge:
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) down -v --rmi all
$(ENV_ARG_VAR) $(DOCKER) compose $(COMPOSE_DIR) $(COMPOSE_FILES) down -v --rmi all

View File

@ -27,6 +27,8 @@ If you have any **questions** or **suggestions**, feel free to open an issue or
## Screenshots
![astar](resources/homepagev1.jpg)
## Installation and configuration
### Requirements
@ -67,6 +69,7 @@ And then, caddy will generate the certificate for you and renew it automatically
| Domain name | Type | Description |
| --- | --- | --- |
| [bensuperpc.org](https://bensuperpc.org) | Main | Redirect to www.bensuperpc.org |
| [www.bensuperpc.org](https://www.bensuperpc.org) | Main | Homepage |
| [wordpress.bensuperpc.org](https://wordpress.bensuperpc.org) | Sub | Wordpress website |
| [adminer.bensuperpc.org](https://adminer.bensuperpc.org) | Sub | Adminer for MariaDB for wordpress only |
@ -84,10 +87,10 @@ And then, caddy will generate the certificate for you and renew it automatically
| [projectsend.bensuperpc.org](https://projectsend.bensuperpc.org) | Sub | ProjectSend for file sharing |
| [picoshare.bensuperpc.org](https://picoshare.bensuperpc.org) | Sub | Picoshare for file sharing |
| [dufs.bensuperpc.org](https://dufs.bensuperpc.org) | Sub | Dufs for file sharing |
| bensuperpc.com | Main | Redirect to bensuperpc.org |
| bensuperpc.fr | Main | Redirect to bensuperpc.org |
| bensuperpc.net | Main | Redirect to bensuperpc.org |
| bensuperpc.ovh | Main | Redirect to bensuperpc.org |
| bensuperpc.com | Main | Redirect to www.bensuperpc.org |
| bensuperpc.fr | Main | Redirect to www.bensuperpc.org |
| bensuperpc.net | Main | Redirect to www.bensuperpc.org |
| bensuperpc.ovh | Main | Redirect to www.bensuperpc.org |
### Configure the infrastructure
@ -99,13 +102,18 @@ You can generate a password with 32 characters:
openssl rand -base64 32
```
Or online: [passwordsgenerator.net](https://passwordsgenerator.net/)
For [caddy_backup.env](infrastructure/caddy/env/caddy_backup.env) file, you need to change the password(s) for the restic backup.
```sh
RESTIC_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ
```
For the [wordpress.env](infrastructure/wordpress/env/wordpress.env) file, you need to change the password and user for the database.
```sh
WORDPRESS_DB_USER=bensuperpc
WORDPRESS_DB_PASSWORD=lEOEf8cndnDjp84O4Uv5D9zJLJDFatLw
WORDPRESS_DB_NAME=wordpress
WORDPRESS_DB_HOST=wordpress_db:3306
```
For [wordpress_db.env](infrastructure/wordpress/env/wordpress_db.env) file, you need to change the password(s) and user for the database.
@ -114,7 +122,6 @@ For [wordpress_db.env](infrastructure/wordpress/env/wordpress_db.env) file, you
MYSQL_ROOT_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ
MYSQL_USER=bensuperpc
MYSQL_PASSWORD=lEOEf8cndnDjp84O4Uv5D9zJLJDFatLw
MYSQL_DATABASE=wordpress
```
For [wordpress_backup.env](infrastructure/wordpress/env/wordpress_backup.env) file, you need to change the password(s) for the restic backup.
@ -128,15 +135,11 @@ For [adminer.env](infrastructure/wordpress/env/adminer.env) file, you need to ch
MYSQL_ROOT_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ
MYSQL_USER=bensuperpc
MYSQL_PASSWORD=lEOEf8cndnDjp84O4Uv5D9zJLJDFatLw
ADMINER_DEFAULT_SERVER=wordpress_db
```
For [gitea.env](infrastructure/gitea/env/gitea.env) file, you need to change the password(s) and user for the database.
```sh
GITEA__database__DB_TYPE=mysql
GITEA__database__HOST=database_gitea:3306
GITEA__database__NAME=gitea
GITEA__database__USER=bensuperpc
GITEA__database__PASSWD=K7s5yoHknnEd7vsZoxb8I3dK9mjToF1j
GITEA__security__SECRET_KEY=ykcZt23an1E4lFHWvrCKdAyt16WAiK9c
@ -148,7 +151,6 @@ For [gitea_db.env](infrastructure/gitea/env/gitea_db.env) file, you need to chan
MYSQL_ROOT_PASSWORD=xpc4zIhHZzWKqVHcjBu4aW6aS7jG8d7X
MYSQL_USER=bensuperpc
MYSQL_PASSWORD=K7s5yoHknnEd7vsZoxb8I3dK9mjToF1j
MYSQL_DATABASE=gitea
```
For [psitransfer.env](infrastructure/psitransfer/env/psitransfer.env) file, you need to change the secret key.
@ -169,7 +171,6 @@ For [projectsend_db.env](infrastructure/projectsend/env/projectsend_db.env) file
MYSQL_ROOT_PASSWORD=8O34297GrBfT3Ld34Lfg9mpotmZwbJtt
MYSQL_USER=bensuperpc
MYSQL_PASSWORD=wdSUa1JEZhXie5AJ5NcX1w73xmpO12EY
MYSQL_DATABASE=projectsend
```
For [picoshare.env](infrastructure/picoshare/env/picoshare.env) file, you need to change the secret key.
@ -184,7 +185,6 @@ For [dufs.env](infrastructure/dufs/env/dufs.env) file, you need to change the se
DUFS_AUTH="admin:heqihlOfBmJDESGFlpbPi7P7Mi6F7RkV@/:rw|@/:ro"
```
For [stirlingpdf.env](infrastructure/stirlingpdf/env/stirlingpdf.env) file, it's **completly optional**, you can change the password(s) and user.
```sh
@ -217,33 +217,38 @@ Remove countainers with:
make down
```
### All services
You can find all service on this table:
| Service | Description | URL |
| --- | --- | --- |
| Homepage | Homepage | [www.bensuperpc.org](https://www.bensuperpc.org) |
| Wordpress | Wordpress website | [wordpress.bensuperpc.org](https://bensuperpc.org) |
| Adminer | Adminer for MariaDB | [adminer.bensuperpc.org](https://adminer.bensuperpc.org) |
| Uptime Kuma | Uptime Kuma for monitoring | [uptimekuma.bensuperpc.org](https://uptimekuma.bensuperpc.org) |
| qbittorrent | qbittorrent server | [qbittorrent.bensuperpc.org](https://qbittorrent.bensuperpc.org) |
| transmission | transmission server | [transmission.bensuperpc.org](https://transmission.bensuperpc.org) |
| Gitea | Gitea for git | [git.bensuperpc.org](https://git.bensuperpc.org) |
| Jellyfin | Jellyfin for media server | [jellyfin.bensuperpc.org](https://jellyfin.bensuperpc.org) |
| SyncThing | SyncThing for file synchronization | [syncthing.bensuperpc.org](https://syncthing.bensuperpc.org) |
| PsiTransfer | PsiTransfer for file sharing | [psitransfer.bensuperpc.org](https://psitransfer.bensuperpc.org) |
| it-tools | Tools for IT | [it-tools.bensuperpc.org](https://it-tools.bensuperpc.org) |
| Privatebin | Pastebin | [privatebin.bensuperpc.org](https://privatebin.bensuperpc.org) |
| Yacht | Web interface for managing docker containers | [yacht.bensuperpc.org](https://yacht.bensuperpc.org) |
| ProjectSend | ProjectSend for file sharing | [projectsend.bensuperpc.org](https://projectsend.bensuperpc.org) |
| Picoshare | Picoshare for file sharing | [picoshare.bensuperpc.org](https://picoshare.bensuperpc.org) |
| Dufs | Dufs for file sharing | [dufs.bensuperpc.org](https://dufs.bensuperpc.org) |
You can disable some services by removing the service name in PROFILES variable in the [Makefile](Makefile) file.
To enable the gitea CI: https://medium.com/@lokanx/how-to-build-docker-containers-using-gitea-runners-600729555e07
### Homepage
You can change the homepage config in these files:
- [bookmarks.yaml](infrastructure/homepage/config/bookmarks.yaml)
- [services.yaml](infrastructure/homepage/config/services.yaml)
- [settings.yaml](infrastructure/homepage/config/settings.yaml)
- [widgets.yaml](infrastructure/homepage/config/widgets.yaml)
### Docker volumes
This infrastructure uses docker volumes to store data, all configuration/data for each service are not shared between services for security and maintenance reasons, but **public_data** and **private_data** are shared between all services to store your data.
| Volume name | Description |
| --- | --- |
| public_data | Public data for services, reachable on internet via [dufs.bensuperpc.org](https://dufs.bensuperpc.org) |
| private_data | Private data for services |
### SSH access
The default port for ssh/rsync is is 2222.
You can need to add/change the public ssh key [id_ed25519.pub](infrastructure/openssh/config/authorized_keys/id_ed25519.pub) (its my public key), also change the user name in [openssh.env](infrastructure/openssh/env/openssh.env):
```sh
USER_NAME=bensuperpc
```
## Sources
- [Wordpress](https://wordpress.org/)
@ -274,6 +279,7 @@ To enable the gitea CI: https://medium.com/@lokanx/how-to-build-docker-container
- [ProjectSend](https://www.projectsend.org/)
- [Picoshare](https://github.com/mtlynch/picoshare)
- [Dufs](https://github.com/sigoden/dufs)
- [Fix docker volume](https://pratikpc.medium.com/use-docker-compose-named-volumes-as-non-root-within-your-containers-1911eb30f731)
## License

View File

@ -5,6 +5,9 @@ services:
container_name: caddy
profiles:
- caddy
depends_on:
main_infrastructure:
condition: service_completed_successfully
restart: on-failure:5
ports:
- 80:80
@ -55,8 +58,3 @@ volumes:
name: caddy_config
caddy_backup:
name: caddy_backup
networks:
infra-network:
driver: bridge
name: infra-network

View File

@ -20,4 +20,6 @@ services:
volumes:
public_data:
name: public_data
name: public_data
private_data:
name: private_data

View File

@ -9,25 +9,19 @@
description: Wordpress
ping: wordpress.bensuperpc.org
container: wordpress
- uptime-kuma:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/uptime-kuma.png
href: https://uptimekuma.bensuperpc.org/
description: Uptime Kuma
ping: uptimekuma.bensuperpc.org
container: uptime-kuma
- yacht:
# icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/yacht.png
href: https://yacht.bensuperpc.org/
description: Yacht
ping: yacht.bensuperpc.org
container: yacht
- Sharing:
- jellyfin:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/jellyfin.png
href: https://jellyfin.bensuperpc.org/
description: Jellyfin
ping: jellyfin.bensuperpc.org
container: jellyfin
- projectsend:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/projectsend.png
href: https://projectsend.bensuperpc.org/
description: ProjectSend
ping: projectsend.bensuperpc.org
container: projectsend
- Sharing:
- psitransfer:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/psitransfer.png
href: https://psitransfer.bensuperpc.org/
@ -64,12 +58,6 @@
description: Transmission
ping: transmission.bensuperpc.org
container: transmission
- projectsend:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/projectsend.png
href: https://projectsend.bensuperpc.org/
description: ProjectSend
ping: projectsend.bensuperpc.org
container: projectsend
- dufs:
# icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/dufs.png
href: https://dufs.bensuperpc.org/
@ -90,7 +78,6 @@
description: StirlingPDF
ping: stirlingpdf.bensuperpc.org
container: stirlingpdf
- gitea:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/gitea.png
href: https://gitea.bensuperpc.org/
@ -98,6 +85,26 @@
ping: gitea.bensuperpc.org
container: gitea
- Admin:
- uptime-kuma:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/uptime-kuma.png
href: https://uptimekuma.bensuperpc.org/
description: Uptime Kuma
ping: uptimekuma.bensuperpc.org
container: uptime-kuma
- yacht:
# icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/yacht.png
href: https://yacht.bensuperpc.org/
description: Yacht
ping: yacht.bensuperpc.org
container: yacht
- adminer:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/adminer.png
href: https://adminer.bensuperpc.org/
description: Adminer
ping: adminer.bensuperpc.org
container: adminer
- Games:
- minecraft:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/minecraft.png
@ -111,11 +118,4 @@
description: 7 Days to Die server
# ping: 7dtd.bensuperpc.org
container: 7dtd-server
- Others:
- gitea-runner:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/gitea.png
# href: https://gitea.bensuperpc.org/
description: Gitea Runner
ping: gitea.bensuperpc.org
container: gitea-runner

View File

@ -6,12 +6,12 @@ title: Bensuperpc
base: https://www.bensuperpc.org
favicon: /images/favicon.ico
favicon: /image/favicon.ico
logpath: /app/logs
background:
image: /images/electronic.jpg
image: /image/background.jpg
blur: md
opacity: 50
brightness: 50
@ -25,17 +25,13 @@ layout:
Personal:
style: row
columns: 6
Media:
style: row
columns: 6
Sharing:
style: row
columns: 6
Utils:
Admin:
style: row
columns: 6
initiallyCollapsed: false
Others:
Utils:
style: row
columns: 6
initiallyCollapsed: false

View File

@ -1,19 +1,37 @@
---
# For configuration options and examples, please see:
# https://gethomepage.dev/latest/configs/service-widgets
# https://gethomepage.dev/main/widgets/services/qbittorrent
#- logo:
# icon: /image/daisy.jpg
- resources:
cpu: true
cputemp: true
memory: true
disk: /
uptime: true
refresh: 3000
- search:
provider: duckduckgo
target: _blank
#- search:
# provider: duckduckgo
# target: _blank
# showSearchSuggestions: true
- datetime:
text_size: xl
locale: fr
format:
timeStyle: long
dateStyle: long
timeStyle: short
dateStyle: short
- openmeteo:
label: Nantes # optional
latitude: 47.216671
longitude: -1.55
timezone: Europe/Paris # optional
units: metric # or imperial
cache: 5 # Time in minutes to cache API responses, to stay within limits
format: # optional, Intl.NumberFormat options
maximumFractionDigits: 1

View File

@ -13,7 +13,7 @@ services:
volumes:
- homepage_log:/app/logs
- ./homepage/config:/app/config:ro
- ./homepage/image:/app/public/images:ro
- ./homepage/image:/app/public/image:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- infra-network

View File

Before

Width:  |  Height:  |  Size: 569 KiB

After

Width:  |  Height:  |  Size: 569 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -15,12 +15,9 @@ services:
- ./jellyfin/env/jellyfin.env
volumes:
- jellyfin_config:/config
- jellyfin_data_movies:/movies:rw
- jellyfin_data_series:/series:rw
- jellyfin_data_documentaries:/documentaries:rw
- jellyfin_data_musics:/musics:rw
- public_data:/public:rw
- jellyfin_cache:/cache
- public_data:/public
- private_data:/private
# Hardware acceleration (For Intel and AMD GPUs)
devices:
- /dev/dri:/dev/dri
@ -32,15 +29,9 @@ services:
volumes:
jellyfin_config:
name: jellyfin_config
jellyfin_data_movies:
name: jellyfin_data_movies
jellyfin_data_series:
name: jellyfin_data_series
jellyfin_data_documentaries:
name: jellyfin_data_documentaries
jellyfin_data_musics:
name: jellyfin_data_musics
jellyfin_cache:
name: jellyfin_cache
public_data:
name: public_data
jellyfin_cache:
name: jellyfin_cache
private_data:
name: private_data

View File

@ -0,0 +1,27 @@
services:
main_infrastructure:
container_name: main_infrastructure
image: debian:latest
profiles:
- main_infrastructure
user: "root"
group_add:
- '${PUID:-1000}'
volumes:
- public_data:/public
- private_data:/private
networks:
- infra-network
# Fix root permissions on mounted volumes
command: chown -R ${PUID:-1000}:${PGID:-1000} /public /private
volumes:
public_data:
name: public_data
private_data:
name: private_data
networks:
infra-network:
driver: bridge
name: infra-network

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVtzpnPr0Boy+bUbL+viOYfqeetDZF6Hu40EwNLXNb0 bensuperpc@gmail.com

View File

@ -0,0 +1,33 @@
services:
# openssh
openssh:
image: linuxserver/openssh-server:latest
container_name: openssh
profiles:
- openssh
depends_on:
- caddy
restart: on-failure:5
env_file:
- ./openssh/env/openssh.env
environment:
- PUID=${PUID:-1000}
- PGID=${PGID:-1000}
volumes:
- openssh_config:/config
- public_data:/public
- private_data:/private
- ./openssh/config/authorized_keys:/authorized_ssh_keys:ro
networks:
- infra-network
security_opt:
- no-new-privileges:true
ports:
- 2222:2222
volumes:
openssh_config:
name: openssh_config
public_data:
name: public_data
private_data:
name: private_data

15
infrastructure/openssh/env/openssh.env vendored Normal file
View File

@ -0,0 +1,15 @@
TZ=Etc/UTC
SUDO_ACCESS=false
PASSWORD_ACCESS=false
DOCKER_MODS=linuxserver/mods:openssh-server-rsync
#PUBLIC_KEY_URL=https://github.com/bensuperpc.keys
PUBLIC_KEY_DIR=/authorized_ssh_keys
USER_NAME=bensuperpc
#PUBLIC_KEY=yourpublickey
#PUBLIC_KEY_FILE=/path/to/file
#PUBLIC_KEY_DIR=/path/to/directory/containing/_only_/pubkeys
#PUBLIC_KEY_URL=https://github.com/username.keys
#USER_PASSWORD=password
#USER_PASSWORD_FILE=/path/to/file
#LOG_STDOUT=

View File

@ -25,4 +25,6 @@ volumes:
qbittorrent_config:
name: qbittorrent_config
public_data:
name: public_data
name: public_data
private_data:
name: private_data

View File

@ -16,6 +16,7 @@ services:
volumes:
- syncthing_config:/config
- public_data:/data1
- private_data:/data2
networks:
- infra-network
security_opt:
@ -26,3 +27,5 @@ volumes:
name: syncthing_config
public_data:
name: public_data
private_data:
name: private_data

View File

@ -0,0 +1 @@
TZ=Etc/UTC

View File

@ -25,7 +25,9 @@ services:
volumes:
transmission_config:
name: transmission_config
transmission_watch:
name: transmission_watch
public_data:
name: public_data
transmission_watch:
name: transmission_watch
private_data:
name: private_data

BIN
resources/homepagev1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB