Compare commits
22 Commits
221a446996
...
921c450f03
| Author | SHA1 | Date | |
|---|---|---|---|
| 921c450f03 | |||
| 933d307254 | |||
| 6a2dcba0f9 | |||
| 2d565c94f0 | |||
| b490c84b37 | |||
| fa25327462 | |||
| 9ab6335a3c | |||
| 0eb2ecf033 | |||
| a233f32751 | |||
| 99afb5ac50 | |||
| f16b44a5b6 | |||
| 87a571c89a | |||
| 52d108fa75 | |||
| df3a4cb354 | |||
| 44f4aa55c6 | |||
| 7199a88627 | |||
| bf2499e6ce | |||
| e8e4b69ed6 | |||
| 9bc7988b81 | |||
| 0ed000cd20 | |||
| 4264e47577 | |||
| 1bcf5f3e7b |
@@ -46,8 +46,8 @@ fi
|
|||||||
echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
||||||
|
|
||||||
echo -e "\n*** Start the docker container ***"
|
echo -e "\n*** Start the docker container ***"
|
||||||
docker compose down
|
|
||||||
docker compose build
|
docker compose build
|
||||||
|
docker compose down
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
|
||||||
echo -e "\n*** Now use the local process for DNS ***\n/etc/resolv.conf:"
|
echo -e "\n*** Now use the local process for DNS ***\n/etc/resolv.conf:"
|
||||||
|
|||||||
118
Config/F-DroidRepo/Dockerfile
Normal file
118
Config/F-DroidRepo/Dockerfile
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
# Build a container which hosts Android apps through an F-Droid repository.
|
||||||
|
|
||||||
|
# Base Image #
|
||||||
|
|
||||||
|
FROM debian:trixie-slim
|
||||||
|
|
||||||
|
# variables #
|
||||||
|
|
||||||
|
ENV WEBROOT="/var/www/html"
|
||||||
|
ENV FDROID="/root/fdroid"
|
||||||
|
ENV REPO="$FDROID/repo"
|
||||||
|
|
||||||
|
# Install Packages#
|
||||||
|
# https://f-droid.org/en/docs/Installing_the_Server_and_Repo_Tools/#debianubuntumintetc
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y sudo bash curl git vim nginx
|
||||||
|
COPY files/debian-backports.sources /etc/apt/sources.list.d/
|
||||||
|
RUN apt-get update && apt-get install -y -t trixie-backports fdroidserver
|
||||||
|
|
||||||
|
# Generate F-Droid Repo #
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN mkdir -pv "$FDROID"
|
||||||
|
WORKDIR "$FDROID"
|
||||||
|
RUN fdroid init
|
||||||
|
|
||||||
|
# Start Command #
|
||||||
|
|
||||||
|
CMD nginx -g "daemon off;"
|
||||||
|
|
||||||
|
# This is where the image would get published. #
|
||||||
|
|
||||||
|
# Configure F-Droid Repo #
|
||||||
|
|
||||||
|
ARG REPO_DOMAIN
|
||||||
|
ENV REPO_DOMAIN="$REPO_DOMAIN"
|
||||||
|
ARG REPO_NAME
|
||||||
|
ENV REPO_NAME="$REPO_NAME"
|
||||||
|
|
||||||
|
# TBD/TODO: Add commands to remove repo_url and repo_name if they already exist.
|
||||||
|
|
||||||
|
RUN sed -i "$ a repo_url: $REPO_DOMAIN/fdroid/repo" "$FDROID/config.yml"
|
||||||
|
RUN sed -i "$ a repo_name: $REPO_NAME" "$FDROID/config.yml"
|
||||||
|
|
||||||
|
RUN fdroid update
|
||||||
|
|
||||||
|
# Advanced Variables #
|
||||||
|
|
||||||
|
ARG FILE00
|
||||||
|
ENV FILE00="$FILE00"
|
||||||
|
ARG FILE01
|
||||||
|
ENV FILE01="$FILE01"
|
||||||
|
ARG FILE02
|
||||||
|
ENV FILE02="$FILE02"
|
||||||
|
ARG FILE03
|
||||||
|
ENV FILE03="$FILE03"
|
||||||
|
ARG FILE04
|
||||||
|
ENV FILE04="$FILE04"
|
||||||
|
ARG FILE05
|
||||||
|
ENV FILE05="$FILE05"
|
||||||
|
ARG FILE06
|
||||||
|
ENV FILE06="$FILE06"
|
||||||
|
ARG FILE07
|
||||||
|
ENV FILE07="$FILE07"
|
||||||
|
ARG FILE08
|
||||||
|
ENV FILE08="$FILE08"
|
||||||
|
ARG FILE09
|
||||||
|
ENV FILE09="$FILE09"
|
||||||
|
ARG FILE10
|
||||||
|
ENV FILE10="$FILE10"
|
||||||
|
ARG FILE11
|
||||||
|
ENV FILE11="$FILE11"
|
||||||
|
ARG FILE12
|
||||||
|
ENV FILE12="$FILE12"
|
||||||
|
ARG FILE13
|
||||||
|
ENV FILE13="$FILE13"
|
||||||
|
ARG FILE14
|
||||||
|
ENV FILE14="$FILE14"
|
||||||
|
ARG FILE15
|
||||||
|
ENV FILE15="$FILE15"
|
||||||
|
ARG FILE16
|
||||||
|
ENV FILE16="$FILE16"
|
||||||
|
ARG FILE17
|
||||||
|
ENV FILE17="$FILE17"
|
||||||
|
ARG FILE18
|
||||||
|
ENV FILE18="$FILE18"
|
||||||
|
ARG FILE19
|
||||||
|
ENV FILE19="$FILE19"
|
||||||
|
|
||||||
|
# Download Remote Files #
|
||||||
|
|
||||||
|
RUN mkdir -pv /root/fdroid/repo
|
||||||
|
RUN bash -c 'if [[ -n "$FILE00" ]]; then wget -P "$REPO" "$FILE00"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE01" ]]; then wget -P "$REPO" "$FILE01"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE02" ]]; then wget -P "$REPO" "$FILE02"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE03" ]]; then wget -P "$REPO" "$FILE03"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE04" ]]; then wget -P "$REPO" "$FILE04"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE05" ]]; then wget -P "$REPO" "$FILE05"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE06" ]]; then wget -P "$REPO" "$FILE06"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE07" ]]; then wget -P "$REPO" "$FILE07"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE08" ]]; then wget -P "$REPO" "$FILE08"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE09" ]]; then wget -P "$REPO" "$FILE09"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE10" ]]; then wget -P "$REPO" "$FILE10"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE11" ]]; then wget -P "$REPO" "$FILE11"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE12" ]]; then wget -P "$REPO" "$FILE12"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE13" ]]; then wget -P "$REPO" "$FILE13"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE14" ]]; then wget -P "$REPO" "$FILE14"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE15" ]]; then wget -P "$REPO" "$FILE15"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE16" ]]; then wget -P "$REPO" "$FILE16"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE17" ]]; then wget -P "$REPO" "$FILE17"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE18" ]]; then wget -P "$REPO" "$FILE18"; fi'
|
||||||
|
RUN bash -c 'if [[ -n "$FILE19" ]]; then wget -P "$REPO" "$FILE19"; fi'
|
||||||
|
|
||||||
|
RUN fdroid update -c
|
||||||
|
|
||||||
|
# Publish Repo Contents to Web Root #
|
||||||
|
|
||||||
|
RUN cp -r "$REPO/"* "$WEBROOT/"
|
||||||
23
Config/F-DroidRepo/README.md
Normal file
23
Config/F-DroidRepo/README.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# F-Droid Repo
|
||||||
|
|
||||||
|
Simple container to create a 3rd party repository to be imported into F-Droid.
|
||||||
|
|
||||||
|
Downloads all the APKs during the build process and loads them automatically,
|
||||||
|
does not need any interaction other than modifying the `.env` with the URLs
|
||||||
|
of the apps you would like to be present.
|
||||||
|
|
||||||
|
If any apps get updated, rebuilding the container should pull any changes.
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
docker compose build
|
||||||
|
docker compose down
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
## Guide followed to create this Container
|
||||||
|
|
||||||
|
https://f-droid.org/en/docs/Setup_an_F-Droid_App_Repo/
|
||||||
|
|
||||||
|
## App Metadata
|
||||||
|
|
||||||
|
TBD
|
||||||
70
Config/F-DroidRepo/docker-compose.example.yml
Normal file
70
Config/F-DroidRepo/docker-compose.example.yml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# 2025-11-01 Hyperling
|
||||||
|
# Create a 3rd party F-Droid repository for providing app updates.
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
container_name: fd-app
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
network: host
|
||||||
|
args:
|
||||||
|
#WEBROOT: ${WEBROOT}
|
||||||
|
#REPO: ${REPO}
|
||||||
|
REPO_DOMAIN: ${REPO_DOMAIN}
|
||||||
|
REPO_NAME: ${REPO_NAME}
|
||||||
|
FILE00: ${FILE00}
|
||||||
|
FILE01: ${FILE01}
|
||||||
|
FILE02: ${FILE02}
|
||||||
|
FILE03: ${FILE03}
|
||||||
|
FILE04: ${FILE04}
|
||||||
|
FILE05: ${FILE05}
|
||||||
|
FILE06: ${FILE06}
|
||||||
|
FILE07: ${FILE07}
|
||||||
|
FILE08: ${FILE08}
|
||||||
|
FILE09: ${FILE09}
|
||||||
|
FILE10: ${FILE10}
|
||||||
|
FILE11: ${FILE11}
|
||||||
|
FILE12: ${FILE12}
|
||||||
|
FILE13: ${FILE13}
|
||||||
|
FILE14: ${FILE14}
|
||||||
|
FILE15: ${FILE15}
|
||||||
|
FILE16: ${FILE16}
|
||||||
|
FILE17: ${FILE17}
|
||||||
|
FILE18: ${FILE18}
|
||||||
|
FILE19: ${FILE19}
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "8015:80"
|
||||||
|
environment:
|
||||||
|
#- WEBROOT=$WEBROOT
|
||||||
|
#- REPO=$REPO
|
||||||
|
- REPO_DOMAIN=$REPO_DOMAIN
|
||||||
|
- REPO_NAME=$REPO_NAME
|
||||||
|
- FILE00=$FILE00
|
||||||
|
- FILE01=$FILE01
|
||||||
|
- FILE02=$FILE02
|
||||||
|
- FILE03=$FILE03
|
||||||
|
- FILE04=$FILE04
|
||||||
|
- FILE05=$FILE05
|
||||||
|
- FILE06=$FILE06
|
||||||
|
- FILE07=$FILE07
|
||||||
|
- FILE08=$FILE08
|
||||||
|
- FILE09=$FILE09
|
||||||
|
- FILE10=$FILE10
|
||||||
|
- FILE11=$FILE11
|
||||||
|
- FILE12=$FILE12
|
||||||
|
- FILE13=$FILE13
|
||||||
|
- FILE14=$FILE14
|
||||||
|
- FILE15=$FILE15
|
||||||
|
- FILE16=$FILE16
|
||||||
|
- FILE17=$FILE17
|
||||||
|
- FILE18=$FILE18
|
||||||
|
- FILE19=$FILE19
|
||||||
|
volumes:
|
||||||
|
- ../../Volumes/F-DroidRepo/share:/root/share
|
||||||
|
deploy:
|
||||||
|
mode: global
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: $CPU
|
||||||
|
memory: $MEM
|
||||||
44
Config/F-DroidRepo/example.env
Normal file
44
Config/F-DroidRepo/example.env
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# This file will need copied as `.env` and to have its values changed.
|
||||||
|
|
||||||
|
## Docker ##
|
||||||
|
|
||||||
|
COMPOSE_BAKE=true
|
||||||
|
|
||||||
|
## Performance ##
|
||||||
|
|
||||||
|
CPU=0.25
|
||||||
|
MEM=0.25G
|
||||||
|
|
||||||
|
## Repo Settings ##
|
||||||
|
|
||||||
|
#WEBROOT="/var/www/html"
|
||||||
|
#REPO="/root/fdroid"
|
||||||
|
|
||||||
|
REPO_DOMAIN="https://fdroid.hyperling.com"
|
||||||
|
REPO_NAME="Hyperling's Apps"
|
||||||
|
|
||||||
|
## Files ##
|
||||||
|
# Should be provided as URLs directly to the APK files.
|
||||||
|
# TBD: Eventually change APKs to not have version number in them.
|
||||||
|
# - Currently being done because Obtainium does not read the Gitea release/tag.
|
||||||
|
|
||||||
|
FILE00="https://git.hyperling.com/me/android-carb-up/releases/download/latest/CarbUp_v1.0.1.apk"
|
||||||
|
FILE01="https://git.hyperling.com/me/flutter-expense-tracker/releases/download/latest/ExpenseTracker_v0.1.3.apk"
|
||||||
|
FILE02="https://git.hyperling.com/me/android-infinite-timer/releases/download/latest/InfiniteTimer_v1.1.1.apk"
|
||||||
|
FILE03="https://git.hyperling.com/me/android-45-minute-rule/releases/download/latest/The45MinuteRule_v1.0.7.apk"
|
||||||
|
FILE04="https://git.hyperling.com/me/android-tictactoe/releases/download/latest/TicTacToe_v1.1.0.apk"
|
||||||
|
FILE05="https://git.hyperling.com/me/android-hypergames/releases/download/latest/HyperGames_v0.0.11.apk"
|
||||||
|
FILE06=""
|
||||||
|
FILE07=""
|
||||||
|
FILE08=""
|
||||||
|
FILE09=""
|
||||||
|
FILE10="https://git.hyperling.com/me/ebook-freedom-flyer/releases/download/latest/VoluntarySovereignty.pdf"
|
||||||
|
FILE11="https://git.hyperling.com/me/ebook-health-protocol/releases/download/latest/HyperlingsHealthProtocol.pdf"
|
||||||
|
FILE12=""
|
||||||
|
FILE13=""
|
||||||
|
FILE14=""
|
||||||
|
FILE15=""
|
||||||
|
FILE16=""
|
||||||
|
FILE17=""
|
||||||
|
FILE18=""
|
||||||
|
FILE19=""
|
||||||
6
Config/F-DroidRepo/files/debian-backports.sources
Normal file
6
Config/F-DroidRepo/files/debian-backports.sources
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Types: deb deb-src
|
||||||
|
URIs: http://deb.debian.org/debian
|
||||||
|
Suites: trixie-backports
|
||||||
|
Components: main contrib non-free non-free-firmware
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
Enabled: yes
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# Hyperling.com - files/
|
# Hyperling.com - files/
|
||||||
|
|
||||||
This is copied to the container's www/files/ folder for hosting static content.
|
This is a volume for the container's /var/www/files/ which hosts static content.
|
||||||
|
|
||||||
TBD: Make this a volume, rather than copying with `Dockerfile`.
|
TBD: Move this to Volumes?
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||||
source $DIR/.env
|
source $DIR/.env
|
||||||
source ../../source.env
|
|
||||||
|
|
||||||
## Main ##
|
## Main ##
|
||||||
|
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ If the proxy needs turned off either stop or down may be used.
|
|||||||
Upgrading the containers is as easy as this:
|
Upgrading the containers is as easy as this:
|
||||||
|
|
||||||
```
|
```
|
||||||
# docker compose down
|
|
||||||
# docker compose pull
|
# docker compose pull
|
||||||
# docker compose build
|
# docker compose build
|
||||||
|
# docker compose down
|
||||||
# docker compose up -d
|
# docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -75,15 +75,15 @@ This may be possible to do when the system is up, but the best results have come
|
|||||||
This is essentially an upgrade but there is no pull.
|
This is essentially an upgrade but there is no pull.
|
||||||
|
|
||||||
```
|
```
|
||||||
# docker compose down
|
|
||||||
# docker compose build
|
# docker compose build
|
||||||
|
# docker compose down
|
||||||
# docker compose up -d
|
# docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
If wanted as a one-line command:
|
If wanted as a one-line command:
|
||||||
|
|
||||||
```
|
```
|
||||||
# docker compose down && docker compose build && docker compose up -d
|
# docker compose build && docker compose down && docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
## Add New Config
|
## Add New Config
|
||||||
|
|||||||
11
Config/Sandbox/docker-compose.example.yml
Normal file
11
Config/Sandbox/docker-compose.example.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# 2025-11-11 Hyperling
|
||||||
|
# Basic container for testing commands in a blank slate environment.
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
container_name: sandbox
|
||||||
|
image: debian:trixie-slim
|
||||||
|
command: "tail -F /var/mail/*"
|
||||||
|
working_dir: /root
|
||||||
|
volumes:
|
||||||
|
- ../../Volumes/Sandbox/root-shared:/root/shared
|
||||||
@@ -17,7 +17,39 @@
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
wp-db:
|
app:
|
||||||
|
container_name: wp-app
|
||||||
|
image: wordpress:latest
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 8080:80
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
- ../../Volumes/WordPress/wordpress:/var/www/html
|
||||||
|
environment:
|
||||||
|
WORDPRESS_ADMIN_USERNAME: $WORDPRESS_ADMIN_USERNAME
|
||||||
|
WORDPRESS_ADMIN_PASSWORD: $WORDPRESS_ADMIN_PASSWORD
|
||||||
|
WORDPRESS_DB_HOST: wp-db
|
||||||
|
WORDPRESS_DB_NAME: $MARIADB_DATABASE
|
||||||
|
# TBD/TODO: Does not work, but recommended. :(
|
||||||
|
#WORDPRESS_DB_USER: $MARIADB_USER
|
||||||
|
#WORDPRESS_DB_PASSWORD: $MARIADB_PASSWORD
|
||||||
|
# Works, but not recommended. Lol.
|
||||||
|
WORDPRESS_DB_USER: root
|
||||||
|
WORDPRESS_DB_PASSWORD: $MARIADB_ROOT_PASSWORD
|
||||||
|
WORDPRESS_DEBUG: $WORDPRESS_DEBUG
|
||||||
|
deploy:
|
||||||
|
mode: global
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: $WP_CPU
|
||||||
|
memory: $WP_MEM
|
||||||
|
|
||||||
|
db:
|
||||||
container_name: wp-db
|
container_name: wp-db
|
||||||
image: mariadb:lts
|
image: mariadb:lts
|
||||||
restart: always
|
restart: always
|
||||||
@@ -36,45 +68,9 @@ services:
|
|||||||
MARIADB_PASSWORD: MARIADB_PASSWORD
|
MARIADB_PASSWORD: MARIADB_PASSWORD
|
||||||
MARIADB_ROOT_PASSWORD: $MARIADB_ROOT_PASSWORD
|
MARIADB_ROOT_PASSWORD: $MARIADB_ROOT_PASSWORD
|
||||||
MARIADB_AUTO_UPGRADE: $MARIADB_AUTO_UPGRADE
|
MARIADB_AUTO_UPGRADE: $MARIADB_AUTO_UPGRADE
|
||||||
WP_CPU_DB: $WP_CPU_DB
|
|
||||||
WP_MEM_DB: $WP_MEM_DB
|
|
||||||
deploy:
|
deploy:
|
||||||
mode: global
|
mode: global
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: $WP_CPU_DB
|
cpus: $WP_CPU_DB
|
||||||
memory: $WP_MEM_DB
|
memory: $WP_MEM_DB
|
||||||
|
|
||||||
wp-app:
|
|
||||||
container_name: wp-app
|
|
||||||
image: wordpress:latest
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- 8080:80
|
|
||||||
depends_on:
|
|
||||||
wp-db:
|
|
||||||
condition: service_healthy
|
|
||||||
links:
|
|
||||||
- wp-db
|
|
||||||
volumes:
|
|
||||||
- ../../Volumes/WordPress/wordpress:/var/www/html
|
|
||||||
environment:
|
|
||||||
WORDPRESS_ADMIN_USERNAME: $WORDPRESS_ADMIN_USERNAME
|
|
||||||
WORDPRESS_ADMIN_PASSWORD: $WORDPRESS_ADMIN_PASSWORD
|
|
||||||
WORDPRESS_DB_HOST: wp-db
|
|
||||||
WORDPRESS_DB_NAME: $MARIADB_DATABASE
|
|
||||||
# TBD/TODO: Does not work, but recommended. :(
|
|
||||||
#WORDPRESS_DB_USER: $MARIADB_USER
|
|
||||||
#WORDPRESS_DB_PASSWORD: $MARIADB_PASSWORD
|
|
||||||
# Works, but not recommended. Lol.
|
|
||||||
WORDPRESS_DB_USER: root
|
|
||||||
WORDPRESS_DB_PASSWORD: $MARIADB_ROOT_PASSWORD
|
|
||||||
WORDPRESS_DEBUG: $WORDPRESS_DEBUG
|
|
||||||
WP_CPU: $WP_CPU
|
|
||||||
WP_MEM: $WP_MEM
|
|
||||||
deploy:
|
|
||||||
mode: global
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: $WP_CPU
|
|
||||||
memory: $WP_MEM
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function usage() {
|
|||||||
# 1) The exit code used when leaving.
|
# 1) The exit code used when leaving.
|
||||||
exit_code=$1
|
exit_code=$1
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "Usage: $PROG [-A ( -u | -d | -b | -p | -c | -s )] " 1>&2
|
echo -n "Usage: $PROG [-A ( -u | -d | -b | -p | -c | -m | -s )] " 1>&2
|
||||||
echo "[-i CONTAINER] [-l CONTAINER] [-h]" 1>&2
|
echo "[-i CONTAINER] [-l CONTAINER] [-h]" 1>&2
|
||||||
cat <<- EOF
|
cat <<- EOF
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ function usage() {
|
|||||||
Parameters - Standalone:
|
Parameters - Standalone:
|
||||||
|
|
||||||
(ALL)
|
(ALL)
|
||||||
-A : Equivalent of specifying '-udbpcs' for a full upgrade service.
|
-A : Equivalent of specifying '-udbpcms' for a full upgrade service.
|
||||||
|
|
||||||
(UP)
|
(UP)
|
||||||
-u : Start all containers with 'up -d'.
|
-u : Start all containers with 'up -d'.
|
||||||
@@ -43,6 +43,9 @@ function usage() {
|
|||||||
(CLEAN)
|
(CLEAN)
|
||||||
-c : Remove any abandoned Docker objects using the 'prune' commands.
|
-c : Remove any abandoned Docker objects using the 'prune' commands.
|
||||||
|
|
||||||
|
(MAINTENANCE)
|
||||||
|
-m : Run any maintenance and/or purge scripts for each subproject.
|
||||||
|
|
||||||
(STATS)
|
(STATS)
|
||||||
-s : Tune in to the 'stats' of how each container is running.
|
-s : Tune in to the 'stats' of how each container is running.
|
||||||
|
|
||||||
@@ -86,7 +89,7 @@ function check_container() {
|
|||||||
|
|
||||||
## Parameters ##
|
## Parameters ##
|
||||||
|
|
||||||
while getopts ':Audbpcsi:l:h' opt; do
|
while getopts ':Audbpcsi:l:mh' opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
A) all="Y" ;;
|
A) all="Y" ;;
|
||||||
u) up="Y" ;;
|
u) up="Y" ;;
|
||||||
@@ -97,30 +100,31 @@ while getopts ':Audbpcsi:l:h' opt; do
|
|||||||
s) stats="Y" ;;
|
s) stats="Y" ;;
|
||||||
i) interact="$OPTARG" ;;
|
i) interact="$OPTARG" ;;
|
||||||
l) logs="$OPTARG" ;;
|
l) logs="$OPTARG" ;;
|
||||||
|
m) maintenance="Y" ;;
|
||||||
h) usage 0 ;;
|
h) usage 0 ;;
|
||||||
*) echo "ERROR: Parameter '$OPTARG' not recognized." 1>&2 && usage 1 ;;
|
*) echo "ERROR: Parameter '$OPTARG' not recognized." 1>&2 && usage 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# This is done outside the getopts for readability.
|
# This is done outside the getopts for readability.
|
||||||
if [[ -n $all ]]; then
|
if [[ -n "$all" && "$all" == "Y" ]]; then
|
||||||
up="Y"; down="Y"; build="Y"; pull="Y"; clean="Y"; stats="Y"
|
up="Y"; down="Y"; build="Y"; pull="Y"; clean="Y"; stats="Y"; maintenance="Y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Validations ##
|
## Validations ##
|
||||||
|
|
||||||
# Script will behave poorly if not run with admin privileges.
|
# Script will behave poorly if not run with admin privileges.
|
||||||
if [[ $LOGNAME != "root" ]]; then
|
if [[ "$LOGNAME" != "root" ]]; then
|
||||||
echo "*************************************************************"
|
echo "*************************************************************"
|
||||||
echo "WARNING: Script is intended for root. Please su or sudo/doas."
|
echo "WARNING: Script is intended for root. Please su or sudo/doas."
|
||||||
echo "*************************************************************"
|
echo "*************************************************************"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Options which only work if the container exists or is going to be started.
|
# Options which only work if the container exists or is going to be started.
|
||||||
if [[ -n $interact ]]; then
|
if [[ -n "$interact" ]]; then
|
||||||
check_container $interact interaction
|
check_container $interact interaction
|
||||||
fi
|
fi
|
||||||
if [[ -n $logs ]]; then
|
if [[ -n "$logs" ]]; then
|
||||||
check_container $logs logs
|
check_container $logs logs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -128,14 +132,14 @@ fi
|
|||||||
|
|
||||||
# If no parameters are passed, list all the containers which are running.
|
# If no parameters are passed, list all the containers which are running.
|
||||||
if [[ -z $up && -z $down && -z $build && -z $pull && -z $clean
|
if [[ -z $up && -z $down && -z $build && -z $pull && -z $clean
|
||||||
&& -z $interact && -z $logs && -z $stats
|
&& -z $interact && -z $logs && -z $stats && -z $maintenance
|
||||||
]]; then
|
]]; then
|
||||||
docker ps --size
|
docker ps --size
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Otherwise, loop through all the subproject configurations.
|
# Otherwise, loop through all the subproject configurations.
|
||||||
if [[ -n $up || -n $down || -n $build || -n $pull ]]; then
|
if [[ -n $up || -n $down || -n $build || -n $pull || -n $maintenance ]]; then
|
||||||
cd $DOCKER_HOME/Config
|
cd $DOCKER_HOME/Config
|
||||||
for dir in `ls`; do
|
for dir in `ls`; do
|
||||||
# If this is a directory, enter it, otherwise skip to the next listing.
|
# If this is a directory, enter it, otherwise skip to the next listing.
|
||||||
@@ -143,10 +147,10 @@ if [[ -n $up || -n $down || -n $build || -n $pull ]]; then
|
|||||||
echo ""
|
echo ""
|
||||||
pwd
|
pwd
|
||||||
|
|
||||||
# Ensure .env files exist so that all compose variables are populated.
|
# Ensure env file exists so that all compose variables are populated.
|
||||||
if [[ -e ./env.standard && ! -e ./.env ]]; then
|
if [[ -e ./example.env && ! -e ./.env ]]; then
|
||||||
echo "WARNING: .env file was not found, copying standard as placeholder."
|
echo "WARNING: .env file was not found, copying example as placeholder."
|
||||||
cp -v env.standard .env
|
cp -v example.env .env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure all configuration files have been created.
|
# Ensure all configuration files have been created.
|
||||||
@@ -160,9 +164,19 @@ if [[ -n $up || -n $down || -n $build || -n $pull ]]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shut off container.
|
# Run the prep script to create any necessary volumes.
|
||||||
if [[ $down == "Y" ]]; then
|
if [[ -f prep.sh ]]; then
|
||||||
[ -e docker-compose.yml ] && docker compose down
|
./prep.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run any maintenance scripts associate with the container.
|
||||||
|
if [[ "$maintenance" == "Y" ]]; then
|
||||||
|
if [[ -f "maintenance.sh" ]]; then
|
||||||
|
./maintenance.sh
|
||||||
|
fi
|
||||||
|
if [[ -f "purge.sh" ]]; then
|
||||||
|
./purge.sh
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update container from remote source such as Docker Hub.
|
# Update container from remote source such as Docker Hub.
|
||||||
@@ -175,6 +189,11 @@ if [[ -n $up || -n $down || -n $build || -n $pull ]]; then
|
|||||||
[ -e Dockerfile ] && docker compose build
|
[ -e Dockerfile ] && docker compose build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Shut off container.
|
||||||
|
if [[ $down == "Y" ]]; then
|
||||||
|
[ -e docker-compose.yml ] && docker compose down
|
||||||
|
fi
|
||||||
|
|
||||||
# Run the container as a daemon.
|
# Run the container as a daemon.
|
||||||
if [[ $up == "Y" ]]; then
|
if [[ $up == "Y" ]]; then
|
||||||
[ -e docker-compose.yml ] && docker compose up -d
|
[ -e docker-compose.yml ] && docker compose up -d
|
||||||
@@ -200,6 +219,9 @@ if [[ -n $clean ]]; then
|
|||||||
docker network prune
|
docker network prune
|
||||||
docker builder prune -a
|
docker builder prune -a
|
||||||
docker system df
|
docker system df
|
||||||
|
echo "Syncing."
|
||||||
|
sync
|
||||||
|
sleep 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Follow the logs of a container.
|
# Follow the logs of a container.
|
||||||
|
|||||||
Reference in New Issue
Block a user