Ver Fonte

Merge pull request #160 from LeonStoldt/master

Adding more examples #159
Anca Iordache há 4 anos atrás
pai
commit
6a48fdf4db

+ 5 - 0
README.md

@@ -34,6 +34,8 @@ application with Nginx proxy and a Mongo database.
 application with an Nginx proxy and a MySQL database.
 - [`NGINX / Go`](https://github.com/docker/awesome-compose/tree/master/nginx-golang) - Sample Nginx proxy with a Go backend.
 - [`NGINX / WSGI / Flask`](https://github.com/docker/awesome-compose/tree/master/nginx-wsgi-flask) - Sample Nginx reverse proxy with a Flask backend using WSGI.
+- [`Pi-hole / cloudflared`](https://github.com/docker/awesome-compose/tree/master/pihole-cloudflared-DoH) - Sample Pi-hole setup with use of DoH cloudflared service
+- [`PostgreSQL / pgAdmin`](https://github.com/docker/awesome-compose/tree/master/postgresql-pgadmin) - Sample setup for postgreSQL database with pgAdmin web interface
 - [`React / Spring / MySQL`](https://github.com/docker/awesome-compose/tree/master/react-java-mysql) - Sample React
 application with a Spring backend and a MySQL database.
 - [`React / Express / MySQL`](https://github.com/docker/awesome-compose/tree/master/react-express-mysql) - Sample React
@@ -54,6 +56,9 @@ with Spring framework and a Postgres database.
 - [`Traefik`](https://github.com/docker/awesome-compose/tree/master/traefik-golang)
 - [`Django`](https://github.com/docker/awesome-compose/tree/master/django)
 - [`Minecraft server`](https://github.com/docker/awesome-compose/tree/master/minecraft)
+- [`Plex`](https://github.com/docker/awesome-compose/tree/master/plex)
+- [`Portainer`](https://github.com/docker/awesome-compose/tree/master/portainer)
+- [`Wireguard`](https://github.com/docker/awesome-compose/tree/master/wireguard)
 ## Basic setups for different platforms (not production ready - useful for personal use) 
 - [`Gitea / PostgreSQL`](https://github.com/docker/awesome-compose/tree/master/gitea-postgres)
 - [`Nextcloud / PostgreSQL`](https://github.com/docker/awesome-compose/tree/master/nextcloud-postgres)

+ 8 - 0
pihole-cloudflared-DoH/.env

@@ -0,0 +1,8 @@
+TIMEZONE=Etc/UTC
+PIHOLE_PW=changeit
+# Default values for CONDITIONAL_FORWARDING with AVM FRITZ!Box
+PIHOLE_ROUTER_IP=192.168.178.1
+PIHOLE_NETWORK_DOMAIN=fritz.box
+PIHOLE_REVERSE_DNS=192.168.178.0/24
+PIHOLE_HOST_IP=192.168.178.X
+PIHOLE_HOST_IPV6=

+ 108 - 0
pihole-cloudflared-DoH/README.md

@@ -0,0 +1,108 @@
+## Pi-hole with cloudflared DoH (DNS-Over-HTTPS)
+This example provides a base setup for using [Pi-hole](https://docs.pi-hole.net/) with the [cloudflared DoH](https://docs.pi-hole.net/guides/dns/cloudflared/) service.
+More details on how to customize the installation and the compose file can be found in [Docker Pi-hole documentation](https://github.com/pi-hole/docker-pi-hole).
+
+
+Project structure:
+```
+.
+├── .env
+├── docker-compose.yaml
+└── README.md
+```
+
+[_docker-compose.yaml_](docker-compose.yaml)
+``` yaml
+services:
+  pihole:
+    image: pihole/pihole:latest
+    ports:
+      - "53:53/tcp"
+      - "53:53/udp"
+      - "67:67/udp"
+      - "8080:80/tcp"
+      - "8443:443/tcp"
+    ...
+  cloudflared:
+    image: visibilityspots/cloudflared
+    ports:
+      - "5054:5054/tcp"
+      - "5054:5054/udp"
+    ...
+```
+
+## Configuration
+
+### .env
+Before deploying this setup, you need to configure the following values in the [.env](.env) file.
+- TZ ([time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones))
+- PIHOLE_PW (admin password)
+- PIHOLE_ROUTER_IP (only needed for activated conditional forwarding)
+- PIHOLE_NETWORK_DOMAIN (only needed for activated conditional forwarding)
+- PIHOLE_HOST_IP (IPv4 address of your Pi-hole - needs to by static)
+- PIHOLE_HOST_IPV6 (IPv6 address of your Pi-hole - can be empty if you only use IPv4)
+
+### Conditional forwarding (optional, default: enabled)
+If you would like to disable conditional forwarding, delete the environment variables starting with "CONDITIONAL_FORWARDING"
+
+### Container DNS (optional, default: disabled)
+In the docker-compose file, dns is added as a comment. To enable dns remove '#' in front of the following lines: 
+``` yaml
+dns:
+    - 127.0.0.1 # "Sets your container's resolve settings to localhost so it can resolve DHCP hostnames [...]" - github.com/pi-hole/docker-pi-hole
+    - 1.1.1.1 # Backup server 
+```
+
+## Deploy with docker-compose
+When deploying this setup, the admin web interface will be available on port 8080 (e.g. http://localhost:8080/admin).
+
+``` shell
+$ docker-compose up -d
+Starting cloudflared ... done
+Starting pihole      ... done
+```
+
+
+## Expected result
+
+Check containers are running and the port mapping:
+```
+$ docker ps
+CONTAINER ID   IMAGE                                 COMMAND                  CREATED         STATUS                            PORTS                                                                                                     NAMES
+afcf5ca4214c   pihole/pihole:latest                  "/s6-init"               3 seconds ago   Up 3 seconds (health: starting)   0.0.0.0:53->53/udp, 0.0.0.0:53->53/tcp, 0.0.0.0:67->67/udp, 0.0.0.0:8080->80/tcp, 0.0.0.0:8443->443/tcp   pihole
+dfd49ab7a372   visibilityspots/cloudflared           "/bin/sh -c '/usr/lo…"   4 seconds ago   Up 3 seconds (health: starting)   0.0.0.0:5054->5054/tcp, 0.0.0.0:5054->5054/udp                                                            cloudflared
+```
+
+Navigate to `http://localhost:8080` in your web browser to access the installed Pi-hole web interface.
+
+
+Stop the containers with
+``` shell
+$ docker-compose down
+# To delete all data run:
+$ docker-compose down -v
+```
+
+## Troubleshooting
+
+### - Starting / Stopping pihole-FTL loop:
+  Sometimes, it can happen that there occurs a problem starting pihole-FTL.
+  I personally had this issue when adding this line to the shared volumes:
+  ```
+  - "/pihole/pihole.log:/var/log/pihole.log"
+  ```
+  To fix this issue, I found this [issue](https://github.com/pi-hole/docker-pi-hole/issues/645#issuecomment-670809672), 
+  which suggested adding an empty file (`touch /pihole/pihole.log`) to prevent it from creating a directory.
+  The directory would not allow starting pihole-FTL and result in something like this:
+  ```
+  # Starting pihole-FTL (no-daemon) as root
+  # Stopping pihole-FTL
+  ...
+  ```
+  If you created an empty file, you may also check the ownership to prevent permission problems.
+  
+### - Installing on Ubuntu may conflict with `systemd-resolved` - see [Installing on Ubuntu](https://github.com/pi-hole/docker-pi-hole#installing-on-ubuntu) for help.
+
+### - Environment variables are version-dependent
+  Environment variables like "CONDIIONAL_FORWARDING*" and "DNS1" are deprecated and replaced by e.g. "REV_SERVER*" and "PIHOLE_DNS" in version 5.8+.
+  Current information about environment variables can be found here: https://github.com/pi-hole/docker-pi-hole

+ 55 - 0
pihole-cloudflared-DoH/docker-compose.yaml

@@ -0,0 +1,55 @@
+version: '3.7'
+services:
+  cloudflared:
+    image: visibilityspots/cloudflared
+    container_name: cloudflared
+    ports:
+      - "5054:5054/tcp"
+      - "5054:5054/udp"
+    environment:
+      - TZ=${TIMEZONE}
+      - PORT=5054
+      - ADDRESS=0.0.0.0
+    restart: always
+    networks:
+      dns-net:
+        ipv4_address: 172.20.0.2
+
+  pihole:
+    container_name: pihole
+    image: pihole/pihole:latest
+    ports:
+      - "53:53/tcp"
+      - "53:53/udp"
+      - "67:67/udp"
+      - "8080:80/tcp"
+      - "8443:443/tcp"
+    environment:
+      - TZ=${TIMEZONE}
+      - PIHOLE_DNS_=172.20.0.2#5054;1.1.1.1 # referencing by name results in "Invalid IP detected in PIHOLE_DNS_: cloudflared#5054"
+      - WEBPASSWORD=${PIHOLE_PW}
+      - REV_SERVER=true
+      - REV_SERVER_TARGET=${PIHOLE_ROUTER_IP}
+      - REV_SERVER_DOMAIN=${PIHOLE_NETWORK_DOMAIN}
+      - REV_SERVER_CIDR=${PIHOLE_REVERSE_DNS}
+      - ServerIP=${PIHOLE_HOST_IP}
+      - ServerIPv6=${PIHOLE_HOST_IPV6}
+    #dns:
+      #- 127.0.0.1 # "Sets your container's resolve settings to localhost so it can resolve DHCP hostnames [...]" - github.com/pi-hole/docker-pi-hole
+      #- 1.1.1.1 # Backup server
+    volumes: # store your data between container upgrades
+      - "/etc/pihole/:/etc/pihole/"
+      - "/etc/dnsmasq.d/:/etc/dnsmasq.d/"
+    cap_add:
+      - NET_ADMIN # Recommended but not required (DHCP needs NET_ADMIN) https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
+    depends_on:
+      - "cloudflared"
+    restart: always
+    networks:
+      - dns-net
+
+networks:
+  dns-net:
+    ipam:
+      config:
+        - subnet: 172.20.0.0/24

+ 1 - 0
plex/.env

@@ -0,0 +1 @@
+PLEX_MEDIA_PATH=/media/your/plex/path

+ 57 - 0
plex/README.md

@@ -0,0 +1,57 @@
+## Plex
+This example provides a base setup for using [Plex](https://www.plex.tv/).
+More details on how to customize the installation and the compose file can be found in [linuxserver documentation](https://github.com/linuxserver/docker-plex).
+Alternatively, you can use different plex images (e.g. official plex image by [plexinc](https://github.com/plexinc/pms-docker))
+
+
+Project structure:
+```
+.
+├── .env
+├── docker-compose.yaml
+└── README.md
+```
+
+[_docker-compose.yaml_](docker-compose.yaml)
+``` yaml
+services:
+  plex:
+    image: linuxserver/plex:latest
+```
+
+## Configuration
+
+### .env
+Before deploying this setup, you need to configure the following values in the [.env](.env) file.
+- PLEX_MEDIA_PATH
+
+### Hardware Acceleration
+Check out the description for Hardware Acceleration support in the [documentation](https://github.com/linuxserver/docker-plex).
+
+## Deploy with docker-compose
+When deploying this setup, the web interface will be available on port 32400 (e.g. http://localhost:32400/web).
+
+``` shell
+$ docker-compose up -d
+Starting plex ... done
+```
+
+
+## Expected result
+
+Check containers are running:
+```
+$ docker ps
+CONTAINER ID   IMAGE                             COMMAND                  CREATED          STATUS         PORTS                                          NAMES
+62fc3ff1f1a0   ghcr.io/linuxserver/plex:latest   "/init"                  38 seconds ago   Up 3 seconds                                                  plex
+```
+
+Navigate to `http://localhost:32400/web` in your web browser to access the plex web interface.
+
+
+Stop the containers with
+``` shell
+$ docker-compose down
+# To delete all data run:
+$ docker-compose down -v
+```

+ 11 - 0
plex/docker-compose.yaml

@@ -0,0 +1,11 @@
+version: '3.7'
+services:
+  plex:
+    image: ghcr.io/linuxserver/plex:latest
+    container_name: plex
+    network_mode: host
+    environment:
+      - VERSION=docker
+    restart: always
+    volumes:
+      - ${PLEX_MEDIA_PATH}:/media/

+ 56 - 0
portainer/README.md

@@ -0,0 +1,56 @@
+## Portainer (CE)
+This example provides a base setup for using [Portainer](https://www.portainer.io/).
+More details on how to customize the installation and the compose file can be found in [portainer documentation](https://documentation.portainer.io/).
+
+### Demo
+You can try out the public demo instance first: http://demo.portainer.io/
+- username: admin
+- password: tryportainer
+
+Project structure:
+```
+.
+├── docker-compose.yaml
+└── README.md
+```
+
+[_docker-compose.yaml_](docker-compose.yaml)
+``` yaml
+services:
+  portainer:
+    image: portainer/portainer-ce:alpine
+```
+
+## Deploy with docker-compose
+When deploying this setup, the web interface will be available on port 9000 (e.g. http://localhost:9000).
+
+``` shell
+$ docker-compose up -d
+Starting portainer ... done
+```
+
+
+## Expected result
+
+Check containers are running:
+```
+$ docker ps
+CONTAINER ID   IMAGE                           COMMAND                  CREATED          STATUS                          PORTS                                                                                  NAMES
+860311c00e62   portainer/portainer-ce:alpine   "/portainer -H unix:…"   54 seconds ago   Up 53 seconds                   8000/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp                                    portainer
+
+```
+
+Navigate to `http://localhost:9000` in your web browser to access the portainer web interface and create an account.
+
+
+Stop the containers with
+``` shell
+$ docker-compose down
+# To delete all data run:
+$ docker-compose down -v
+```
+
+## Troubleshooting
+- Select the correct image for your OS. You can take a look at the published tags at [DockerHub](https://hub.docker.com/r/portainer/portainer-ce/tags)
+  
+> e.g. currently, the latest tag is for Windows (amd64) and alpine for Linux (amd64, arm/v7)

+ 15 - 0
portainer/docker-compose.yaml

@@ -0,0 +1,15 @@
+version: '3.7'
+services:
+  portainer:
+    image: portainer/portainer-ce:alpine
+    container_name: portainer
+    command: -H unix:///var/run/docker.sock
+    ports:
+      - "9000:9000"
+    volumes:
+      - "/var/run/docker.sock:/var/run/docker.sock"
+      - "portainer_data:/data"
+    restart: always
+
+volumes:
+  portainer_data:

+ 5 - 0
postgresql-pgadmin/.env

@@ -0,0 +1,5 @@
+POSTGRES_USER=yourUser
+POSTGRES_PW=changeit
+POSTGRES_DB=postgres
+PGADMIN_MAIL=your@email.com
+PGADMIN_PW=changeit

+ 68 - 0
postgresql-pgadmin/README.md

@@ -0,0 +1,68 @@
+## PostgreSQL and pgAdmin
+This example provides a base setup for using [PostgreSQL](https://www.postgresql.org/) and [pgAdmin](https://www.pgadmin.org/).
+More details on how to customize the installation and the compose file can be found [here (PostgreSQL)](https://hub.docker.com/_/postgres) and [here (pgAdmin)](https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html).
+
+Project structure:
+```
+.
+├── .env
+├── docker-compose.yaml
+└── README.md
+```
+
+[_docker-compose.yaml_](docker-compose.yaml)
+``` yaml
+services:
+  postgres:
+    image: postgres:latest
+    ...
+  pgadmin:
+    image: dpage/pgadmin4:latest
+```
+
+## Configuration
+
+### .env
+Before deploying this setup, you need to configure the following values in the [.env](.env) file.
+- POSTGRES_USER
+- POSTGRES_PW
+- POSTGRES_DB (can be default value)
+- PGADMIN_MAIL
+- PGADMIN_PW
+
+## Deploy with docker-compose
+When deploying this setup, the pgAdmin web interface will be available at port 5050 (e.g. http://localhost:5050).  
+
+``` shell
+$ docker-compose up
+Starting postgres ... done
+Starting pgadmin ... done
+```
+
+## Add postgres database to pgAdmin
+After logging in with your credentials of the .env file, you can add your database to pgAdmin. 
+1. Right-click "Servers" in the top-left corner and select "Create" -> "Server..."
+2. Name your connection
+3. Change to the "Connection" tab and add the connection details:
+- Hostname: "postgres" (this would normally be your IP address of the postgres database - however, docker can resolve this container ip by its name)
+- Port: "5432"
+- Maintenance Database: $POSTGRES_DB (see .env)
+- Username: $POSTGRES_USER (see .env)
+- Password: $POSTGRES_PW (see .env)
+  
+## Expected result
+
+Check containers are running:
+```
+$ docker ps
+CONTAINER ID   IMAGE                           COMMAND                  CREATED             STATUS                 PORTS                                                                                  NAMES
+849c5f48f784   postgres:latest                 "docker-entrypoint.s…"   9 minutes ago       Up 9 minutes           0.0.0.0:5432->5432/tcp, :::5432->5432/tcp                                              postgres
+d3cde3b455ee   dpage/pgadmin4:latest           "/entrypoint.sh"         9 minutes ago       Up 9 minutes           443/tcp, 0.0.0.0:5050->80/tcp, :::5050->80/tcp                                         pgadmin
+```
+
+Stop the containers with
+``` shell
+$ docker-compose down
+# To delete all data run:
+$ docker-compose down -v
+```

+ 22 - 0
postgresql-pgadmin/docker-compose.yaml

@@ -0,0 +1,22 @@
+version: '3.7'
+services:
+  postgres:
+    container_name: postgres
+    image: postgres:latest
+    environment:
+      - POSTGRES_USER=${POSTGRES_USER}
+      - POSTGRES_PASSWORD=${POSTGRES_PW}
+      - POSTGRES_DB=${POSTGRES_DB} #optional (specify default database instead of $POSTGRES_USER)
+    ports:
+      - "5432:5432"
+    restart: always
+
+  pgadmin:
+    container_name: pgadmin
+    image: dpage/pgadmin4:latest
+    environment:
+      - PGADMIN_DEFAULT_EMAIL=${PGADMIN_MAIL}
+      - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PW}
+    ports:
+      - "5050:80"
+    restart: always

+ 2 - 0
wireguard/.env

@@ -0,0 +1,2 @@
+TIMEZONE=Etc/UTC
+VPN_SERVER_URL=your-domain.dyndns.com # free examples http://www.duckdns.org/ and https://www.noip.com/

+ 78 - 0
wireguard/README.md

@@ -0,0 +1,78 @@
+## Wireguard
+This example provides a base setup for using [Wireguard](https://www.wireguard.com/).
+More details on how to customize the installation and the compose file can be found in [linuxserver documentation](https://hub.docker.com/r/linuxserver/wireguard).
+
+Project structure:
+```
+.
+├── .env
+├── docker-compose.yaml
+└── README.md
+```
+
+[_docker-compose.yaml_](docker-compose.yaml)
+``` yaml
+services:
+  wireguard:
+    image: ghcr.io/linuxserver/wireguard
+```
+
+## Configuration
+
+### .env
+Before deploying this setup, you need to configure the following values in the [.env](.env) file.
+- TIMEZONE
+- VPN_SERVER_URL (recommended setting up a server url with e.g. http://www.duckdns.org/ if you don't own a domain)
+
+## Deploy with docker-compose
+When deploying this setup, the log will show relevant information. You need to forward the external port 51820 to access your VPN from outside. 
+
+``` shell
+$ docker-compose up
+Starting wireguard ...
+wireguard    | **** It seems the wireguard module is already active. Skipping kernel header install and module compilation. ****
+wireguard    | **** Server mode is selected ****
+wireguard    | **** External server address is set to your-domain.dyndns.com # free examples http://www.duckdns.org/ and https://www.noip.com/ ****
+wireguard    | **** External server port is set to 51820. Make sure that port is properly forwarded to port 51820 inside this container ****
+[...]
+wireguard    | PEER 1 QR code:
+wireguard    | [GENERATED QR CODE TO SCAN FOR YOUR CONNECTION DETAILS]
+
+```
+
+## Expected result
+
+Check containers are running:
+```
+$ docker ps
+CONTAINER ID   IMAGE                           COMMAND                  CREATED          STATUS                          PORTS                                                                                  NAMES
+4992922d23dc   ghcr.io/linuxserver/wireguard   "/init"                  7 seconds ago    Up 5 seconds                    0.0.0.0:51820->51820/udp, :::51820->51820/udp                                          wireguard
+```
+
+## Mobile Wireguard App
+
+### Android
+<a href="https://play.google.com/store/apps/details?id=com.wireguard.android"><img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" height="75"></a>
+
+Install your Wireguard client on an Apple device by downloading the wireguard app and scanning the QR Code.
+
+### iOS
+<a href="https://apps.apple.com/de/app/wireguard/id1441195209"><img src="https://www.apple.com/de/itunes/link/images/link_badge_appstore_large_2x.png" height="55"></a>
+
+Install your Wireguard client on an Apple device by downloading the wireguard app and scanning the QR Code.
+
+Stop the containers with
+``` shell
+$ docker-compose down
+# To delete all data run:
+$ docker-compose down -v
+```
+
+## Troubleshooting
+
+### - (Raspberry Pi) Kernel Headers
+  On Raspberry Pi run `sudo apt update && sudo apt upgrade && sudo apt install raspberrypi-kernel-headers` and reboot before starting Wireguard.
+  Other Ubuntu / Debian based systems may need to install the kernel-headers too. Run `sudo apt update && sudo apt upgrade && sudo apt install linux-headers-$(uname -r)`
+  
+### - Server Mode Options
+  To create new clients or display existing ones, take a look at the "[Server Mode](https://hub.docker.com/r/linuxserver/wireguard)" section

+ 27 - 0
wireguard/docker-compose.yaml

@@ -0,0 +1,27 @@
+version: '3.7'
+services:
+  wireguard:
+    image: ghcr.io/linuxserver/wireguard
+    container_name: wireguard
+    cap_add:
+      - NET_ADMIN
+      - SYS_MODULE
+    environment:
+      - PUID=1000
+      - PGID=1000
+      - TZ=${ZIMEZONE}
+      - SERVERURL=${VPN_SERVER_URL} #optional
+      - SERVERPORT=51820 #optional
+      - PEERS=1 #optional
+      - PEERDNS=auto #optional
+      - INTERNAL_SUBNET=10.13.13.0 #optional
+      - ALLOWEDIPS=0.0.0.0/0 #optional
+    volumes:
+      - /usr/share/appdata/wireguard/config:/config
+      - /usr/src:/usr/src # location of kernel headers
+      - /lib/modules:/lib/modules
+    ports:
+      - 51820:51820/udp
+    sysctls:
+      - net.ipv4.conf.all.src_valid_mark=1
+    restart: unless-stopped