Skip to content

schliflo/nas-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAS docker

Repository containing the docker-compose setup for my NAS / homeserver

Features:

Environment

You need to have the following environment variables setup or replaced in your docker-compose.yml and your storage mounted in /mnt/storage/cloud and /mnt/storage/shares for nextcloud and plex respectively.

example /etc/environment

DOCKER_USER_ID=1002
DOCKER_USER_GROUP_ID=1002

TIMEZONE=Europe/Berlin

STORAGE_PATH=/mnt/storage

[email protected]

PLEX_HOSTNAME=nas
PLEX_ADVERTISE_IP=http://<IP of your nas here>:32400/
PLEX_VIRTUAL_HOST=plex.example.com

NEXTCLOUD_VIRTUAL_HOST=cloud.example.com
NEXTCLOUD_MYSQL_ROOT_PASSWORD=yourRootPasswordHere
NEXTCLOUD_MYSQL_PASSWORD=yourPasswordHere

KIBANA_VIRTUAL_HOST=kibana.example.com

HOME_ASSISTANT_VIRTUAL_HOST=hass.example.com

HACKMD_VIRTUAL_HOST=hackmd.example.com
HACKMD_POSTGRES_PASSWORD=yourPasswordHere

GITEA_VIRTUAL_HOST=git.example.com
GITEA_MYSQL_ROOT_PASSWORD=yourRootPasswordHere
GITEA_MYSQL_PASSWORD=yourPasswordHere

INVOICENINJA_VIRTUAL_HOST=invoice.example.com
INVOICENINJA_APP_KEY=yourAppKeyHere
INVOICENINJA_MYSQL_ROOT_PASSWORD=yourRootPasswordHere
INVOICENINJA_MYSQL_PASSWORD=yourPasswordHere
INVOICENINJA_MAIL_HOST=smtp.example.com
[email protected]
INVOICENINJA_MAIL_PASSWORD=yourPasswordHere
INVOICENINJA_MAIL_FROM_NAME=Your Name
[email protected]

PYLOAD_VIRTUAL_HOST=downloads.example.com

(you need to have correct DNS records set for the domains you want to use and probably setup port forwarding of ports 80 and 443 to your nas in order to get remote access and let's encrypt working)

Setup

  1. Make sure to have docker and docker-compose installed on your system.
  2. You also need to have some sort of dynamic DNS setup to your (public) IP. Point the Domain(s) you are using to this IP.
  3. Add a static rule to your router for the system you are running this on, so the (private) IP doesn't change. Then forward ports 80 and `443 to this IP
  4. Clone the repo to /opt
  5. Run docker-compose -f /opt/docker-compose.yml up -d
  6. Services should be available at the hosts specified in your environment.

Shares

As I wanted to have certain directories directly accessible in my network, I created a user shareuser, which owns the shared dir and used the following config for /etc/samba/smb.conf:

[global]
  workgroup = WORKGROUP
  server string = nas
  security = user
  guest ok = yes
  map to guest = Bad Password

  log file = /var/log/samba/%m.log
  max log size = 50
  printcap name = /dev/null
  load printers = no

# Samba Shares
[nas]
  comment = Storage on NAS
  path = /mnt/storage/shares
  browseable = yes
  public = yes
  writeable = yes
  create mask = 0644
  directory mask = 0755
  force user = shareuser

You will need to restart samba for config changes to take effect