Compare commits

..

20 Commits

Author SHA1 Message Date
e661b67b57 Merge pull request 'Add Nextcloud Dockerfile' (#4) from dev into main
Reviewed-on: #4
2025-06-16 16:41:44 -07:00
8aaa8e97b9 Update the BAKE performance data/ 2025-06-16 18:19:00 -06:00
8c6b258f48 Add BAKE to Nextcloud subproject. 2025-06-16 17:32:33 -06:00
8b7f94d51f Add note as to what type of system the testing was done on. 2025-06-16 17:32:15 -06:00
ac60f54142 Move the most important fixes to a Docker build file. fixes.sh is now just a list of maintenance jobs, name it so. Hooray!! 2025-06-16 17:17:47 -06:00
7265823f58 Add curl to the container so that the run script doesn't need to install it each time. 2025-06-16 15:43:55 -06:00
811442cd94 Add an .env file for the website. 2025-06-16 15:32:47 -06:00
a90bf8bf28 Provide a better explanation of what's happening in the log. 2025-06-16 15:20:00 -06:00
82547068e3 Add sudo to the website's container. 2025-06-16 15:09:48 -06:00
167d813599 Merge pull request 'Nextcloud Improvements' (#3) from dev into main
Reviewed-on: #3
2025-06-16 12:30:19 -07:00
494d0c04bd Allow long-form parameters. 2025-06-16 14:28:04 -06:00
4469754097 Remove TODOs, going to keep cron at the Docker server level, container packages too volatile. 2025-06-16 14:24:38 -06:00
4ca8a8ae02 Update comments, rearrange file, fix case statement and handle empty parameter correctly. 2025-06-16 14:23:57 -06:00
a3ce3a7ee1 Add usage and verbose output option for what the cron file is getting accomplished. 2025-06-16 14:01:25 -06:00
0e761c5112 Add memory limit setting to php command. 2025-06-16 13:18:40 -06:00
cf1e23e91c Call on www-data using sudo within the container, gives better output. 2025-06-16 12:53:43 -06:00
93be789790 Fix the "the input device is not a TTY" cron log message. 2025-06-16 12:19:01 -06:00
6611665770 Add TODO for getting cron.php working properly. 2025-03-28 17:15:41 -07:00
f8d4c4654e Add extra flag to enable doing things like migrating MIME types. May increase the amount of time by quite a bit on large systems, but mine is small. :) 2025-03-28 17:03:23 -07:00
2e7efbc6eb Allow the stage keyword to be at the beginning too. 2025-01-04 10:05:23 -07:00
10 changed files with 121 additions and 28 deletions

1
.gitignore vendored
View File

@ -37,3 +37,4 @@ Config/Hyperling.com/files/*
# Ignore things like Config/Hyperling.com-Stage/ # Ignore things like Config/Hyperling.com-Stage/
*-Stage *-Stage
Stage-*

View File

@ -6,7 +6,7 @@
FROM node:lts-slim FROM node:lts-slim
# Cache System Dependencies # Cache System Dependencies
RUN apt-get update && apt-get install -y git php-cli RUN apt-get update && apt-get install -y git php-cli sudo curl
# Cache Node Dependencies # Cache Node Dependencies
RUN mkdir -p /var/www/api RUN mkdir -p /var/www/api
@ -21,5 +21,5 @@ CMD cd /var/www/api && \
rm -rfv website/files && \ rm -rfv website/files && \
mv -v website/* ./ && \ mv -v website/* ./ && \
rm -rfv website && \ rm -rfv website && \
echo "Starting Website" && \ echo "Starting Website's Run Script" && \
./run.sh ./run.sh

View File

@ -0,0 +1,9 @@
# This file should be renamed '.env' and have any private values modified.
## 2025-06-16
## Performance Notes for Enabling BAKE
# Compose by itself takes about 35s to build this project.
# Enabling this setting first cause the build to take 80s.
# Subsequent builds consistently take less than 2 seconds.
# Testing was done on the micro server, not a workstation.
COMPOSE_BAKE=true

View File

@ -0,0 +1,11 @@
# 2025-06-16 Hyperling
# Tired of running fixes.sh to install extra packages. Bake them in!
FROM nextcloud:stable
# Cache System Dependencies
RUN apt-get update && apt-get install -y sudo libmagickcore-6.q16-6-extra htop \
iputils-ping dnsutils vim bzip2 libbz2-dev
# Configure PHP Dependency
RUN docker-php-ext-install bz2

View File

@ -4,19 +4,64 @@
# This should be added to root's crontab with the full path, such as: # This should be added to root's crontab with the full path, such as:
# */5 * * * * /opt/Docker/Config/Nextcloud/cron.ksh # */5 * * * * /opt/Docker/Config/Nextcloud/cron.ksh
# Check if a job is already going. DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")" PROG="$(basename -- "${BASH_SOURCE[0]}")"
# Check if a job is already going.
RUNNING=`ps -ef | grep $PROG | grep -v grep | grep -v $$ | grep -v "sh -c" | wc -l` RUNNING=`ps -ef | grep $PROG | grep -v grep | grep -v $$ | grep -v "sh -c" | wc -l`
if (( $RUNNING > 0 )); then if (( $RUNNING > 0 )); then
exit $RUNNING exit $RUNNING
fi fi
# 2023-08-25 From crontab. # Usage function for when -h or bad parameters are passed.
sh -c "docker exec -u www-data nc-app php cron.php --define apc.enable_cli=1" function usage() {
cat <<- EOF
Script to help with scheduling Nextcloud's cron requirements.
Usage: $PROG [-h|-v]
-h ) Display the usage and help text.
| --help
-v) Pass a verbose request to cron.php.
| --verbose
EOF
exit $1
}
# 2023-08-25 From fixes.sh, keep ownership correct and apps up to date. # Check for any parameters.
sh -c "docker exec -it nc-app chown -Rc www-data:www-data ." verbose=""
case "$1" in
"") ;;
"-h"|"--help")
usage 0
;;
"-v"|"--verbose")
verbose="-v"
;;
*)
echo -e "ERROR: Unknown parameter '$1'. Exiting.\n"
usage 1
;;
esac
# Keep ownership correct and apps up to date. Also exists in fixes.sh.
sh -c "docker exec -i nc-app chown -Rc www-data:www-data ."
# No longer update apps in advance of NC updates, allow the upgrade process to do it. # No longer update apps in advance of NC updates, allow the upgrade process to do it.
#sh -c "docker exec -itu www-data nc-app ./occ app:update --all" #sh -c "docker exec -itu www-data nc-app ./occ app:update --all"
# Prepare the variables being passed to the execution command.
if [[ -f $DIR/.env ]]; then
source $DIR/.env
else
PHP_MEMORY_LIMIT=256M
fi
# Main part of what would go in the crontab.
sh -c "
docker exec nc-app \
sudo -u www-data \
php \
-d apc.enable_cli=1 \
-d memory_limit=$PHP_MEMORY_LIMIT \
-f cron.php $verbose \
"
exit 0 exit 0

