mirror of
https://github.com/friendica/docker
synced 2025-04-01 08:37:23 +02:00
Merge pull request #88 from nupplaphil/task/mysql_wait
Add MySQL DB wait possibility
This commit is contained in:
commit
ba7371ad99
37 changed files with 692 additions and 361 deletions
47
.bin/wait-for-connection
Executable file
47
.bin/wait-for-connection
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/local/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script tries to connect to a database for a given interval
|
||||||
|
* Useful in case of installation e.g. to wait for the database to not generate unnecessary errors
|
||||||
|
*
|
||||||
|
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
$timeout = 60;
|
||||||
|
switch ($argc) {
|
||||||
|
case 4:
|
||||||
|
$timeout = (float)$argv[3];
|
||||||
|
case 3:
|
||||||
|
$host = $argv[1];
|
||||||
|
$port = (int)$argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($timeout < 0) {
|
||||||
|
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($port < 1) {
|
||||||
|
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||||
|
if ($socketTimeout > $timeout) {
|
||||||
|
$socketTimeout = $timeout;
|
||||||
|
}
|
||||||
|
$stopTime = time() + $timeout;
|
||||||
|
do {
|
||||||
|
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||||
|
if ($sock !== false) {
|
||||||
|
fclose($sock);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
fwrite(STDOUT, '.');
|
||||||
|
} while (time() < $stopTime);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(1);
|
|
@ -24,7 +24,8 @@ services:
|
||||||
- FRIENDICA_ADMIN_MAIL=
|
- FRIENDICA_ADMIN_MAIL=
|
||||||
- FRIENDICA_TZ=
|
- FRIENDICA_TZ=
|
||||||
- FRIENDICA_LANG=
|
- FRIENDICA_LANG=
|
||||||
- SITENAME=
|
- FRIENDICA_URL=
|
||||||
|
- FRIENDICA_SITENAME=
|
||||||
- SMTP=
|
- SMTP=
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
@ -42,6 +43,8 @@ services:
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
env_file:
|
||||||
|
- db.env
|
||||||
hostname: friendica.local
|
hostname: friendica.local
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -24,7 +24,8 @@ services:
|
||||||
- FRIENDICA_ADMIN_MAIL=
|
- FRIENDICA_ADMIN_MAIL=
|
||||||
- FRIENDICA_TZ=
|
- FRIENDICA_TZ=
|
||||||
- FRIENDICA_LANG=
|
- FRIENDICA_LANG=
|
||||||
- SITENAME=
|
- FRIENDICA_URL=
|
||||||
|
- FRIENDICA_SITENAME=
|
||||||
- SMTP=
|
- SMTP=
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
|
@ -24,7 +24,8 @@ services:
|
||||||
- FRIENDICA_ADMIN_MAIL=
|
- FRIENDICA_ADMIN_MAIL=
|
||||||
- FRIENDICA_TZ=
|
- FRIENDICA_TZ=
|
||||||
- FRIENDICA_LANG=
|
- FRIENDICA_LANG=
|
||||||
- SITENAME=
|
- FRIENDICA_URL=
|
||||||
|
- FRIENDICA_SITENAME=
|
||||||
- SMTP=
|
- SMTP=
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
|
|
|
@ -17,10 +17,12 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- friendica:/var/www/html
|
- friendica:/var/www/html
|
||||||
environment:
|
environment:
|
||||||
- AUTOINSTALL=true
|
- FRIENDICA_ADMIN_MAIL=
|
||||||
- MAILNAME=
|
- FRIENDICA_TZ=
|
||||||
- TZ=
|
- FRIENDICA_LANG=
|
||||||
- LANGUAGE=
|
- FRIENDICA_URL=
|
||||||
|
- FRIENDICA_SITENAME=
|
||||||
|
- SMTP=
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -47,10 +49,6 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- friendica:/var/www/html
|
- friendica:/var/www/html
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
environment:
|
|
||||||
- MAILNAME=
|
|
||||||
- TZ=
|
|
||||||
- LANGUAGE=
|
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
@ -20,6 +20,9 @@ services:
|
||||||
- FRIENDICA_ADMIN_MAIL=
|
- FRIENDICA_ADMIN_MAIL=
|
||||||
- FRIENDICA_TZ=
|
- FRIENDICA_TZ=
|
||||||
- FRIENDICA_LANG=
|
- FRIENDICA_LANG=
|
||||||
|
- FRIENDICA_URL=
|
||||||
|
- FRIENDICA_SITENAME=
|
||||||
|
- SMTP=
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -32,10 +35,6 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- friendica:/var/www/html
|
- friendica:/var/www/html
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
environment:
|
|
||||||
- MAILNAME=
|
|
||||||
- TZ=
|
|
||||||
- LANGUAGE=
|
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
@ -17,10 +17,12 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- friendica:/var/www/html
|
- friendica:/var/www/html
|
||||||
environment:
|
environment:
|
||||||
- AUTOINSTALL=true
|
- FRIENDICA_ADMIN_MAIL=
|
||||||
- MAILNAME=
|
- FRIENDICA_TZ=
|
||||||
- TZ=
|
- FRIENDICA_LANG=
|
||||||
- LANGUAGE=
|
- FRIENDICA_URL=
|
||||||
|
- FRIENDICA_SITENAME=
|
||||||
|
- SMTP=
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -33,10 +35,6 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- friendica:/var/www/html
|
- friendica:/var/www/html
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
environment:
|
|
||||||
- MAILNAME=
|
|
||||||
- TZ=
|
|
||||||
- LANGUAGE=
|
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
@ -140,6 +140,7 @@ RUN set -ex; \
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/friendica/config/
|
COPY config/* /usr/src/friendica/config/
|
||||||
|
COPY bin/* /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["apache2-foreground"]
|
CMD ["apache2-foreground"]
|
||||||
|
|
47
2019.09/apache/bin/wait-for-connection
Executable file
47
2019.09/apache/bin/wait-for-connection
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/local/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script tries to connect to a database for a given interval
|
||||||
|
* Useful in case of installation e.g. to wait for the database to not generate unnecessary errors
|
||||||
|
*
|
||||||
|
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
$timeout = 60;
|
||||||
|
switch ($argc) {
|
||||||
|
case 4:
|
||||||
|
$timeout = (float)$argv[3];
|
||||||
|
case 3:
|
||||||
|
$host = $argv[1];
|
||||||
|
$port = (int)$argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($timeout < 0) {
|
||||||
|
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($port < 1) {
|
||||||
|
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||||
|
if ($socketTimeout > $timeout) {
|
||||||
|
$socketTimeout = $timeout;
|
||||||
|
}
|
||||||
|
$stopTime = time() + $timeout;
|
||||||
|
do {
|
||||||
|
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||||
|
if ($sock !== false) {
|
||||||
|
fclose($sock);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
fwrite(STDOUT, '.');
|
||||||
|
} while (time() < $stopTime);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(1);
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
trap "break;exit" HUP INT TERM
|
trap "break;exit" HUP INT TERM
|
||||||
|
|
||||||
while [ ! -f /var/www/html/config/local.ini.php ] && [ ! -f /var/www/html/config/local.config.php ]; do
|
while [ ! -f /var/www/html/bin/daemon.php ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO let the database and the autoinstall time to complete - not winning a beauty contest
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
sleep 15s
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
exec php /var/www/html/bin/daemon.php -f start
|
exec php /var/www/html/bin/daemon.php -f start
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
|
|
|
@ -17,14 +17,14 @@ version_greater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_ssmtp() {
|
setup_ssmtp() {
|
||||||
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
if [ -n "${FRIENDICA_SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
echo "Setup SSMTP for '$FRIENDICA_SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
smtp_from=${SMTP_FROM:-no-reply}
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
# Setup SSMTP
|
# Setup SSMTP
|
||||||
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:root:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:Linux\ User:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
# add possible mail-senders
|
# add possible mail-senders
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
echo "New Friendica instance"
|
echo "New Friendica instance"
|
||||||
|
|
||||||
install=false
|
install=false
|
||||||
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n ${FRIENDICA_ADMIN_MAIL+x} ]; then
|
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
|
||||||
echo "Installation with environment variables"
|
echo "Installation with environment variables"
|
||||||
|
|
||||||
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
||||||
|
@ -117,22 +117,17 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'"'
|
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'" --url "'$FRIENDICA_URL'"'
|
||||||
install=true
|
|
||||||
elif [ -f "/usr/src/config/local.config.php" ]; then
|
|
||||||
echo "Installation with prepared local.config.php"
|
|
||||||
|
|
||||||
install_options="-f /usr/src/local.config.php"
|
|
||||||
install=true
|
install=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
echo "Starting Friendica installation ..."
|
echo "Starting Friendica installation ..."
|
||||||
# TODO Let the database time to warm up - not winning a beauty contest
|
|
||||||
sleep 10s
|
|
||||||
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
||||||
|
|
||||||
# TODO Workaround because of a strange permission issue
|
|
||||||
rm -fr /var/www/html/view/smarty3/compiled
|
rm -fr /var/www/html/view/smarty3/compiled
|
||||||
|
|
||||||
# load other config files (*.config.php) to the config folder
|
# load other config files (*.config.php) to the config folder
|
||||||
|
@ -141,6 +136,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installation finished"
|
echo "Installation finished"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Running web-based installer on first connect!"
|
echo "Running web-based installer on first connect!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -116,6 +116,7 @@ RUN set -ex; \
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/friendica/config/
|
COPY config/* /usr/src/friendica/config/
|
||||||
|
COPY bin/* /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["php-fpm"]
|
CMD ["php-fpm"]
|
||||||
|
|
47
2019.09/fpm-alpine/bin/wait-for-connection
Executable file
47
2019.09/fpm-alpine/bin/wait-for-connection
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/local/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script tries to connect to a database for a given interval
|
||||||
|
* Useful in case of installation e.g. to wait for the database to not generate unnecessary errors
|
||||||
|
*
|
||||||
|
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
$timeout = 60;
|
||||||
|
switch ($argc) {
|
||||||
|
case 4:
|
||||||
|
$timeout = (float)$argv[3];
|
||||||
|
case 3:
|
||||||
|
$host = $argv[1];
|
||||||
|
$port = (int)$argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($timeout < 0) {
|
||||||
|
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($port < 1) {
|
||||||
|
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||||
|
if ($socketTimeout > $timeout) {
|
||||||
|
$socketTimeout = $timeout;
|
||||||
|
}
|
||||||
|
$stopTime = time() + $timeout;
|
||||||
|
do {
|
||||||
|
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||||
|
if ($sock !== false) {
|
||||||
|
fclose($sock);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
fwrite(STDOUT, '.');
|
||||||
|
} while (time() < $stopTime);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(1);
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
trap "break;exit" HUP INT TERM
|
trap "break;exit" HUP INT TERM
|
||||||
|
|
||||||
while [ ! -f /var/www/html/config/local.ini.php ] && [ ! -f /var/www/html/config/local.config.php ]; do
|
while [ ! -f /var/www/html/bin/daemon.php ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO let the database and the autoinstall time to complete - not winning a beauty contest
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
sleep 15s
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
exec php /var/www/html/bin/daemon.php -f start
|
exec php /var/www/html/bin/daemon.php -f start
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
|
|
|
@ -17,14 +17,14 @@ version_greater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_ssmtp() {
|
setup_ssmtp() {
|
||||||
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
if [ -n "${FRIENDICA_SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
echo "Setup SSMTP for '$FRIENDICA_SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
smtp_from=${SMTP_FROM:-no-reply}
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
# Setup SSMTP
|
# Setup SSMTP
|
||||||
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:root:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:Linux\ User:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
# add possible mail-senders
|
# add possible mail-senders
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
echo "New Friendica instance"
|
echo "New Friendica instance"
|
||||||
|
|
||||||
install=false
|
install=false
|
||||||
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n ${FRIENDICA_ADMIN_MAIL+x} ]; then
|
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
|
||||||
echo "Installation with environment variables"
|
echo "Installation with environment variables"
|
||||||
|
|
||||||
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
||||||
|
@ -117,22 +117,17 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'"'
|
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'" --url "'$FRIENDICA_URL'"'
|
||||||
install=true
|
|
||||||
elif [ -f "/usr/src/config/local.config.php" ]; then
|
|
||||||
echo "Installation with prepared local.config.php"
|
|
||||||
|
|
||||||
install_options="-f /usr/src/local.config.php"
|
|
||||||
install=true
|
install=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
echo "Starting Friendica installation ..."
|
echo "Starting Friendica installation ..."
|
||||||
# TODO Let the database time to warm up - not winning a beauty contest
|
|
||||||
sleep 10s
|
|
||||||
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
||||||
|
|
||||||
# TODO Workaround because of a strange permission issue
|
|
||||||
rm -fr /var/www/html/view/smarty3/compiled
|
rm -fr /var/www/html/view/smarty3/compiled
|
||||||
|
|
||||||
# load other config files (*.config.php) to the config folder
|
# load other config files (*.config.php) to the config folder
|
||||||
|
@ -141,6 +136,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installation finished"
|
echo "Installation finished"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Running web-based installer on first connect!"
|
echo "Running web-based installer on first connect!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -131,6 +131,7 @@ RUN set -ex; \
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/friendica/config/
|
COPY config/* /usr/src/friendica/config/
|
||||||
|
COPY bin/* /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["php-fpm"]
|
CMD ["php-fpm"]
|
||||||
|
|
47
2019.09/fpm/bin/wait-for-connection
Executable file
47
2019.09/fpm/bin/wait-for-connection
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/local/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script tries to connect to a database for a given interval
|
||||||
|
* Useful in case of installation e.g. to wait for the database to not generate unnecessary errors
|
||||||
|
*
|
||||||
|
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
$timeout = 60;
|
||||||
|
switch ($argc) {
|
||||||
|
case 4:
|
||||||
|
$timeout = (float)$argv[3];
|
||||||
|
case 3:
|
||||||
|
$host = $argv[1];
|
||||||
|
$port = (int)$argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($timeout < 0) {
|
||||||
|
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($port < 1) {
|
||||||
|
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||||
|
if ($socketTimeout > $timeout) {
|
||||||
|
$socketTimeout = $timeout;
|
||||||
|
}
|
||||||
|
$stopTime = time() + $timeout;
|
||||||
|
do {
|
||||||
|
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||||
|
if ($sock !== false) {
|
||||||
|
fclose($sock);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
fwrite(STDOUT, '.');
|
||||||
|
} while (time() < $stopTime);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(1);
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
trap "break;exit" HUP INT TERM
|
trap "break;exit" HUP INT TERM
|
||||||
|
|
||||||
while [ ! -f /var/www/html/config/local.ini.php ] && [ ! -f /var/www/html/config/local.config.php ]; do
|
while [ ! -f /var/www/html/bin/daemon.php ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO let the database and the autoinstall time to complete - not winning a beauty contest
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
sleep 15s
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
exec php /var/www/html/bin/daemon.php -f start
|
exec php /var/www/html/bin/daemon.php -f start
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
|
|
|
@ -17,14 +17,14 @@ version_greater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_ssmtp() {
|
setup_ssmtp() {
|
||||||
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
if [ -n "${FRIENDICA_SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
echo "Setup SSMTP for '$FRIENDICA_SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
smtp_from=${SMTP_FROM:-no-reply}
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
# Setup SSMTP
|
# Setup SSMTP
|
||||||
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:root:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:Linux\ User:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
# add possible mail-senders
|
# add possible mail-senders
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
echo "New Friendica instance"
|
echo "New Friendica instance"
|
||||||
|
|
||||||
install=false
|
install=false
|
||||||
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n ${FRIENDICA_ADMIN_MAIL+x} ]; then
|
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
|
||||||
echo "Installation with environment variables"
|
echo "Installation with environment variables"
|
||||||
|
|
||||||
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
||||||
|
@ -117,22 +117,17 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'"'
|
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'" --url "'$FRIENDICA_URL'"'
|
||||||
install=true
|
|
||||||
elif [ -f "/usr/src/config/local.config.php" ]; then
|
|
||||||
echo "Installation with prepared local.config.php"
|
|
||||||
|
|
||||||
install_options="-f /usr/src/local.config.php"
|
|
||||||
install=true
|
install=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
echo "Starting Friendica installation ..."
|
echo "Starting Friendica installation ..."
|
||||||
# TODO Let the database time to warm up - not winning a beauty contest
|
|
||||||
sleep 10s
|
|
||||||
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
||||||
|
|
||||||
# TODO Workaround because of a strange permission issue
|
|
||||||
rm -fr /var/www/html/view/smarty3/compiled
|
rm -fr /var/www/html/view/smarty3/compiled
|
||||||
|
|
||||||
# load other config files (*.config.php) to the config folder
|
# load other config files (*.config.php) to the config folder
|
||||||
|
@ -141,6 +136,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installation finished"
|
echo "Installation finished"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Running web-based installer on first connect!"
|
echo "Running web-based installer on first connect!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -126,6 +126,7 @@ ENV FRIENDICA_ADDONS 2019.12-dev
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/friendica/config/
|
COPY config/* /usr/src/friendica/config/
|
||||||
|
COPY bin/* /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint-dev.sh"]
|
ENTRYPOINT ["/entrypoint-dev.sh"]
|
||||||
CMD ["apache2-foreground"]
|
CMD ["apache2-foreground"]
|
||||||
|
|
47
2019.12-dev/apache/bin/wait-for-connection
Executable file
47
2019.12-dev/apache/bin/wait-for-connection
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/local/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script tries to connect to a database for a given interval
|
||||||
|
* Useful in case of installation e.g. to wait for the database to not generate unnecessary errors
|
||||||
|
*
|
||||||
|
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
$timeout = 60;
|
||||||
|
switch ($argc) {
|
||||||
|
case 4:
|
||||||
|
$timeout = (float)$argv[3];
|
||||||
|
case 3:
|
||||||
|
$host = $argv[1];
|
||||||
|
$port = (int)$argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($timeout < 0) {
|
||||||
|
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($port < 1) {
|
||||||
|
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||||
|
if ($socketTimeout > $timeout) {
|
||||||
|
$socketTimeout = $timeout;
|
||||||
|
}
|
||||||
|
$stopTime = time() + $timeout;
|
||||||
|
do {
|
||||||
|
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||||
|
if ($sock !== false) {
|
||||||
|
fclose($sock);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
fwrite(STDOUT, '.');
|
||||||
|
} while (time() < $stopTime);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(1);
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
trap "break;exit" HUP INT TERM
|
trap "break;exit" HUP INT TERM
|
||||||
|
|
||||||
while [ ! -f /var/www/html/config/local.ini.php ] && [ ! -f /var/www/html/config/local.config.php ]; do
|
while [ ! -f /var/www/html/bin/daemon.php ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO let the database and the autoinstall time to complete - not winning a beauty contest
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
sleep 15s
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
exec php /var/www/html/bin/daemon.php -f start
|
exec php /var/www/html/bin/daemon.php -f start
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
|
|
|
@ -17,14 +17,14 @@ version_greater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_ssmtp() {
|
setup_ssmtp() {
|
||||||
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
if [ -n "${FRIENDICA_SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
echo "Setup SSMTP for '$FRIENDICA_SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
smtp_from=${SMTP_FROM:-no-reply}
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
# Setup SSMTP
|
# Setup SSMTP
|
||||||
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:root:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:Linux\ User:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
# add possible mail-senders
|
# add possible mail-senders
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
echo "New Friendica instance"
|
echo "New Friendica instance"
|
||||||
|
|
||||||
install=false
|
install=false
|
||||||
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n ${FRIENDICA_ADMIN_MAIL+x} ]; then
|
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
|
||||||
echo "Installation with environment variables"
|
echo "Installation with environment variables"
|
||||||
|
|
||||||
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
||||||
|
@ -117,22 +117,17 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'"'
|
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'" --url "'$FRIENDICA_URL'"'
|
||||||
install=true
|
|
||||||
elif [ -f "/usr/src/config/local.config.php" ]; then
|
|
||||||
echo "Installation with prepared local.config.php"
|
|
||||||
|
|
||||||
install_options="-f /usr/src/local.config.php"
|
|
||||||
install=true
|
install=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
echo "Starting Friendica installation ..."
|
echo "Starting Friendica installation ..."
|
||||||
# TODO Let the database time to warm up - not winning a beauty contest
|
|
||||||
sleep 10s
|
|
||||||
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
||||||
|
|
||||||
# TODO Workaround because of a strange permission issue
|
|
||||||
rm -fr /var/www/html/view/smarty3/compiled
|
rm -fr /var/www/html/view/smarty3/compiled
|
||||||
|
|
||||||
# load other config files (*.config.php) to the config folder
|
# load other config files (*.config.php) to the config folder
|
||||||
|
@ -141,6 +136,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installation finished"
|
echo "Installation finished"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Running web-based installer on first connect!"
|
echo "Running web-based installer on first connect!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -102,6 +102,7 @@ ENV FRIENDICA_ADDONS 2019.12-dev
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/friendica/config/
|
COPY config/* /usr/src/friendica/config/
|
||||||
|
COPY bin/* /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint-dev.sh"]
|
ENTRYPOINT ["/entrypoint-dev.sh"]
|
||||||
CMD ["php-fpm"]
|
CMD ["php-fpm"]
|
||||||
|
|
47
2019.12-dev/fpm-alpine/bin/wait-for-connection
Executable file
47
2019.12-dev/fpm-alpine/bin/wait-for-connection
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/local/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script tries to connect to a database for a given interval
|
||||||
|
* Useful in case of installation e.g. to wait for the database to not generate unnecessary errors
|
||||||
|
*
|
||||||
|
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
$timeout = 60;
|
||||||
|
switch ($argc) {
|
||||||
|
case 4:
|
||||||
|
$timeout = (float)$argv[3];
|
||||||
|
case 3:
|
||||||
|
$host = $argv[1];
|
||||||
|
$port = (int)$argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($timeout < 0) {
|
||||||
|
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($port < 1) {
|
||||||
|
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||||
|
if ($socketTimeout > $timeout) {
|
||||||
|
$socketTimeout = $timeout;
|
||||||
|
}
|
||||||
|
$stopTime = time() + $timeout;
|
||||||
|
do {
|
||||||
|
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||||
|
if ($sock !== false) {
|
||||||
|
fclose($sock);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
fwrite(STDOUT, '.');
|
||||||
|
} while (time() < $stopTime);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(1);
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
trap "break;exit" HUP INT TERM
|
trap "break;exit" HUP INT TERM
|
||||||
|
|
||||||
while [ ! -f /var/www/html/config/local.ini.php ] && [ ! -f /var/www/html/config/local.config.php ]; do
|
while [ ! -f /var/www/html/bin/daemon.php ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO let the database and the autoinstall time to complete - not winning a beauty contest
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
sleep 15s
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
exec php /var/www/html/bin/daemon.php -f start
|
exec php /var/www/html/bin/daemon.php -f start
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
|
|
|
@ -17,14 +17,14 @@ version_greater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_ssmtp() {
|
setup_ssmtp() {
|
||||||
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
if [ -n "${FRIENDICA_SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
echo "Setup SSMTP for '$FRIENDICA_SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
smtp_from=${SMTP_FROM:-no-reply}
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
# Setup SSMTP
|
# Setup SSMTP
|
||||||
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:root:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:Linux\ User:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
# add possible mail-senders
|
# add possible mail-senders
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
echo "New Friendica instance"
|
echo "New Friendica instance"
|
||||||
|
|
||||||
install=false
|
install=false
|
||||||
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n ${FRIENDICA_ADMIN_MAIL+x} ]; then
|
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
|
||||||
echo "Installation with environment variables"
|
echo "Installation with environment variables"
|
||||||
|
|
||||||
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
||||||
|
@ -117,22 +117,17 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'"'
|
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'" --url "'$FRIENDICA_URL'"'
|
||||||
install=true
|
|
||||||
elif [ -f "/usr/src/config/local.config.php" ]; then
|
|
||||||
echo "Installation with prepared local.config.php"
|
|
||||||
|
|
||||||
install_options="-f /usr/src/local.config.php"
|
|
||||||
install=true
|
install=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
echo "Starting Friendica installation ..."
|
echo "Starting Friendica installation ..."
|
||||||
# TODO Let the database time to warm up - not winning a beauty contest
|
|
||||||
sleep 10s
|
|
||||||
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
||||||
|
|
||||||
# TODO Workaround because of a strange permission issue
|
|
||||||
rm -fr /var/www/html/view/smarty3/compiled
|
rm -fr /var/www/html/view/smarty3/compiled
|
||||||
|
|
||||||
# load other config files (*.config.php) to the config folder
|
# load other config files (*.config.php) to the config folder
|
||||||
|
@ -141,6 +136,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installation finished"
|
echo "Installation finished"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Running web-based installer on first connect!"
|
echo "Running web-based installer on first connect!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -117,6 +117,7 @@ ENV FRIENDICA_ADDONS 2019.12-dev
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/friendica/config/
|
COPY config/* /usr/src/friendica/config/
|
||||||
|
COPY bin/* /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint-dev.sh"]
|
ENTRYPOINT ["/entrypoint-dev.sh"]
|
||||||
CMD ["php-fpm"]
|
CMD ["php-fpm"]
|
||||||
|
|
47
2019.12-dev/fpm/bin/wait-for-connection
Executable file
47
2019.12-dev/fpm/bin/wait-for-connection
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/local/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script tries to connect to a database for a given interval
|
||||||
|
* Useful in case of installation e.g. to wait for the database to not generate unnecessary errors
|
||||||
|
*
|
||||||
|
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
$timeout = 60;
|
||||||
|
switch ($argc) {
|
||||||
|
case 4:
|
||||||
|
$timeout = (float)$argv[3];
|
||||||
|
case 3:
|
||||||
|
$host = $argv[1];
|
||||||
|
$port = (int)$argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($timeout < 0) {
|
||||||
|
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if ($port < 1) {
|
||||||
|
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||||
|
if ($socketTimeout > $timeout) {
|
||||||
|
$socketTimeout = $timeout;
|
||||||
|
}
|
||||||
|
$stopTime = time() + $timeout;
|
||||||
|
do {
|
||||||
|
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||||
|
if ($sock !== false) {
|
||||||
|
fclose($sock);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
fwrite(STDOUT, '.');
|
||||||
|
} while (time() < $stopTime);
|
||||||
|
fwrite(STDOUT, "\n");
|
||||||
|
exit(1);
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
trap "break;exit" HUP INT TERM
|
trap "break;exit" HUP INT TERM
|
||||||
|
|
||||||
while [ ! -f /var/www/html/config/local.ini.php ] && [ ! -f /var/www/html/config/local.config.php ]; do
|
while [ ! -f /var/www/html/bin/daemon.php ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO let the database and the autoinstall time to complete - not winning a beauty contest
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
sleep 15s
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
exec php /var/www/html/bin/daemon.php -f start
|
exec php /var/www/html/bin/daemon.php -f start
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
|
|
|
@ -17,14 +17,14 @@ version_greater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_ssmtp() {
|
setup_ssmtp() {
|
||||||
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
if [ -n "${FRIENDICA_SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
echo "Setup SSMTP for '$FRIENDICA_SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
smtp_from=${SMTP_FROM:-no-reply}
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
# Setup SSMTP
|
# Setup SSMTP
|
||||||
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:root:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:Linux\ User:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
# add possible mail-senders
|
# add possible mail-senders
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
echo "New Friendica instance"
|
echo "New Friendica instance"
|
||||||
|
|
||||||
install=false
|
install=false
|
||||||
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n ${FRIENDICA_ADMIN_MAIL+x} ]; then
|
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
|
||||||
echo "Installation with environment variables"
|
echo "Installation with environment variables"
|
||||||
|
|
||||||
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
||||||
|
@ -117,22 +117,17 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'"'
|
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'" --url "'$FRIENDICA_URL'"'
|
||||||
install=true
|
|
||||||
elif [ -f "/usr/src/config/local.config.php" ]; then
|
|
||||||
echo "Installation with prepared local.config.php"
|
|
||||||
|
|
||||||
install_options="-f /usr/src/local.config.php"
|
|
||||||
install=true
|
install=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
echo "Starting Friendica installation ..."
|
echo "Starting Friendica installation ..."
|
||||||
# TODO Let the database time to warm up - not winning a beauty contest
|
|
||||||
sleep 10s
|
|
||||||
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
||||||
|
|
||||||
# TODO Workaround because of a strange permission issue
|
|
||||||
rm -fr /var/www/html/view/smarty3/compiled
|
rm -fr /var/www/html/view/smarty3/compiled
|
||||||
|
|
||||||
# load other config files (*.config.php) to the config folder
|
# load other config files (*.config.php) to the config folder
|
||||||
|
@ -141,6 +136,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installation finished"
|
echo "Installation finished"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Running web-based installer on first connect!"
|
echo "Running web-based installer on first connect!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -101,6 +101,7 @@ ENV FRIENDICA_ADDONS %%VERSION%%
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/friendica/config/
|
COPY config/* /usr/src/friendica/config/
|
||||||
|
COPY bin/* /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/%%ENTRYPOINT%%"]
|
ENTRYPOINT ["/%%ENTRYPOINT%%"]
|
||||||
CMD ["%%CMD%%"]
|
CMD ["%%CMD%%"]
|
||||||
|
|
|
@ -116,6 +116,7 @@ ENV FRIENDICA_ADDONS %%VERSION%%
|
||||||
|
|
||||||
COPY *.sh upgrade.exclude /
|
COPY *.sh upgrade.exclude /
|
||||||
COPY config/* /usr/src/friendica/config/
|
COPY config/* /usr/src/friendica/config/
|
||||||
|
COPY bin/* /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/%%ENTRYPOINT%%"]
|
ENTRYPOINT ["/%%ENTRYPOINT%%"]
|
||||||
CMD ["%%CMD%%"]
|
CMD ["%%CMD%%"]
|
||||||
|
|
|
@ -67,7 +67,7 @@ There are three options to enable the cron-job for Friendica:
|
||||||
## Possible Environment Variables
|
## Possible Environment Variables
|
||||||
|
|
||||||
**Friendica Settings**
|
**Friendica Settings**
|
||||||
- `FRIENDICA_ADMIN_MAIL` E-Mail address of the administrator.
|
- `FRIENDICA_URL` The Friendica URL path.
|
||||||
- `FRIENDICA_TZ` The default localization of the Friendica server.
|
- `FRIENDICA_TZ` The default localization of the Friendica server.
|
||||||
- `FRIENDICA_LANG` The default language of the Friendica server.
|
- `FRIENDICA_LANG` The default language of the Friendica server.
|
||||||
- `FRIENDICA_PHP_PATH` The path of the PHP binary.
|
- `FRIENDICA_PHP_PATH` The path of the PHP binary.
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
trap "break;exit" HUP INT TERM
|
trap "break;exit" HUP INT TERM
|
||||||
|
|
||||||
while [ ! -f /var/www/html/config/local.ini.php ] && [ ! -f /var/www/html/config/local.config.php ]; do
|
while [ ! -f /var/www/html/bin/daemon.php ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO let the database and the autoinstall time to complete - not winning a beauty contest
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
sleep 15s
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
exec php /var/www/html/bin/daemon.php -f start
|
exec php /var/www/html/bin/daemon.php -f start
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
|
|
|
@ -17,14 +17,14 @@ version_greater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_ssmtp() {
|
setup_ssmtp() {
|
||||||
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
if [ -n "${FRIENDICA_SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
echo "Setup SSMTP for '$FRIENDICA_SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
smtp_from=${SMTP_FROM:-no-reply}
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
# Setup SSMTP
|
# Setup SSMTP
|
||||||
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:root:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
sed -i "s/:Linux\ User:/:${FRIENDICA_SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
# add possible mail-senders
|
# add possible mail-senders
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
echo "New Friendica instance"
|
echo "New Friendica instance"
|
||||||
|
|
||||||
install=false
|
install=false
|
||||||
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n ${FRIENDICA_ADMIN_MAIL+x} ]; then
|
if [ -n "${MYSQL_DATABASE+x}" ] && [ -n "${MYSQL_PASSWORD+x}" ] && [ -n "${MYSQL_HOST+x}" ] && [ -n "${MYSQL_USER+x}" -o -n "${MYSQL_USERNAME+x}" ] && [ -n "${FRIENDICA_ADMIN_MAIL+x}" ] && [ -n "${FRIENDICA_URL+x}" ]; then
|
||||||
echo "Installation with environment variables"
|
echo "Installation with environment variables"
|
||||||
|
|
||||||
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
FRIENDICA_PHP_PATH=${FRIENDICA_PHP_PATH:-/usr/local/php}
|
||||||
|
@ -117,22 +117,17 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
install_options='-s --dbhost "'$MYSQL_HOST'" --dbport "'$MYSQL_PORT'" --dbdata "'$MYSQL_DATABASE'" --dbuser "'$MYSQL_USERNAMEFULL'" --dbpass "'$MYSQL_PASSWORD'"'
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'"'
|
install_options=$install_options' --admin "'$FRIENDICA_ADMIN_MAIL'" --tz "'$FRIENDICA_TZ'" --lang "'$FRIENDICA_LANG'" --url "'$FRIENDICA_URL'"'
|
||||||
install=true
|
|
||||||
elif [ -f "/usr/src/config/local.config.php" ]; then
|
|
||||||
echo "Installation with prepared local.config.php"
|
|
||||||
|
|
||||||
install_options="-f /usr/src/local.config.php"
|
|
||||||
install=true
|
install=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
|
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||||
|
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||||
|
|
||||||
echo "Starting Friendica installation ..."
|
echo "Starting Friendica installation ..."
|
||||||
# TODO Let the database time to warm up - not winning a beauty contest
|
|
||||||
sleep 10s
|
|
||||||
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
||||||
|
|
||||||
# TODO Workaround because of a strange permission issue
|
|
||||||
rm -fr /var/www/html/view/smarty3/compiled
|
rm -fr /var/www/html/view/smarty3/compiled
|
||||||
|
|
||||||
# load other config files (*.config.php) to the config folder
|
# load other config files (*.config.php) to the config folder
|
||||||
|
@ -141,6 +136,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installation finished"
|
echo "Installation finished"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Running web-based installer on first connect!"
|
echo "Running web-based installer on first connect!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -135,6 +135,7 @@ function create_variant() {
|
||||||
cp upgrade.exclude "$dir/"
|
cp upgrade.exclude "$dir/"
|
||||||
|
|
||||||
cp -rT .config "$dir/config"
|
cp -rT .config "$dir/config"
|
||||||
|
cp -rT .bin "$dir/bin"
|
||||||
|
|
||||||
travisEnvAmd64='\n - env: VERSION='"$dockerName"' VARIANT='"$variant"' ARCH=amd64'"$travisEnvAmd64"
|
travisEnvAmd64='\n - env: VERSION='"$dockerName"' VARIANT='"$variant"' ARCH=amd64'"$travisEnvAmd64"
|
||||||
for arch in i386 amd64; do
|
for arch in i386 amd64; do
|
||||||
|
|
Loading…
Add table
Reference in a new issue