All Projects → subdavis → Selfhosted

subdavis / Selfhosted

rootless docker compose + traefik

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Selfhosted

Ansible Role Hardening
Ansible role to apply a security baseline. Systemd edition.
Stars: ✭ 188 (+93.81%)
Mutual labels:  ubuntu, systemd
Rpi Pxe Server
setup a Raspberry Pi as an PXE-Server
Stars: ✭ 197 (+103.09%)
Mutual labels:  dnsmasq, ubuntu
Asus Fan Control
🌀 Fan control for ASUS devices running Linux.
Stars: ✭ 120 (+23.71%)
Mutual labels:  ubuntu, systemd
Capistrano Mb
[unmaintained] Capistrano tasks for deploying Rails from scratch to Ubuntu 16.04 and 18.04
Stars: ✭ 117 (+20.62%)
Mutual labels:  ubuntu, systemd
ansible-dnsmasq
Ansible role to set up Dnsmasq in Debian-like systems
Stars: ✭ 18 (-81.44%)
Mutual labels:  ubuntu, dnsmasq
Nginx Ee
Automated Nginx compilation from sources with additional modules support. Compatible with WordOps, EasyEngine & Plesk
Stars: ✭ 132 (+36.08%)
Mutual labels:  cloudflare, ubuntu
Piadvanced
This started as a custom install for my pihole!
Stars: ✭ 144 (+48.45%)
Mutual labels:  dnsmasq, ubuntu
Hardening
Hardening Ubuntu. Systemd edition.
Stars: ✭ 705 (+626.8%)
Mutual labels:  ubuntu, systemd
ceil
Helmut Hoffer von Ankershoffen experimenting with auto-provisioned RPi cluster running K8S on bare-metal
Stars: ✭ 42 (-56.7%)
Mutual labels:  cloudflare, dnsmasq
K3s Gitops Arm
k3s cluster backed by Flux (GitOps) up and running on a cluster of RPi4
Stars: ✭ 135 (+39.18%)
Mutual labels:  cloudflare, ubuntu
Slickstack
SlickStack is a free LEMP stack automation script written in Bash designed to enhance and simplify WordPress provisioning, performance, and security.
Stars: ✭ 311 (+220.62%)
Mutual labels:  cloudflare, ubuntu
Hassctl
Simple command line utility to help debug Home Assistant configuration
Stars: ✭ 77 (-20.62%)
Mutual labels:  ubuntu, systemd
Upper
Integrates Edge Caches like Fastly, KeyCDN, Cloudflare and Varnish with Craft.
Stars: ✭ 89 (-8.25%)
Mutual labels:  cloudflare
Systemdlogger
Exports systemd logs to an external service, eg cloudwatch, elasticsearch
Stars: ✭ 91 (-6.19%)
Mutual labels:  systemd
Learning Tools
A collection of tools and files for learning new technologies
Stars: ✭ 1,287 (+1226.8%)
Mutual labels:  ubuntu
Ubuntu1604 Cis
Ubuntu CIS Hardening Ansible Role
Stars: ✭ 88 (-9.28%)
Mutual labels:  ubuntu
Bose qc35 Ubuntu
Pair Bose QuietComfort 35 with Ubuntu over Bluetooth
Stars: ✭ 92 (-5.15%)
Mutual labels:  ubuntu
Tutorial Ubuntu 18.04 Install Nvidia Driver And Cuda And Cudnn And Build Tensorflow For Gpu
Ubuntu 18.04 How to install Nvidia driver + CUDA + CUDNN + build tensorflow for gpu step by step command line
Stars: ✭ 91 (-6.19%)
Mutual labels:  ubuntu
Steamos Ubuntu
Scripts to make an existing Ubuntu installation like SteamOS
Stars: ✭ 86 (-11.34%)
Mutual labels:  ubuntu
Zfs Installer
Shell script program that prepares ZFS on a system, and installs Linux
Stars: ✭ 88 (-9.28%)
Mutual labels:  ubuntu

rootless docker selfhosted services

with docker-compose and traefik

Uptime Robot ratio (30 days) Build Status

This repo contains my production rootless docker services accessible from anywhere over HTTPS using traefik. These services (and others) run on a single server.

  • Plex Media
  • Seafile Pro with Elasticache
  • Minio
  • Calibre Web
  • Samba Fileshare
  • Transmission torrent server with OpenVPN over NordVPN
  • AdGuard Home DNS
  • Drone CI and runner

