Enable new autostart behaviour: per version and for all

This commit is contained in:
cytopia 2018-12-29 00:19:54 +01:00
parent f2b0773fb5
commit ccd3f1dbc2
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
15 changed files with 241 additions and 12 deletions

1
.gitignore vendored
View File

@ -83,6 +83,7 @@
/cfg/php-fpm-7.4/*.conf /cfg/php-fpm-7.4/*.conf
# Ignore custom PHP-FPM startup scripts # Ignore custom PHP-FPM startup scripts
/autostart/*.sh
/cfg/php-startup-5.2/*.sh /cfg/php-startup-5.2/*.sh
/cfg/php-startup-5.3/*.sh /cfg/php-startup-5.3/*.sh
/cfg/php-startup-5.4/*.sh /cfg/php-startup-5.4/*.sh

View File

@ -9,7 +9,7 @@ COMPOSEPATH="${SCRIPTPATH}/../../"
CONTAINER="$( cd "${COMPOSEPATH}" && docker-compose ps -q php )" CONTAINER="$( cd "${COMPOSEPATH}" && docker-compose ps -q php )"
#FILES="$()" #FILES="$()"
cd "${COMPOSEPATH}" && docker-compose exec -T php bash -c "find /startup.d/*.sh-example -type f -print0 2>/dev/null" \ cd "${COMPOSEPATH}" && docker-compose exec -T php bash -c "find /startup.1.d/*.sh-example -type f -print0 2>/dev/null" \
| xargs -0 -n 1 echo \ | xargs -0 -n 1 echo \
| while read f; do | while read f; do

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
COMPOSEPATH="${SCRIPTPATH}/../../"
CONTAINER="$( cd "${COMPOSEPATH}" && docker-compose ps -q php )"
#FILES="$()"
cd "${COMPOSEPATH}" && docker-compose exec -T php bash -c "find /startup.2.d/*.sh-example -type f -print0 2>/dev/null" \
| xargs -0 -n 1 echo \
| while read f; do
echo "# ----------------------------------------------------------------------------------------"
echo "# [TEST] ${f}"
echo "# ----------------------------------------------------------------------------------------"
if ! docker exec -t ${CONTAINER} bash "${f}" "ACCEPT_EULA=1"; then
sleep 5
if ! docker exec -t ${CONTAINER} bash "${f}" "ACCEPT_EULA=1"; then
sleep 5
if ! docker exec -t ${CONTAINER} bash "${f}" "ACCEPT_EULA=1"; then
sleep 5
if ! docker exec -t ${CONTAINER} bash "${f}" "ACCEPT_EULA=1"; then
sleep 5
if ! docker exec -t ${CONTAINER} bash "${f}" "ACCEPT_EULA=1"; then
echo "[FAIl] ${f}"
exit 1
fi
fi
fi
fi
fi
echo "[OK] ${f}"
echo
echo
done

29
autostart/README.md Normal file
View File

@ -0,0 +1,29 @@
# Custom startup scripts (global)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires
the user to accept a license or similar.
A few examples are given that do not end by `.sh` which won't be run. If you want to use the
provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands for all PHP versions. If you want to selectively run commands
for a specific version, go to `cfg/php-startup-X.Y/`.
## Important
All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -1,4 +1,4 @@
# Custom startup scripts # Custom startup scripts (per PHP version)
Any script inside this directory ending by `.sh` will be executed during the PHP container startup. Any script inside this directory ending by `.sh` will be executed during the PHP container startup.
This is useful to apply your custom settings such as installing software that usually requires This is useful to apply your custom settings such as installing software that usually requires
@ -8,6 +8,22 @@ A few examples are given that do not end by `.sh` which won't be run. If you wan
provided examples, copy them to a file ending by `.sh` provided examples, copy them to a file ending by `.sh`
## Info
If you want to autostart NodeJS applications, you can use [pm2](https://github.com/Unitech/pm2).
Ensure you do this as user `devilbox`, as by default everything is run by root.
```bash
su -c 'cd /shared/httpd/node/node; pm2 start index.js' -l devilbox
```
## Note
This directory will startup commands only for a specific PHP version. If you want to run commands
for all versions , go to `autostart/` in the root of the Devilbox git directory.
## Important ## Important
All provided scripts will be executed with **root** permissions. All provided scripts will be executed with **root** permissions.

View File

@ -193,7 +193,8 @@ services:
- ${DEVILBOX_PATH}/mod/php-fpm-${PHP_SERVER}:/usr/lib64/php/custom-modules:ro${MOUNT_OPTIONS} - ${DEVILBOX_PATH}/mod/php-fpm-${PHP_SERVER}:/usr/lib64/php/custom-modules:ro${MOUNT_OPTIONS}
# Mount devilbox user-defined PHP-FPM startup *.sh scripts # Mount devilbox user-defined PHP-FPM startup *.sh scripts
- ${DEVILBOX_PATH}/cfg/php-startup-${PHP_SERVER}:/startup.d:rw${MOUNT_OPTIONS} - ${DEVILBOX_PATH}/cfg/php-startup-${PHP_SERVER}:/startup.1.d:rw${MOUNT_OPTIONS}
- ${DEVILBOX_PATH}/autostart:/startup.2.d:rw${MOUNT_OPTIONS}
# Mount devilbox user-defined bash config # Mount devilbox user-defined bash config
- ${DEVILBOX_PATH}/bash:/etc/bashrc-devilbox.d:rw${MOUNT_OPTIONS} - ${DEVILBOX_PATH}/bash:/etc/bashrc-devilbox.d:rw${MOUNT_OPTIONS}