mirror of
https://github.com/nickyeoman/docker-compose-cookbooks.git
synced 2026-09-03 18:36:22 +00:00
Started using Docker's Extend feature. Nginx Proxy Manager and Stash App Updated
This commit is contained in:
@@ -0,0 +1,60 @@
|
|||||||
|
# Nginx Proxy Manager
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This Docker Compose configuration sets up the Reverse Proxy application using Docker container.
|
||||||
|
|
||||||
|
- App: [Proxy Manager on Docker Hub](https://hub.docker.com/r/jc21/nginx-proxy-manager)
|
||||||
|
- Official Site: [Nginx Proxy Manager](https://nginxproxymanager.com/)
|
||||||
|
- Expose ports: 80, 81, 443
|
||||||
|
|
||||||
|
## Create Network
|
||||||
|
|
||||||
|
The first thing you want to do is create the network:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker network create proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
## Expose Ports
|
||||||
|
|
||||||
|
80 and 443 must be exposed, but you could proxy to 81 for the admin interface.
|
||||||
|
|
||||||
|
## Project Setup
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
proxy:
|
||||||
|
extends:
|
||||||
|
file: ${COOKBOOK}/nginx-proxy-manager/docker-compose.yml
|
||||||
|
service: proxy
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create volumes
|
||||||
|
```bash
|
||||||
|
mkdir -p data/proxy data/proxy-letsencrypt
|
||||||
|
```
|
||||||
|
|
||||||
|
### env file
|
||||||
|
|
||||||
|
```text
|
||||||
|
PROXY_IMAGE=jc21/nginx-proxy-manager:2.11.3
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
In the project directory you have to run as root as you use port 80 and 443
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Docker Start
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
# Docker Stop
|
||||||
|
docker-compose down
|
||||||
|
|
||||||
|
# Podman Start
|
||||||
|
sudo podman-compose up -d
|
||||||
|
|
||||||
|
# Podman Stop
|
||||||
|
sudo podman-compose down
|
||||||
|
```
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
proxy:
|
||||||
|
image: ${PROXY_IMAGE:-jc21/nginx-proxy-manager:latest}
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
X_FRAME_OPTIONS: "sameorigin"
|
||||||
|
DB_SQLITE_FILE: "/data/database.sqlite"
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
- "81:81"
|
||||||
|
- "443:443"
|
||||||
|
volumes:
|
||||||
|
- "./data/proxy:/data"
|
||||||
|
- "./data/proxy-letsencrypt:/etc/letsencrypt"
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
# Stash App Docker Compose Configuration
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This Docker Compose configuration sets up the Stash application using Docker containers.
|
||||||
|
|
||||||
|
- Stash App: [Stash on Docker Hub](https://hub.docker.com/r/stashapp/stash)
|
||||||
|
- Compose Example: [Stash GitHub Repository](https://github.com/stashapp/stash/blob/develop/docker/production/docker-compose.yml)
|
||||||
|
- ProxyPort: 9999
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
### COOKBOOK SETUP
|
||||||
|
|
||||||
|
Clone the repository then set the COOKBOOK Variable in your PROJECT's env file
|
||||||
|
```
|
||||||
|
git clone git@github.com:nickyeoman/docker-compose-cookbooks.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### Project Setup
|
||||||
|
|
||||||
|
Note this setup is meant to be used between two directories, COOKBOOK and PROJECT.
|
||||||
|
In your PROJECT directory set the following env file:
|
||||||
|
|
||||||
|
```text
|
||||||
|
# Local
|
||||||
|
PROD=prod.domain.com
|
||||||
|
PRODDIR=/var/www/stashdomain-com/
|
||||||
|
NETWORKNAME=proxy
|
||||||
|
COOKBOOK=/home/user/git/docker-compose-cookbooks
|
||||||
|
STASH_IMAGE=stashapp/stash:v0.26.2
|
||||||
|
|
||||||
|
# Container
|
||||||
|
STASH_DOMAIN_NAME=stash.4lt.ca
|
||||||
|
MAX_SIZE=200m
|
||||||
|
STASH_STASH=/data/
|
||||||
|
STASH_GENERATED=/generated/
|
||||||
|
STASH_METADATA=/metadata/
|
||||||
|
STASH_CACHE=/cache/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker Compose Extend
|
||||||
|
|
||||||
|
Now using extend you can call the service:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: '3.4'
|
||||||
|
|
||||||
|
services:
|
||||||
|
stash:
|
||||||
|
extends:
|
||||||
|
file: ${COOKBOOK}/stashapp/docker-compose.yml
|
||||||
|
service: stash
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
ports:
|
||||||
|
- "9999:9999"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Data directories
|
||||||
|
|
||||||
|
By default the compose file creates volumes locally in the project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p data/video data/cache data/metadata data/generated data/root/.stash
|
||||||
|
touch data/root/.stash/config.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
Usually I .gitignore the data directory and use a backup solution for redundancy.
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
In the project directory just run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Docker Start
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
# Docker Stop
|
||||||
|
docker-compose down
|
||||||
|
|
||||||
|
# Podman Start
|
||||||
|
podman-compose up -d
|
||||||
|
|
||||||
|
# Podman Stop
|
||||||
|
podman-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration Details
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
#### STASH_IMAGE
|
||||||
|
|
||||||
|
Docker image tag for Stash app.
|
||||||
|
|
||||||
|
#### STASH_DOMAIN_NAME
|
||||||
|
|
||||||
|
Domain name for the Stash app.
|
||||||
|
|
||||||
|
#### MAX_SIZE
|
||||||
|
|
||||||
|
Maximum size for log files.
|
||||||
|
|
||||||
|
#### Other
|
||||||
|
|
||||||
|
STASH_STASH, STASH_GENERATED, STASH_METADATA, STASH_CACHE: Paths for Stash data directories.
|
||||||
|
|
||||||
|
### Volumes
|
||||||
|
|
||||||
|
/etc/localtime:/etc/localtime:ro: Mounts host system's timezone information.
|
||||||
|
./data/video:/data: Maps local ./data/video directory to Stash /data directory.
|
||||||
|
./data/metadata:/metadata: Maps local ./data/metadata directory to Stash /metadata directory.
|
||||||
|
./data/cache:/cache: Maps local ./data/cache directory to Stash /cache directory.
|
||||||
|
./data/generated:/generated: Maps local ./data/generated directory to Stash /generated directory.
|
||||||
|
./data/root:/root: Maps local ./data/root directory to Stash /root directory.
|
||||||
|
|
||||||
|
### Networking
|
||||||
|
|
||||||
|
In your project file, you can change the network mode to host:
|
||||||
|
```yaml
|
||||||
|
stash:
|
||||||
|
extends:
|
||||||
|
file: ${COOKBOOK}/stashapp/docker-compose.yml
|
||||||
|
service: stash
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
ports:
|
||||||
|
- "8000:9999"
|
||||||
|
network_mode: "host"
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are using a reverse proxy, you need to set that network:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
|
```
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
#!/bin/#!/usr/bin/env bash
|
|
||||||
|
|
||||||
#Variables
|
|
||||||
path="${PWD}/static/videos"
|
|
||||||
path_content="${PWD}/content/blog"
|
|
||||||
dt=`date +'%Y-%m-%d'`
|
|
||||||
|
|
||||||
#setup
|
|
||||||
mkdir ${path}/meta
|
|
||||||
|
|
||||||
#get filename var
|
|
||||||
for i in $(ls $path/*mp4);
|
|
||||||
do
|
|
||||||
# filename with no ext
|
|
||||||
filename="${i##*/}"
|
|
||||||
filename="${filename%.mp4}"
|
|
||||||
|
|
||||||
# Get the resolution
|
|
||||||
res=`ffmpeg -i $i 2>&1 | grep Stream | grep -oP ', \K[0-9]+x[0-9]+'`;
|
|
||||||
name=`echo $i | sed 's/\(.*\)\..*/\1/'`; #remove extension
|
|
||||||
echo "res: $res"
|
|
||||||
|
|
||||||
#Get the number of frames
|
|
||||||
#frames=`ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=nokey=1:noprint_wrappers=1 $i`
|
|
||||||
#half frames
|
|
||||||
#z=$(($frames / 2))
|
|
||||||
#Create thumb
|
|
||||||
#ffmpeg -i $i -y -vf scale=300:-1,"select=gte(n\,${z})" -vframes 1 ${path}/thumbs/${filename}.png
|
|
||||||
|
|
||||||
#create a gif
|
|
||||||
ffmpeg -i $i -y -r 15 -vf scale=300:-1 -ss 00:00:03 -to 00:00:06 ${path}/thumbs/${filename}.gif
|
|
||||||
|
|
||||||
# get metadata
|
|
||||||
ffmpeg -i $i -y -f ffmetadata ${path}/meta/${filename}.txt
|
|
||||||
|
|
||||||
#title
|
|
||||||
title=`grep title ${path}/meta/${filename}.txt`
|
|
||||||
title=${title##*=}
|
|
||||||
|
|
||||||
#alias/slug
|
|
||||||
alias=${title// /_}
|
|
||||||
alias=${alias,,}
|
|
||||||
|
|
||||||
#artist
|
|
||||||
artist=`grep title ${path}/meta/${filename}.txt`
|
|
||||||
|
|
||||||
#tags
|
|
||||||
echo "tags:" > ${path}/meta/${filename}-tags.txt
|
|
||||||
tags=`grep genre ${path}/meta/${filename}.txt`
|
|
||||||
tags=${tags##*=}
|
|
||||||
for value in $tags
|
|
||||||
do
|
|
||||||
#Work here
|
|
||||||
echo " - $value" >> ${path}/meta/${filename}-tags.txt
|
|
||||||
done
|
|
||||||
tags=`cat ${path}/meta/${filename}-tags.txt`
|
|
||||||
|
|
||||||
# create or replace file
|
|
||||||
cat << EOF > ${path_content}/${filename}-${alias}.md
|
|
||||||
---
|
|
||||||
title: "${filename} - ${title}"
|
|
||||||
cover: "${filename}"
|
|
||||||
date: "${dt}"
|
|
||||||
description: "Here is video${filename} which is ${res} and starting ${artist}"
|
|
||||||
${tags}
|
|
||||||
---
|
|
||||||
|
|
||||||
Here is video${filename} which is ${res} and starting ${artist}.
|
|
||||||
|
|
||||||
{{< vids "${filename}" >}}
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
done;
|
|
||||||
|
|
||||||
rm -rf ${path}/meta
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
#not sure what to put here
|
|
||||||
+18
-40
@@ -1,49 +1,27 @@
|
|||||||
################################################################################
|
version: '3.4'
|
||||||
# Stash
|
|
||||||
# make sure you use the $PREFIX from .env for project_name
|
|
||||||
# docker-compose -p project_name up -d
|
|
||||||
#
|
|
||||||
# Version 1
|
|
||||||
################################################################################
|
|
||||||
version: '2'
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
stash:
|
|
||||||
stash-metadata:
|
|
||||||
stash-cache:
|
|
||||||
stash-generated:
|
|
||||||
|
|
||||||
networks:
|
|
||||||
admin_web:
|
|
||||||
external:
|
|
||||||
name: admin_web
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
stash:
|
stash:
|
||||||
# https://hub.docker.com/r/stashapp/stash
|
image: ${STASH_IMAGE:-stashapp/stash:v0.26.2}
|
||||||
image: stashapp/stash:latest
|
|
||||||
restart: unless-stopped
|
|
||||||
logging:
|
logging:
|
||||||
driver: "json-file"
|
driver: "json-file"
|
||||||
options:
|
options:
|
||||||
max-file: "100"
|
max-file: "100"
|
||||||
max-size: "200m"
|
max-size: ${MAX_SIZE:-200m}
|
||||||
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- STASH_STASH=/data/
|
- STASH_STASH=${STASH_STASH:-/data/}
|
||||||
- STASH_GENERATED=/generated/
|
- STASH_GENERATED=${STASH_GENERATED:-/generated/}
|
||||||
- STASH_METADATA=/metadata/
|
- STASH_METADATA=${STASH_METADATA:-/metadata/}
|
||||||
- STASH_CACHE=/cache/
|
- STASH_CACHE=${STASH_CACHE:-/cache/}
|
||||||
networks:
|
|
||||||
- admin_web
|
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
- stash:/data
|
- "./data/video:/data"
|
||||||
- stash-metadata:/metadata
|
- "./data/metadata:/metadata"
|
||||||
- stash-cache:/cache
|
- "./data/cache:/cache"
|
||||||
- stash-generated:/generated
|
- "./data/generated:/generated"
|
||||||
labels:
|
- "./data/root:/root"
|
||||||
- "traefik.enable=true"
|
# Uncomment and use if needed
|
||||||
- "traefik.http.routers.${PREFIX}_stash.rule=Host(`${STASH_DOMAIN_NAME}`)"
|
# network_mode: "host"
|
||||||
- "traefik.http.routers.${PREFIX}_stash.entrypoints=websecure"
|
|
||||||
- "traefik.http.routers.${PREFIX}_stash.tls.certresolver=letsencrypt"
|
|
||||||
- "traefik.http.services.${PREFIX}_stash.loadbalancer.server.port=9999"
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# Domain and project
|
|
||||||
STASH_DOMAIN_NAME=stash.nickyeoman.com
|
|
||||||
PREFIX=p1
|
|
||||||
Reference in New Issue
Block a user