mirror of
https://github.com/nickyeoman/docker-compose-cookbooks.git
synced 2026-09-04 10:56:23 +00:00
Started using Docker's Extend feature. Nginx Proxy Manager and Stash App Updated
This commit is contained in:
@@ -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 @@
|
||||
################################################################################
|
||||
# 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
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
stash:
|
||||
# https://hub.docker.com/r/stashapp/stash
|
||||
image: stashapp/stash:latest
|
||||
restart: unless-stopped
|
||||
image: ${STASH_IMAGE:-stashapp/stash:v0.26.2}
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-file: "100"
|
||||
max-size: "200m"
|
||||
max-size: ${MAX_SIZE:-200m}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- STASH_STASH=/data/
|
||||
- STASH_GENERATED=/generated/
|
||||
- STASH_METADATA=/metadata/
|
||||
- STASH_CACHE=/cache/
|
||||
networks:
|
||||
- admin_web
|
||||
- STASH_STASH=${STASH_STASH:-/data/}
|
||||
- STASH_GENERATED=${STASH_GENERATED:-/generated/}
|
||||
- STASH_METADATA=${STASH_METADATA:-/metadata/}
|
||||
- STASH_CACHE=${STASH_CACHE:-/cache/}
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- stash:/data
|
||||
- stash-metadata:/metadata
|
||||
- stash-cache:/cache
|
||||
- stash-generated:/generated
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.${PREFIX}_stash.rule=Host(`${STASH_DOMAIN_NAME}`)"
|
||||
- "traefik.http.routers.${PREFIX}_stash.entrypoints=websecure"
|
||||
- "traefik.http.routers.${PREFIX}_stash.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.${PREFIX}_stash.loadbalancer.server.port=9999"
|
||||
- "/etc/localtime:/etc/localtime:ro"
|
||||
- "./data/video:/data"
|
||||
- "./data/metadata:/metadata"
|
||||
- "./data/cache:/cache"
|
||||
- "./data/generated:/generated"
|
||||
- "./data/root:/root"
|
||||
# Uncomment and use if needed
|
||||
# network_mode: "host"
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# Domain and project
|
||||
STASH_DOMAIN_NAME=stash.nickyeoman.com
|
||||
PREFIX=p1
|
||||
Reference in New Issue
Block a user