Compare commits

..

32 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
385a07b8c0 Merge pull request 'Quickfixes! :)' (#2) from dev into main
Reviewed-on: #2
2025-01-04 09:55:44 -07:00
79a8549a42 Add services used in example Nextcloud file. 2025-01-04 09:52:25 -07:00
7b057765fe Fixes for example file. 2025-01-04 09:51:29 -07:00
9258c9a547 Merge pull request 'Update Project for Gitea; Add More Reverse Proxy Examples.' (#1) from dev into main
Reviewed-on: #1
2025-01-04 09:10:40 -07:00
88b76522ae Allow running stage environments without adding to the project. 2025-01-03 10:47:17 -07:00
1cbda3f57a Remove TBDs, using hostname instead of IP address is not throwing any errors. 2025-01-03 08:36:43 -07:00
486cd7cf21 Update project to use new Gitea server. 2025-01-03 07:59:46 -07:00
c2667399ea Add example file for Nextcloud. 2025-01-02 12:46:26 -07:00
8f5c987b73 revert 7f8bb2fe7a
Revert change by root.
2025-01-02 12:39:29 -07:00
7f8bb2fe7a Add example file for Nextcloud. 2025-01-02 12:36:40 -07:00
7071a8b47c Add lines necessary to upload files for releases. 2025-01-02 11:08:15 -07:00
56df4d6162 Add TBD's after adding the git service and realizing we have a point of failure. Not critical, would just take HTTP[S] traffic offline if the IP changed. 2025-01-01 18:01:33 -07:00
15 changed files with 216 additions and 31 deletions

4
.gitignore vendored
View File

@ -34,3 +34,7 @@ docker-compose.yml
# 2024-01-24 Hide static files for Hyperling.com. # 2024-01-24 Hide static files for Hyperling.com.
Config/Hyperling.com/files/* Config/Hyperling.com/files/*
# Ignore things like Config/Hyperling.com-Stage/
*-Stage
Stage-*

View File

@ -10,7 +10,7 @@ product's self-built solutions can be found below.
1. Install this project. 1. Install this project.
``` ```
git clone https://github.com/Hyperling/docker $PROJECT_DIR git clone https://git.hyperling.com/me/env-docker $PROJECT_DIR
``` ```
1. Add your user key to `$PROJECT_DIR/Config/DynamicDNS/private.key`. The key can 1. Add your user key to `$PROJECT_DIR/Config/DynamicDNS/private.key`. The key can

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
@ -17,9 +17,9 @@ RUN npm install
# Install + Run Website # Install + Run Website
CMD cd /var/www/api && \ CMD cd /var/www/api && \
rm -rfv pages main.js run.sh && \ rm -rfv pages main.js run.sh && \
git clone https://github.com/Hyperling/Website website && \ git clone https://git.hyperling.com/me/nodejs-website website && \
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"

View File

@ -48,6 +48,10 @@ server {
root /etc/nginx/letsencrypt/; root /etc/nginx/letsencrypt/;
} }
# Allow decent sized uploads.
client_max_body_size 0;
client_body_buffer_size 100M;
# Send traffic to upstream server # Send traffic to upstream server
location / { location / {
## General format is PROTOCOL://SERVER:PORT. ## General format is PROTOCOL://SERVER:PORT.

View File

@ -0,0 +1,75 @@
# 2025-01-02 Hyperling
# A dummy test file since true scripts are being kept private.
# This should help others understand how to get Nextcloud working.
## Instructions ##
# Add this without the comment to your /etc/hosts to test that it is working,
# YOUR_DOCKER_SERVER_IP cloud.example.com
# If testing locally on a workstation,
# 127.0.0.1 cloud.example.com
# Then to test, first start the container,
# cd $DOCKER_HOME/Config/ReverseProxy && docker compose build && docker compose up -d
# Then from the system with the modified /etc/hosts,
# curl --insecure cloud.example.com
# You should see activity in the container log as well as the contents of the
# proxied website in the terminal, NOT cloud.example.com. If using a browser then you
# should notice that the URL is still cloud.example.com but the website is correct.
server {
listen 80;
server_name cloud.example.com nextcloud.example.com;
location /.well-known/acme-challenge/ {
default_type "text/plain";
root /etc/nginx/letsencrypt/;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name cloud.example.com nextcloud.example.com;
ssl_certificate /etc/nginx/certs/nextcloud.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/nginx/certs/nextcloud.example.com/privkey.pem; # managed by Certbot
# https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html#nginx
rewrite ^/\.well-known/carddav https://$server_name/remote.php/dav/ redirect;
rewrite ^/\.well-known/caldav https://$server_name/remote.php/dav/ redirect;
location /.well-known/acme-challenge/ {
default_type "text/plain";
root /etc/nginx/letsencrypt/;
}
# Attempt to make OnlyOffice work both internally and externally.
# https://helpcenter.onlyoffice.com/installation/docs-nextcloud-proxy.aspx
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-Host $http_host/office;
# Send traffic to upstream server
location / {
expires epoch;
add_header Pragma public;
add_header Cache-Control "private, no-store";
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains; preload";
# Fix upload errors (HTTP Error: Request Entity Too Large).
client_max_body_size 0;
client_body_buffer_size 100M;
# Attempt to make OnlyOffice work both internally and externally.
# https://helpcenter.onlyoffice.com/installation/docs-nextcloud-proxy.asp
proxy_pass_header Server;
proxy_pass http://example-cloud;
}
# Attempt to make OnlyOffice work both internally and externally.
# https://helpcenter.onlyoffice.com/installation/docs-nextcloud-proxy.aspx
location /office/ {
proxy_pass http://example-office-http;
}
}

View File

@ -13,3 +13,13 @@ upstream example-git-site {
#server 127.0.0.1:3000; #server 127.0.0.1:3000;
server hyperling.com; server hyperling.com;
} }
upstream example-cloud {
#server 127.0.0.1:8081;
server hyperling.com;
}
upstream example-office-http {
#server 127.0.0.1:8082;
server hyperling.com;
}

View File

@ -24,7 +24,7 @@ apt install git bash
Clone the project. You may choose anywhere, but `/opt/Docker` is recommended. Clone the project. You may choose anywhere, but `/opt/Docker` is recommended.
``` ```
git clone https://github.com/Hyperling/Docker /opt/Docker git clone https://git.hyperling.com/me/env-docker /opt/Docker
``` ```
Load the environment variables from wherever you chose to put the project. Load the environment variables from wherever you chose to put the project.