Documentation

I've also written some intermediate to advanced generic usage docs for traefik, docker, pihole, and home networking. These articles are generally applicable, but some may be more useful than others.

More great documentation.

Prerequisites

  • A recent version of ubuntu server with rootless Docker CE and docker-compose installed (see below)
  • A router or firewall capable of dnsmasq. I use a Ubiquiti EdgeRouter X.
  • A domain name.
  • A cloudflare account.

Home network prep

  • You need to make sure that ports 80 and 443 are port-forwarded through your router to whatever host this will be on.
  • Your server should be assigned a static private IP by DNS. ifconfig will list your interfaces.
  • Refer to the docker-pi-hole docs and my docs for further network setup related to that service. Even though I use AdGuard Home, those docs are relevant.

DNS Configuration

In this setup, each container's service will serve from a different subdomain of your Cloudflare hosted zone dyndns subdomain.

  • Create an A record for core.mydomain.com to point to your public IP.
  • For each service, you'll need to create CNAME records for each service.mydomain.com to point to core.mydomain.com because all of your services are running on the same host but the host needs to be able to do virtual host routing based on domain name.
  • Your services will be publically available on https://servicename.mydomain.com.

Dynamic DNS (recommended)

Resolving the IP address of your home network is annoying because most DNS providers change your IP every now and again. Services like No-IP combat this, but they aren't the most reliable. However, setting DNS programatically is pretty easy with Cloudflare API.

Installation

  1. start with ubuntu lts
  2. Enable Unattended Upgrades
  3. clone this repo
  4. Sign into any private docker registries a. Seafile Pro is free for 3 users a. Seafile Pro Docker Docs
  5. install rootless docker a Understanding UID remapping a. ignore the env exports it says to set, see below
  6. install docker compose
  7. make sure UsePAM yes is set in /etc/ssh/sshd_config read more
cd selfhosted
cp .env.example .env # edit this

# make mount points
mkdir /media/local /media/primary /media/secondary

# install mounts
systemctl link media-primary.mount
systemctl link media-secondary.mount

# install logrotate
systenctl --user link $HOME/selfhosted/logrotate.timer
systenctl --user link $HOME/selfhosted/logrotate.service
systemctl --user enable logrotate.timer --now

# enable traefik logrotate
cp etc/traefik-logrotate.conf /etc/logrotate.d/traefik

# Add to .profile
# export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
nano .profile

Set up docker daemon.json. Otherwise, you may end up with subnet ranges inside your containers that overlap with the real LAN and make hosts unreachable.

{
    "default-address-pools": [
        {"base":"172.16.0.0/16","size":24},
        {"base":"172.20.0.0/16","size":24}
    ]
}

Edit /lib/systemd/system/[email protected] to include dependencies on mounts

[Unit]
Requires=user-runtime-dir@%i.service media-primary.mount media-secondary.mount

Automatic deployments and drone

  • Create a github api app. Follow drone setup instructions.
  • Make sure the user filtering config is set correctly so other users can't log in
  • Add secrets ssh_key, ssh_host, ssh_user for your deploy user.
  • Open drone.yourdomain.com and finish configuring your repo.

Adguard DNS

You may need to disable ubuntu's default dns service and remove resolf.conf read more.

After disabling systemd-resolved.service, I ususally set a different DNS server in /etc/resolv.conf so that DNS doesn't break when I screw up the stack.

systemd-resolve --help is your friend.

WireGurad and subnet overlap

  • use wg-quick for simplicity

  • May need to install or symlink resolvconf

  • Need to avoid overlapping subnets.

  • Set MTU down to 1280 for issues with cellular networks, on BOTH sides of the connection.

  • My subnet is 192.168.48.0/20

  • The mask is 255.255.240.0

  • The default LAN will be 192.168.52.0

  • The gateway is 192.168.52.1

Gateway: 11000000.10101000.0011 | 0100.00000001
Mask:    11111111.11111111.1111 | 0000.00000000
  • The upper 4 bits will be used for VLANs (16).
  • The lower 8 shoud belong to a single VLAN.

Using wireguard:

sudo systemctl enable [email protected] --now

IPv6

Some references I encountered while rolling out ipv6.

My full edgerouter config

Other useful nonsense

# set own IP, delete set
ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
ifconfig en1 delete 192.168.1.5
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].