View File

@ -72,7 +72,8 @@ services:
## Nextcloud ## ## Nextcloud ##
nc-app: nc-app:
container_name: nc-app container_name: nc-app
image: nextcloud:stable build:
context: ./
restart: always restart: always
ports: ports:
- 8080:80 - 8080:80

View File

@ -73,7 +73,8 @@ services:
## Nextcloud ## ## Nextcloud ##
nc-app: nc-app:
container_name: nc-app container_name: nc-app
image: nextcloud:stable build:
context: ./
restart: always restart: always
ports: ports:
- 8080:80 - 8080:80

View File

@ -1,5 +1,6 @@
# Example environment file for Nextcloud stack, should be copied as `.env`. The # Example environment file for Nextcloud stack, should be copied as `.env`.
# variables here only apply to the compose file. If you need it passed to a
# The variables here only apply to the compose file. If you need it passed to a
# container then it also needs specified in its `environment:` operator. # container then it also needs specified in its `environment:` operator.
# #
# ** All usernames and passwords need changed before running in production! ** # ** All usernames and passwords need changed before running in production! **
@ -7,6 +8,17 @@
# Full guide on the Nextcloud parameters which may be supplied: # Full guide on the Nextcloud parameters which may be supplied:
# https://github.com/docker-library/docs/blob/master/nextcloud/README.md#auto-configuration-via-environment-variables # https://github.com/docker-library/docs/blob/master/nextcloud/README.md#auto-configuration-via-environment-variables
#
## Docker ##
#
# 20250616 - Performance testing was done on an old workstation.
# Only Compose: 3.8, 2.5, 1.8, 1.8, 2.1, 2.0, 1.7 seconds
# Compose Bake: 3.7, 0.9, 2.3, 2.0, 3.1, 2.1, 1.8 seconds
# Not really needed but also not harmful and will eliminate the warning.
# Timings do not include the initial pull for either method.
COMPOSE_BAKE=true
# #
## Nextcloud ## ## Nextcloud ##
# #

