Browse Source

Configure VPN, Database, and Torrent client

staging
David Ludwig 4 years ago
parent
commit
02729e8892
5 changed files with 89 additions and 109 deletions
  1. +5
    -2
      .env.example
  2. +9
    -0
      Dockerfile
  3. +8
    -23
      docker-compose.dev.yml
  4. +66
    -83
      docker-compose.yml
  5. +1
    -1
      utils/vpn

+ 5
- 2
.env.example View File

@ -1,2 +1,5 @@
UID = 1000
GID = 1000
UID=1000
GID=1000
DOCKER_BUILDKIT=1
COMPOSE_DOCKER_CLI_BUILD=1

+ 9
- 0
Dockerfile View File

@ -16,6 +16,7 @@ ARG BASE=base-alpine
# Alpine base definition # Alpine base definition
FROM node:14-alpine AS base-alpine FROM node:14-alpine AS base-alpine
RUN mkdir /var/autoplex && chown node:node -R /var/autoplex
# Alpine dev definition # Alpine dev definition
FROM base-alpine AS base-alpine-dev FROM base-alpine AS base-alpine-dev
@ -23,10 +24,17 @@ RUN apk add build-base python3
# Slim base definition # Slim base definition
FROM node:14-slim AS base-slim FROM node:14-slim AS base-slim
RUN mkdir /var/autoplex && chown node:node -R /var/autoplex
RUN apt-get update
RUN apt-get full-upgrade -y
RUN apt-get install -y libasound2 iputils-ping curl gnupg1 apt-transport-https dirmngr
RUN apt-get autoremove --purge -y
RUN rm -rf /var/lib/apt/lists/*
# Slim dev definition # Slim dev definition
FROM base-slim AS base-slim-dev FROM base-slim AS base-slim-dev
# Development Image -------------------------------------------------------------------------------- # Development Image --------------------------------------------------------------------------------
# Define the base image # Define the base image
@ -60,6 +68,7 @@ COPY lerna.json package.json tsconfig.json yarn.lock ./
RUN yarn install RUN yarn install
COPY packages packages COPY packages packages
COPY services/${SERVICE}/package.json ./services/${SERVICE}/ COPY services/${SERVICE}/package.json ./services/${SERVICE}/
COPY services/${SERVICE}/patches* ./services/${SERVICE}/patches
# Cache an image containing only the prod-dependencies # Cache an image containing only the prod-dependencies
FROM builder AS prod-deps FROM builder AS prod-deps


+ 8
- 23
docker-compose.dev.yml View File

@ -29,26 +29,11 @@ services:
# entrypoint: "/bin/sh" # entrypoint: "/bin/sh"
# tty: true # tty: true
# torrent_client:
# build:
# target: base
# volumes:
# - ./torrent-client:/app
# # ulimits:
# # core:
# # hard: -1
# # soft: -1
# entrypoint: "/bin/sh"
# tty: true
# torrent_client:
# build:
# target: base-dev
# volumes:
# - ./torrent-client-v2:/app
# # ulimits:
# # core:
# # hard: -1
# # soft: -1
# entrypoint: "/bin/sh"
# tty: true
torrent_client:
build:
target: dev
volumes:
- ./packages:/opt/app/packages
- ./services/torrent-client:/opt/app/services/torrent-client
entrypoint: "/bin/sh"
tty: true

+ 66
- 83
docker-compose.yml View File

@ -64,91 +64,74 @@ services:
# volumes: # volumes:
# - var:/var/autoplex # - var:/var/autoplex
# torrent_client:
# build:
# context: ./torrent-client
# depends_on:
# - "database"
# - "vpn"
# env_file:
# - ./torrent-client/.env
# healthcheck:
# test: ["CMD", "ping", "-q", "-c1", "google.com"]
# interval: 5m
# timeout: 10s
# retries: 3
# start_period: 5m
# network_mode: service:vpn
# restart: unless-stopped
# secrets:
# - mysql_root_password
# user: ${UID}:${GID}
# volumes:
# - var:/var/autoplex
torrent_client:
build:
context: .
args:
BASE: base-slim
SERVICE: torrent-client
depends_on:
- "database"
- "vpn"
env_file:
- ./services/torrent-client/.env
healthcheck:
test: ["CMD", "ping", "-q", "-c1", "google.com"]
interval: 5m
timeout: 10s
retries: 3
start_period: 5m
network_mode: service:vpn
restart: unless-stopped
secrets:
- mysql_root_password
user: ${UID}:${GID}
volumes:
- var:/var/autoplex
# torrent_client:
# build:
# context: ./torrent-client-v2
# depends_on:
# - "vpn"
# env_file:
# - ./torrent-client-v2/.env
# healthcheck:
# test: ["CMD", "ping", "-q", "-c1", "google.com"]
# interval: 5m
# timeout: 10s
# retries: 3
# start_period: 5m
# network_mode: service:vpn
# restart: unless-stopped
# user: ${UID}:${GID}
# volumes:
# - ./.volumes/storage:/storage/default
# - var:/var/autoplex
# database:
# image: mysql
# command: --default-authentication-plugin=mysql_native_password
# environment:
# MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root_password
# ports:
# - 33061:3306
# restart: unless-stopped
# security_opt:
# - seccomp=unconfined
# secrets:
# - mysql_root_password
# volumes:
# - ./database/init:/docker-entrypoint-initdb.d
# - mysql:/var/lib/mysql
database:
image: mysql
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root_password
ports:
- 33061:3306
restart: unless-stopped
security_opt:
- seccomp=unconfined
secrets:
- mysql_root_password
volumes:
- ./bootstrap/database/init:/docker-entrypoint-initdb.d
- mysql:/var/lib/mysql
# vpn:
# build:
# context: ./vpn
# cap_add:
# - net_admin
# command:
# - '-f ""'
# environment:
# TZ: "CST6CDT"
# links:
# - "database"
# networks:
# - default
# read_only: true
# tmpfs:
# - /run
# - /tmp
# restart: unless-stopped
# secrets:
# - vpn_auth
# security_opt:
# - label:disable
# stdin_open: true
# tty: true
# volumes:
# - /dev/net:/dev/net:z
# - ./.volumes/vpn:/vpn
vpn:
build:
context: ./utils/vpn
cap_add:
- net_admin
command:
- '-f ""'
environment:
TZ: "CST6CDT"
links:
- "database"
networks:
- default
read_only: true
tmpfs:
- /run
- /tmp
restart: unless-stopped
secrets:
- vpn_auth
security_opt:
- label:disable
stdin_open: true
tty: true
volumes:
- /dev/net:/dev/net:z
- ./.volumes/vpn:/vpn
secrets: secrets:
app_key: app_key:


+ 1
- 1
utils/vpn

@ -1 +1 @@
Subproject commit 4719b210c6991ee3110afa4883829d7db9d4bb65
Subproject commit 4b794a01fee06b523fa7d6f39162f593568d912c

Loading…
Cancel
Save