View File

@ -1,5 +1,6 @@
# Example environment file for Nextcloud stack, should be copied as `.env`. The # Example environment file for Nextcloud stack, should be copied as `.env`.
# variables here only apply to the compose file. If you need it passed to a
# The variables here only apply to the compose file. If you need it passed to a
# container then it also needs specified in its `environment:` operator. # container then it also needs specified in its `environment:` operator.
# #
# ** All usernames and passwords need changed before running in production! ** # ** All usernames and passwords need changed before running in production! **
@ -7,6 +8,17 @@
# Full guide on the Nextcloud parameters which may be supplied: # Full guide on the Nextcloud parameters which may be supplied:
# https://github.com/docker-library/docs/blob/master/nextcloud/README.md#auto-configuration-via-environment-variables # https://github.com/docker-library/docs/blob/master/nextcloud/README.md#auto-configuration-via-environment-variables
#
## Docker ##
#
# 20250616 - Performance testing was done on an old workstation.
# Only Compose: 3.8, 2.5, 1.8, 1.8, 2.1, 2.0, 1.7 seconds
# Compose Bake: 3.7, 0.9, 2.3, 2.0, 3.1, 2.1, 1.8 seconds
# Not really needed but also not harmful and will eliminate the warning.
# Timings do not include the initial pull for either method.
COMPOSE_BAKE=true
# #
## Nextcloud ## ## Nextcloud ##
# #

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# 2022-09-25 Hyperling # 2022-09-25 Hyperling
# Put fixes in a file so they do not need remembered. # Put maintenance needs into a file so the commands do not need remembered.
## Setup ## ## Setup ##
@ -11,19 +11,20 @@ source $DIR/../../source.env
## Main ## ## Main ##
echo -e "\n*** APT ***" ##### 20250616 - Apt and PHP commands now baked into the Dockerfile!! :D #####
###echo -e "\n*** APT ***"
echo -e "\n`date` - Update Apt Cache" ###
docker exec -it nc-app apt update -y ###echo -e "\n`date` - Update Apt Cache"
###docker exec -it nc-app apt update -y
echo -e "\n`date` - Install Additional Software" ###
docker exec -it nc-app apt install -y sudo libmagickcore-6.q16-6-extra htop \ ###echo -e "\n`date` - Install Additional Software"
iputils-ping dnsutils vim bzip2 libbz2-dev # php-bz2 ###docker exec -it nc-app apt install -y sudo libmagickcore-6.q16-6-extra htop \
### iputils-ping dnsutils vim bzip2 libbz2-dev # php-bz2
# 20240130 ###
# https://help.nextcloud.com/t/docker-image-setup-warning-missing-bz2-after-update-to-nc-28-0-0/176605 #### 20240130
echo -e "\n`date` - Compile PHP Modules" #### https://help.nextcloud.com/t/docker-image-setup-warning-missing-bz2-after-update-to-nc-28-0-0/176605
docker exec -it nc-app docker-php-ext-install bz2 ###echo -e "\n`date` - Compile PHP Modules"
###docker exec -it nc-app docker-php-ext-install bz2
# 2023-12-04 Make sure cron and chmod commands get run. # 2023-12-04 Make sure cron and chmod commands get run.
echo -e "\n*** CRON ***" echo -e "\n*** CRON ***"
@ -69,7 +70,7 @@ docker exec -itu www-data nc-app ./occ files:scan-app-data
echo -e "\n`date` - Theme Update" echo -e "\n`date` - Theme Update"
docker exec -itu www-data nc-app ./occ maintenance:theme:update docker exec -itu www-data nc-app ./occ maintenance:theme:update
echo -e "\n`date` - Repair" echo -e "\n`date` - Repair"
docker exec -itu www-data nc-app ./occ maintenance:repair docker exec -itu www-data nc-app ./occ maintenance:repair --include-expensive
# May also be useful but do not have much experience with them. # May also be useful but do not have much experience with them.
echo -e "\n`date` - Clean Versions" echo -e "\n`date` - Clean Versions"