From 617d57d9e4c2e30d824ed6b3bfec27e22cae26ad Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 23 Dec 2024 16:23:48 +0100 Subject: [PATCH] add nineschool --- .gitignore | 2 +- env/.env | 16 +- .../piwigo/containers/piwigo/Dockerfile | 11 + .../containers/piwigo/install-silent.php | 428 ++++++++++++++ .../containers/piwigo/update-silent.php | 540 ++++++++++++++++++ .../piwigo/volumes/config/database.inc.php | 15 + nine.sh | 1 + .../dockercompose/dockercompose.yml | 4 +- services/{01-mta => 30-mta}/env/.env | 0 services/{01-mta => 30-mta}/misc/nine.sh | 0 .../secrets/postfix_password.txt | 0 services/50-ninegate/env/.env | 3 + services/50-nineschool/apache/apache.conf | 4 + .../dockercompose/dockercompose.yml | 14 + services/50-nineschool/env/.env | 16 + services/50-nineschool/misc/nine.sh | 45 ++ services/50-piwigo/apache/apache.conf | 3 + .../50-piwigo/dockercompose/dockercompose.yml | 18 + services/50-piwigo/env/.env | 15 + services/50-piwigo/misc/nine.sh | 45 ++ 20 files changed, 1175 insertions(+), 5 deletions(-) create mode 100644 misc/images/piwigo/containers/piwigo/Dockerfile create mode 100644 misc/images/piwigo/containers/piwigo/install-silent.php create mode 100644 misc/images/piwigo/containers/piwigo/update-silent.php create mode 100644 misc/images/piwigo/volumes/config/database.inc.php rename services/{01-mta => 30-mta}/dockercompose/dockercompose.yml (69%) rename services/{01-mta => 30-mta}/env/.env (100%) rename services/{01-mta => 30-mta}/misc/nine.sh (100%) rename services/{01-mta => 30-mta}/secrets/postfix_password.txt (100%) create mode 100644 services/50-nineschool/apache/apache.conf create mode 100644 services/50-nineschool/dockercompose/dockercompose.yml create mode 100644 services/50-nineschool/env/.env create mode 100644 services/50-nineschool/misc/nine.sh create mode 100644 services/50-piwigo/apache/apache.conf create mode 100644 services/50-piwigo/dockercompose/dockercompose.yml create mode 100644 services/50-piwigo/env/.env create mode 100644 services/50-piwigo/misc/nine.sh diff --git a/.gitignore b/.gitignore index 4fc8ef6..b86c7c5 100644 --- a/.gitignore +++ b/.gitignore @@ -20,11 +20,11 @@ docker-compose.yml /services/50-nextcloud/volume/html /services/50-nextcloud/volume/app -/services/50-nineboard/volume/data /services/50-nineboard/volume/data /services/50-ninefolio/volume/data /services/50-ninefolio/volume/apache /services/50-ninegate/volume/data +/services/50-nineschool/volume/data /services/50-nineskeletor/volume/data/private/* !/services/50-nineskeletor/volume/data/private/.gitkeep diff --git a/env/.env b/env/.env index cf4a0e1..dafa2fc 100644 --- a/env/.env +++ b/env/.env @@ -187,7 +187,7 @@ NINEBOARD_URL=${PROTOCOLE}://${WEB_URL}/nineboard # NINEFOLIO NINEFOLIO_SERVICE_NAME=ninefolio -NINEFOLIO_ACTIVATE=1 +NINEFOLIO_ACTIVATE=0 NINEFOLIO_LOCAL=1 NINEFOLIO_URL=${PROTOCOLE}://${WEB_URL}/ninefolio @@ -197,12 +197,24 @@ NINEGATE_ACTIVATE=1 NINEGATE_LOCAL=1 NINEGATE_URL=${PROTOCOLE}://${WEB_URL}/ninegate +# NINESCHOOL +NINESCHOOL_SERVICE_NAME=nineschool +NINESCHOOL_ACTIVATE=1 +NINESCHOOL_LOCAL=1 +NINESCHOOL_URL=${PROTOCOLE}://${WEB_URL}/nineschool + # NINESKELETOR NINESKELETOR_SERVICE_NAME=nineskeletor -NINESKELETOR_ACTIVATE=1 +NINESKELETOR_ACTIVATE=0 NINESKELETOR_LOCAL=1 NINESKELETOR_URL=${PROTOCOLE}://${WEB_URL}/nineskeletor +# PIWIGO +PIWIGO_SERVICE_NAME=piwigo +PIWIGO_ACTIVATE=0 +PIWIGO_LOCAL=1 +PIWIGO_URL=${PROTOCOLE}://${WEB_URL}/piwigo + # WORDPRESS WORDPRESS_SERVICE_NAME=wordpress WORDPRESS_ACTIVATE=1 diff --git a/misc/images/piwigo/containers/piwigo/Dockerfile b/misc/images/piwigo/containers/piwigo/Dockerfile new file mode 100644 index 0000000..b7ad06a --- /dev/null +++ b/misc/images/piwigo/containers/piwigo/Dockerfile @@ -0,0 +1,11 @@ +FROM reg.cadoles.com/envole/nineapache:8.1 +RUN apk add php81-mysqli + +RUN cd /app/public +RUN wget https://fr.piwigo.org/download/dlcounter.php?code=latest --output-document=/app/piwigo.zip +RUN rm -rf /app/public +RUN unzip /app/piwigo.zip -d /app +RUN mv /app/piwigo /app/public +COPY install-silent.php /app/public/ +COPY update-silent.php /app/public/ +RUN rm -rf /app/piwigo.zip diff --git a/misc/images/piwigo/containers/piwigo/install-silent.php b/misc/images/piwigo/containers/piwigo/install-silent.php new file mode 100644 index 0000000..dbe3c69 --- /dev/null +++ b/misc/images/piwigo/containers/piwigo/install-silent.php @@ -0,0 +1,428 @@ + $language, 'target_charset'=>'utf-8')); +echo "========================\n\n\n"; +load_language('admin.lang', '', array('language' => $language, 'target_charset'=>'utf-8')); +echo "========================\n\n\n"; +load_language('install.lang', '', array('language' => $language, 'target_charset'=>'utf-8')); +echo "========================\n\n\n"; +*/ + + +//----------------------------------------------------- template initialization +$template = new Template(PHPWG_ROOT_PATH.'admin/themes', 'clear'); +$template->set_filenames( array('install' => 'install.tpl') ); +if (!isset($step)) +{ + $step = 1; +} +//---------------------------------------------------------------- form analyze +include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$dblayer.'.inc.php'); +include(PHPWG_ROOT_PATH . 'admin/include/functions_install.inc.php'); +include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php'); + + + install_db_connect($infos, $errors); + + if (count($errors) > 0) + { + print_r($errors); + } + + pwg_db_check_charset(); + + $webmaster = trim(preg_replace('/\s{2,}/', ' ', $admin_name)); + if (empty($webmaster)) + { + $errors[] = l10n('enter a login for webmaster'); + } + else if (preg_match( '/[\'"]/', $webmaster)) + { + $errors[] = l10n('webmaster login can\'t contain characters \' or "'); + } + if ($admin_pass1 != $admin_pass2 || empty($admin_pass1)) + { + $errors[] = l10n('please enter your password again'); + } + if (empty($admin_mail)) + { + $errors[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'); + } + else + { + $error_mail_address = validate_mail_address(null, $admin_mail); + if (!empty($error_mail_address)) + { + $errors[] = $error_mail_address; + } + } + + if ( count( $errors ) == 0 ) + { + $step = 2; + $file_content = ''; + + @umask(0111); + // writing the configuration file + if ( !($fp = @fopen( $config_file, 'w' ))) + { + // make sure nobody can list files of _data directory + secure_directory(PHPWG_ROOT_PATH.$conf['data_location']); + + $tmp_filename = md5(uniqid(time())); + $fh = @fopen( PHPWG_ROOT_PATH.$conf['data_location'] . 'pwg_' . $tmp_filename, 'w' ); + @fputs($fh, $file_content, strlen($file_content)); + @fclose($fh); + + $template->assign( + array( + 'config_creation_failed' => true, + 'config_url' => 'install.php?dl='.$tmp_filename, + 'config_file_content' => $file_content, + ) + ); + } + @fputs($fp, $file_content, strlen($file_content)); + @fclose($fp); + + // tables creation, based on piwigo_structure.sql + echo "************************here"; + execute_sqlfile( + PHPWG_ROOT_PATH.'install/piwigo_structure-mysql.sql', + DEFAULT_PREFIX_TABLE, + $prefixeTable, + 'mysql' + ); + // We fill the tables with basic informations + execute_sqlfile( + PHPWG_ROOT_PATH.'install/config.sql', + DEFAULT_PREFIX_TABLE, + $prefixeTable, + 'mysql' + ); + + $query = ' +INSERT INTO '.$prefixeTable.'config (param,value,comment) + VALUES (\'secret_key\',\''.sha1(random_bytes(1000)).'\', + \'a secret key specific to the gallery for internal use\');'; + pwg_query($query); + + conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION)); + conf_update_param('gallery_title', pwg_db_real_escape_string(l10n('Just another Piwigo gallery'))); + + conf_update_param( + 'page_banner', + '

%gallery_title%

'."\n\n

".pwg_db_real_escape_string(l10n('Welcome to my photo gallery')).'

' + ); + + // fill languages table, only activate the current language + $languages->perform_action('activate', $language); + + // fill $conf global array + load_conf_from_db(); + + // PWG_CHARSET is required for building the fs_themes array in the + // themes class + if (!defined('PWG_CHARSET')) + { + define('PWG_CHARSET', 'utf-8'); + } + activate_core_themes(); + activate_core_plugins(); + + $insert = array( + 'id' => 1, + 'galleries_url' => PHPWG_ROOT_PATH.'galleries/', + ); + mass_inserts(SITES_TABLE, array_keys($insert), array($insert)); + + // webmaster admin user + $inserts = array( + array( + 'id' => 1, // must be the same value as webmaster_id in config.sql + 'username' => $admin_name, + 'password' => md5($admin_pass1), + 'mail_address' => $admin_mail, + ), + array( + 'id' => 2, + 'username' => 'guest', + ), + ); + mass_inserts(USERS_TABLE, array_keys($inserts[0]), $inserts); + + create_user_infos(array(1,2), array('language' => $language)); + + // Available upgrades must be ignored after a fresh installation. To + // make PWG avoid upgrading, we must tell it upgrades have already been + // made. + list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); + define('CURRENT_DATE', $dbnow); + $datas = array(); + foreach (get_available_upgrade_ids() as $upgrade_id) + { + $datas[] = array( + 'id' => $upgrade_id, + 'applied' => CURRENT_DATE, + 'description' => 'upgrade included in installation', + ); + } + mass_inserts( + UPGRADE_TABLE, + array_keys($datas[0]), + $datas + ); + } + + +//------------------------------------------------------ start template output +foreach ($languages->fs_languages as $language_code => $fs_language) +{ + if ($language == $language_code) + { + $template->assign('language_selection', $language_code); + } + $languages_options[$language_code] = $fs_language['name']; +} +$template->assign('language_options', $languages_options); + +$template->assign( + array( + 'T_CONTENT_ENCODING' => 'utf-8', + 'RELEASE' => PHPWG_VERSION, + 'F_ACTION' => 'install.php?language=' . $language, + 'F_DB_HOST' => $dbhost, + 'F_DB_USER' => $dbuser, + 'F_DB_NAME' => $dbname, + 'F_DB_PREFIX' => $prefixeTable, + 'F_ADMIN' => $admin_name, + 'F_ADMIN_EMAIL' => $admin_mail, + 'EMAIL' => ''.$admin_mail.'', + 'F_NEWSLETTER_SUBSCRIBE' => $is_newsletter_subscribe, + 'L_INSTALL_HELP' => l10n('Need help ? Ask your question on Piwigo message board.', PHPWG_URL.'/forum'), + )); + +//------------------------------------------------------ errors & infos display +if ($step == 1) +{ + $template->assign('install', true); +} +else +{ + pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'install', array('version'=>PHPWG_VERSION)); + $infos[] = l10n('Congratulations, Piwigo installation is completed'); + + if (isset($error_copy)) + { + $errors[] = $error_copy; + } + else + { + session_set_save_handler('pwg_session_open', + 'pwg_session_close', + 'pwg_session_read', + 'pwg_session_write', + 'pwg_session_destroy', + 'pwg_session_gc' + ); + if ( function_exists('ini_set') ) + { + ini_set('session.use_cookies', $conf['session_use_cookies']); + ini_set('session.use_only_cookies', $conf['session_use_only_cookies']); + ini_set('session.use_trans_sid', intval($conf['session_use_trans_sid'])); + ini_set('session.cookie_httponly', 1); + } + session_name($conf['session_name']); + session_set_cookie_params(0, cookie_path()); + register_shutdown_function('session_write_close'); + + $user = build_user(1, true); + log_user($user['id'], false); + + // newsletter subscription + if ($is_newsletter_subscribe) + { + fetchRemote( + get_newsletter_subscribe_base_url($language).$admin_mail, + $result, + array(), + array('origin' => 'installation') + ); + + userprefs_update_param('show_newsletter_subscription', false); + } + + // email notification + if (isset($_POST['send_credentials_by_mail'])) + { + include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); + + $keyargs_content = array( + get_l10n_args('Hello %s,', $admin_name), + get_l10n_args('Welcome to your new installation of Piwigo!', ''), + get_l10n_args('', ''), + get_l10n_args('Here are your connection settings', ''), + get_l10n_args('', ''), + get_l10n_args('Link: %s', get_absolute_root_url()), + get_l10n_args('Username: %s', $admin_name), + get_l10n_args('Password: ********** (no copy by email)', ''), + get_l10n_args('Email: %s', $admin_mail), + get_l10n_args('', ''), + get_l10n_args('Don\'t hesitate to consult our forums for any help: %s', PHPWG_URL), + ); + + pwg_mail( + $admin_mail, + array( + 'subject' => l10n('Just another Piwigo gallery'), + 'content' => l10n_args($keyargs_content), + 'content_format' => 'text/plain', + ) + ); + } + } +} +if (count($errors) != 0) +{ + $template->assign('errors', $errors); +} + +if (count($infos) != 0 ) +{ + $template->assign('infos', $infos); +} + +//----------------------------------------------------------- html code display + +?> diff --git a/misc/images/piwigo/containers/piwigo/update-silent.php b/misc/images/piwigo/containers/piwigo/update-silent.php new file mode 100644 index 0000000..702ad02 --- /dev/null +++ b/misc/images/piwigo/containers/piwigo/update-silent.php @@ -0,0 +1,540 @@ +'); +if ($php_end_tag === false) +{ + die('Cannot find php end tag in '.$config_file); +} + +include($config_file); + +// $conf is not used for users tables - define cannot be re-defined +define('USERS_TABLE', $prefixeTable.'users'); +include_once(PHPWG_ROOT_PATH.'include/constants.php'); +define('PREFIX_TABLE', $prefixeTable); +define('UPGRADES_PATH', PHPWG_ROOT_PATH.'install/db'); + +include_once(PHPWG_ROOT_PATH.'include/functions.inc.php'); +include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); +include_once(PHPWG_ROOT_PATH . 'include/template.class.php'); + +// +-----------------------------------------------------------------------+ +// | functions | +// +-----------------------------------------------------------------------+ + +/** + * list all tables in an array + * + * @return array + */ +function get_tables() +{ + $tables = array(); + + $query = ' +SHOW TABLES +;'; + $result = pwg_query($query); + + while ($row = pwg_db_fetch_row($result)) + { + if (preg_match('/^'.PREFIX_TABLE.'/', $row[0])) + { + $tables[] = $row[0]; + } + } + + return $tables; +} + +/** + * list all columns of each given table + * + * @return array of array + */ +function get_columns_of($tables) +{ + $columns_of = array(); + + foreach ($tables as $table) + { + $query = ' +DESC '.$table.' +;'; + $result = pwg_query($query); + + $columns_of[$table] = array(); + + while ($row = pwg_db_fetch_row($result)) + { + $columns_of[$table][] = $row[0]; + } + } + + return $columns_of; +} + +/** + */ +function print_time($message) +{ + global $last_time; + + $new_time = get_moment(); + // echo '
['.get_elapsed_time($last_time, $new_time).']';
+  // echo ' '.$message;
+  // echo '
'; + flush(); + $last_time = $new_time; +} + +// +-----------------------------------------------------------------------+ +// | playing zone | +// +-----------------------------------------------------------------------+ + +// echo implode('
', get_tables()); +// echo '
'; print_r(get_columns_of(get_tables())); echo '
'; + +// foreach (get_available_upgrade_ids() as $upgrade_id) +// { +// echo $upgrade_id, '
'; +// } + +// +-----------------------------------------------------------------------+ +// | language | +// +-----------------------------------------------------------------------+ +include(PHPWG_ROOT_PATH . 'admin/include/languages.class.php'); +$languages = new languages('utf-8'); +if (isset($_GET['language'])) +{ + $language = strip_tags($_GET['language']); + + if (!in_array($language, array_keys($languages->fs_languages))) + { + $language = PHPWG_DEFAULT_LANGUAGE; + } +} +else +{ + $language = 'en_UK'; + // Try to get browser language + foreach ($languages->fs_languages as $language_code => $fs_language) + { + if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)) + { + $language = $language_code; + break; + } + } +} + +if ('fr_FR' == $language) { + define('PHPWG_DOMAIN', 'fr.piwigo.org'); +} +else if ('it_IT' == $language) { + define('PHPWG_DOMAIN', 'it.piwigo.org'); +} +else if ('de_DE' == $language) { + define('PHPWG_DOMAIN', 'de.piwigo.org'); +} +else if ('es_ES' == $language) { + define('PHPWG_DOMAIN', 'es.piwigo.org'); +} +else if ('pl_PL' == $language) { + define('PHPWG_DOMAIN', 'pl.piwigo.org'); +} +else if ('zh_CN' == $language) { + define('PHPWG_DOMAIN', 'cn.piwigo.org'); +} +else if ('hu_HU' == $language) { + define('PHPWG_DOMAIN', 'hu.piwigo.org'); +} +else if ('ru_RU' == $language) { + define('PHPWG_DOMAIN', 'ru.piwigo.org'); +} +else if ('nl_NL' == $language) { + define('PHPWG_DOMAIN', 'nl.piwigo.org'); +} +else if ('tr_TR' == $language) { + define('PHPWG_DOMAIN', 'tr.piwigo.org'); +} +else if ('da_DK' == $language) { + define('PHPWG_DOMAIN', 'da.piwigo.org'); +} +else if ('pt_BR' == $language) { + define('PHPWG_DOMAIN', 'br.piwigo.org'); +} +else { + define('PHPWG_DOMAIN', 'piwigo.org'); +} +define('PHPWG_URL', 'http://'.PHPWG_DOMAIN); + +load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); +load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); +load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); +load_language( 'upgrade.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); +// check php version +if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<')) +{ + include(PHPWG_ROOT_PATH.'install/php5_apache_configuration.php'); +} + +// +-----------------------------------------------------------------------+ +// | database connection | +// +-----------------------------------------------------------------------+ +include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php'); +include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php'); + +upgrade_db_connect(); +pwg_db_check_charset(); + +list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); +define('CURRENT_DATE', $dbnow); + +// +-----------------------------------------------------------------------+ +// | template initialization | +// +-----------------------------------------------------------------------+ + +$template = new Template(PHPWG_ROOT_PATH.'admin/themes', 'clear'); +$template->set_filenames(array('upgrade'=>'upgrade.tpl')); +$template->assign(array( + 'RELEASE' => PHPWG_VERSION, + 'L_UPGRADE_HELP' => l10n('Need help ? Ask your question on Piwigo message board.', PHPWG_URL.'/forum'), + ) +); + +// +-----------------------------------------------------------------------+ +// | Remote sites are not compatible with Piwigo 2.4+ | +// +-----------------------------------------------------------------------+ + +$has_remote_site = false; + +$query = 'SELECT galleries_url FROM '.SITES_TABLE.';'; +$result = pwg_query($query); +while ($row = pwg_db_fetch_assoc($result)) +{ + if (url_is_remote($row['galleries_url'])) + { + $has_remote_site = true; + } +} + +if ($has_remote_site) +{ + include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php'); + include_once(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php'); + + $page['errors'] = array(); + $step = 3; + updates::upgrade_to('2.3.4', $step, false); + + if (!empty($page['errors'])) + { + //echo ''; + } + + exit(); +} + +// +-----------------------------------------------------------------------+ +// | upgrade choice | +// +-----------------------------------------------------------------------+ + +$tables = get_tables(); +$columns_of = get_columns_of($tables); + +// find the current release +if (!in_array('param', $columns_of[PREFIX_TABLE.'config'])) +{ + // we're in branch 1.3, important upgrade, isn't it? + if (in_array(PREFIX_TABLE.'user_category', $tables)) + { + $current_release = '1.3.1'; + } + else + { + $current_release = '1.3.0'; + } +} +else if (!in_array(PREFIX_TABLE.'user_cache', $tables)) +{ + $current_release = '1.4.0'; +} +else if (!in_array(PREFIX_TABLE.'tags', $tables)) +{ + $current_release = '1.5.0'; +} +else if ( !in_array(PREFIX_TABLE.'plugins', $tables) ) +{ + if (!in_array('auto_login_key', $columns_of[PREFIX_TABLE.'user_infos'])) + { + $current_release = '1.6.0'; + } + else + { + $current_release = '1.6.2'; + } +} +else if (!in_array('md5sum', $columns_of[PREFIX_TABLE.'images'])) +{ + $current_release = '1.7.0'; +} +else if (!in_array(PREFIX_TABLE.'themes', $tables)) +{ + $current_release = '2.0.0'; +} +else if (!in_array('added_by', $columns_of[PREFIX_TABLE.'images'])) +{ + $current_release = '2.1.0'; +} +else if (!in_array('rating_score', $columns_of[PREFIX_TABLE.'images'])) +{ + $current_release = '2.2.0'; +} +else if (!in_array('rotation', $columns_of[PREFIX_TABLE.'images'])) +{ + $current_release = '2.3.0'; +} +else if (!in_array('website_url', $columns_of[PREFIX_TABLE.'comments'])) +{ + $current_release = '2.4.0'; +} +else if (!in_array('nb_available_tags', $columns_of[PREFIX_TABLE.'user_cache'])) +{ + $current_release = '2.5.0'; +} +else if (!in_array('activation_key_expire', $columns_of[PREFIX_TABLE.'user_infos'])) +{ + $current_release = '2.6.0'; +} +else if (!in_array('auth_key_id', $columns_of[PREFIX_TABLE.'history'])) +{ + $current_release = '2.7.0'; +} +else if (!in_array('history_id_to', $columns_of[PREFIX_TABLE.'history_summary'])) +{ + $current_release = '2.8.0'; +} +else +{ + // retrieve already applied upgrades + $query = ' +SELECT id + FROM '.PREFIX_TABLE.'upgrade +;'; + $applied_upgrades = array_from_query($query, 'id'); + + if (!in_array(156, $applied_upgrades)) + { + $current_release = '2.9.0'; + } + else + { + // confirm that the database is in the same version as source code files + conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION)); + + header('Content-Type: text/html; charset='.get_pwg_charset()); + include(UPGRADES_PATH.'/998-database.php'); + include(UPGRADES_PATH.'/999-database.php'); + + //echo 'No upgrade required, the database structure is up to date'; + //echo '
← back to gallery'; + exit(); + } +} + +// +-----------------------------------------------------------------------+ +// | upgrade launch | +// +-----------------------------------------------------------------------+ +$page['infos'] = array(); +$page['errors'] = array(); +$mysql_changes = array(); + +// check_upgrade_access_rights(); + +if (1==1) +// if ((isset($_POST['submit']) or isset($_GET['now'])) +// and check_upgrade()) +{ + define('PHPWG_IN_UPGRADE',true); + $upgrade_file = PHPWG_ROOT_PATH.'install/upgrade_'.$current_release.'.php'; + if (is_file($upgrade_file)) + { + // reset SQL counters + $page['queries_time'] = 0; + $page['count_queries'] = 0; + + $page['upgrade_start'] = get_moment(); + $conf['die_on_sql_error'] = false; + include($upgrade_file); + conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION)); + + // Something to add in database.inc.php? + if (!empty($mysql_changes)) + { + $config_file_contents = + substr($config_file_contents, 0, $php_end_tag) . "\r\n" + . implode("\r\n" , $mysql_changes) . "\r\n" + . substr($config_file_contents, $php_end_tag); + + if (!@file_put_contents($config_file, $config_file_contents)) + { + $page['infos'][] = l10n( + 'In %s, before ?>, insert:', + PWG_LOCAL_DIR.'config/database.inc.php' + ) + .'

'; + } + } + + // Deactivate non standard extensions + deactivate_non_standard_plugins(); + deactivate_non_standard_themes(); + deactivate_templates(); + + $page['upgrade_end'] = get_moment(); + + $template->assign( + 'upgrade', + array( + 'VERSION' => $current_release, + 'TOTAL_TIME' => get_elapsed_time( + $page['upgrade_start'], + $page['upgrade_end'] + ), + 'SQL_TIME' => number_format( + $page['queries_time'], + 3, + '.', + ' ' + ).' s', + 'NB_QUERIES' => $page['count_queries'] + ) + ); + + $page['infos'][] = l10n('Perform a maintenance check in [Administration>Tools>Maintenance] if you encounter any problem.'); + + // Save $page['infos'] in order to restore after maintenance actions + $page['infos_sav'] = $page['infos']; + $page['infos'] = array(); + + $query = ' +REPLACE INTO '.PLUGINS_TABLE.' + (id, state) + VALUES (\'TakeATour\', \'active\') +;'; + pwg_query($query); + + $template->assign( + array( + 'button_label' => l10n('Home'), + 'button_link' => 'index.php', + ) + ); + + // if the webmaster has a session, let's give a link to discover new features + if (!empty($_SESSION['pwg_uid'])) + { + $version_ = str_replace('.', '_', get_branch_from_version(PHPWG_VERSION).'.0'); + + if (file_exists(PHPWG_PLUGINS_PATH .'TakeATour/tours/'.$version_.'/config.inc.php')) + { + // we need the secret key for get_pwg_token() + load_conf_from_db(); + + $template->assign( + array( + 'button_label' => l10n('Discover what\'s new in Piwigo %s', get_branch_from_version(PHPWG_VERSION)), + 'button_link' => 'admin.php?submited_tour_path=tours/'.$version_.'&pwg_token='.get_pwg_token(), + ) + ); + } + } + + // Delete cache data + invalidate_user_cache(true); + $template->delete_compiled_templates(); + + // Restore $page['infos'] in order to hide informations messages from functions calles + // errors messages are not hide + $page['infos'] = $page['infos_sav']; + + } +} + +// +-----------------------------------------------------------------------+ +// | start template output | +// +-----------------------------------------------------------------------+ +else +{ + if (!defined('PWG_CHARSET')) + { + define('PWG_CHARSET', 'utf-8'); + } + + include_once(PHPWG_ROOT_PATH.'admin/include/languages.class.php'); + $languages = new languages(); + + foreach ($languages->fs_languages as $language_code => $fs_language) + { + if ($language == $language_code) + { + $template->assign('language_selection', $language_code); + } + $languages_options[$language_code] = $fs_language['name']; + } + $template->assign('language_options', $languages_options); + + $template->assign('introduction', array( + 'CURRENT_RELEASE' => $current_release, + 'F_ACTION' => 'upgrade.php?language=' . $language)); + + if (!check_upgrade()) + { + $template->assign('login', true); + } +} + +if (count($page['errors']) != 0) +{ + $template->assign('errors', $page['errors']); +} + +if (count($page['infos']) != 0) +{ + $template->assign('infos', $page['infos']); +} + +// +-----------------------------------------------------------------------+ +// | sending html code | +// +-----------------------------------------------------------------------+ + +$template->pparse('upgrade'); +include(UPGRADES_PATH.'/998-database.php'); +include(UPGRADES_PATH.'/999-database.php'); +?> diff --git a/misc/images/piwigo/volumes/config/database.inc.php b/misc/images/piwigo/volumes/config/database.inc.php new file mode 100644 index 0000000..9cd6d40 --- /dev/null +++ b/misc/images/piwigo/volumes/config/database.inc.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/nine.sh b/nine.sh index fb2a80e..1156945 100755 --- a/nine.sh +++ b/nine.sh @@ -175,6 +175,7 @@ dockercompose() { done < "$dir/dockercompose/dockercompose.yml" fi done + cat services.yml secrets.yml networks.yml > docker-compose.yml rm -f services.yml secrets.yml networks.yml diff --git a/services/01-mta/dockercompose/dockercompose.yml b/services/30-mta/dockercompose/dockercompose.yml similarity index 69% rename from services/01-mta/dockercompose/dockercompose.yml rename to services/30-mta/dockercompose/dockercompose.yml index c6a449e..dd1b332 100644 --- a/services/01-mta/dockercompose/dockercompose.yml +++ b/services/30-mta/dockercompose/dockercompose.yml @@ -4,11 +4,11 @@ services: image: postfix container_name: mta restart: unless-stopped - env_file: ./services/01-mta/env/.env.merge + env_file: ./services/30-mta/env/.env.merge networks: - nine-network secrets: - postfix_password secrets: postfix_password: - file: ./services/01-mta/secrets/postfix_password.txt + file: ./services/30-mta/secrets/postfix_password.txt diff --git a/services/01-mta/env/.env b/services/30-mta/env/.env similarity index 100% rename from services/01-mta/env/.env rename to services/30-mta/env/.env diff --git a/services/01-mta/misc/nine.sh b/services/30-mta/misc/nine.sh similarity index 100% rename from services/01-mta/misc/nine.sh rename to services/30-mta/misc/nine.sh diff --git a/services/01-mta/secrets/postfix_password.txt b/services/30-mta/secrets/postfix_password.txt similarity index 100% rename from services/01-mta/secrets/postfix_password.txt rename to services/30-mta/secrets/postfix_password.txt diff --git a/services/50-ninegate/env/.env b/services/50-ninegate/env/.env index 0322bef..61dfdcf 100644 --- a/services/50-ninegate/env/.env +++ b/services/50-ninegate/env/.env @@ -25,6 +25,9 @@ WIDNEXTCLOUD_URL=${NEXTCLOUD_URL} ACTIVATE_WIDNINEBOARD=${NINEBOARD_ACTIVATE} WIDNINEBOARD_URL=${NINEBOARD_URL} +ACTIVATE_WIDNINESCHOOL=${NINESCHOOL_ACTIVATE} +WIDNINESCHOOL_URL=${NINESCHOOL_URL} + ACTIVATE_WIDWORDPRESS=${WORDPRESS_ACTIVATE} WIDWORDPRESS_URL=${WORDPRESS_URL} diff --git a/services/50-nineschool/apache/apache.conf b/services/50-nineschool/apache/apache.conf new file mode 100644 index 0000000..82e09e5 --- /dev/null +++ b/services/50-nineschool/apache/apache.conf @@ -0,0 +1,4 @@ + +# Nineschool +ProxyPass /nineschool http://nineschool/nineschool retry=0 keepalive=On +ProxyPassReverse /nineschool http://nineschool/nineschool retry=0 diff --git a/services/50-nineschool/dockercompose/dockercompose.yml b/services/50-nineschool/dockercompose/dockercompose.yml new file mode 100644 index 0000000..809b82d --- /dev/null +++ b/services/50-nineschool/dockercompose/dockercompose.yml @@ -0,0 +1,14 @@ +services: + # Nineschool + # Gestion d'activités scolaire + # Port interne 80 + nineschool: + image: reg.cadoles.com/envole/nineschool + container_name: nine-nineschool + restart: unless-stopped + env_file: ./services/50-nineschool/env/.env.merge + networks: + - nine-network + volumes: + - ./services/50-nineschool/volume/data/private:/app/uploads + - ./services/50-nineschool/volume/data/public:/app/public/uploads diff --git a/services/50-nineschool/env/.env b/services/50-nineschool/env/.env new file mode 100644 index 0000000..6065ce8 --- /dev/null +++ b/services/50-nineschool/env/.env @@ -0,0 +1,16 @@ + +# == NINESCHOOL ============================================================================================================================= + +DATABASE_NAME=${NINESCHOOL_SERVICE_NAME} +DATABASE_USER=${MARIADB_USER} +DATABASE_PASSWORD=${MARIADB_PASSWORD} +DATABASE_HOST=${MARIADB_SERVICE_NAME} +WEBURL=${WEB_URL} +APP_AUTH=${MODE_AUTH} +APP_MASTERIDENTITY=${MASTERIDENTITY} +APP_SECRET=${ADMIN_PASSWORD} + + +LDAP_FILTERGROUP=${LDAP_GROUP_FILTER} +LDAP_FILTERUSER=${LDAP_USER_FILTER} + diff --git a/services/50-nineschool/misc/nine.sh b/services/50-nineschool/misc/nine.sh new file mode 100644 index 0000000..1ba4be6 --- /dev/null +++ b/services/50-nineschool/misc/nine.sh @@ -0,0 +1,45 @@ +#!/bin/bash + + +function upnineschool { + if [[ $NINESCHOOL_ACTIVATE == 1 && $NINESCHOOL_LOCAL == 1 ]] + then + Title ${NINESCHOOL_SERVICE_NAME^^} + + if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]] + then + EchoVert "DATABASE" + Echo ${NINESCHOOL_SERVICE_NAME^^} + docker-compose exec $MARIADB_SERVICE_NAME /nine/init.sh $NINESCHOOL_SERVICE_NAME + Echo + fi + + EchoVert "CONTAINER" + upservice ${NINESCHOOL_SERVICE_NAME} + chmod -R a+wr ./services/50-nineschool/volume/data + Echo + fi +} + +function destroynineschool { + if [[ $NINESCHOOL_LOCAL == 1 ]] + then + Title "DESTROY $NINESCHOOL_SERVICE_NAME" + + stop $NINESCHOOL_SERVICE_NAME 1 + docker-compose rm -s -v -f "$NINESCHOOL_SERVICE_NAME" + + if [[ -z $1 ]]; then + Question_ouinon "Souhaitez-vous supprimer la BDD associé à $NINESCHOOL_SERVICE_NAME ?"; + response=$? + fi + if [[ "$response" == 0 || ! -z $1 ]] + then + EchoRouge "Delete BDD = $NINESCHOOL_SERVICE_NAME" + docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $NINESCHOOL_SERVICE_NAME + rm -rf services/50-nineschool/volume/data + fi + + echo "" + fi +} \ No newline at end of file diff --git a/services/50-piwigo/apache/apache.conf b/services/50-piwigo/apache/apache.conf new file mode 100644 index 0000000..84642f3 --- /dev/null +++ b/services/50-piwigo/apache/apache.conf @@ -0,0 +1,3 @@ +# piwigo +ProxyPass /piwigo http://piwigo/piwigo retry=0 keepalive=On +ProxyPassReverse /piwigo http://piwigo/piwigo retry=0 diff --git a/services/50-piwigo/dockercompose/dockercompose.yml b/services/50-piwigo/dockercompose/dockercompose.yml new file mode 100644 index 0000000..f202972 --- /dev/null +++ b/services/50-piwigo/dockercompose/dockercompose.yml @@ -0,0 +1,18 @@ +services: + # piwigo + # Galerie Photos + # Port interne 80 + piwigo: + image: reg.cadoles.com/envole/piwigo + container_name: nine-piwigo + restart: unless-stopped + env_file: ./services/50-piwigo/env/.env.merge + networks: + - nine-network + volumes: + - ./services/50-piwigo/volume/data/config:/config + - ./services/50-piwigo/volume/data/gallery:/gallery + #command: /bin/bash -c "/usr/local/bin/install.sh" + + + \ No newline at end of file diff --git a/services/50-piwigo/env/.env b/services/50-piwigo/env/.env new file mode 100644 index 0000000..3750baa --- /dev/null +++ b/services/50-piwigo/env/.env @@ -0,0 +1,15 @@ +# == PIWIGO =============================================================================================================================== + +PUID=1000 +PGID=1000 +TZ=Etc/UTC + +MYSQL_HOST=${MARIADB_HOST} +MYSQL_USER=${MARIADB_USER} +MYSQL_PASSWORD=${MARIADB_ROOT_PASSWORD} +MYSQL_DATABASE=piwigo + +PIWIGO_ADMIN_USER= +PIWIGO_ADMIN_PASSWORD= +PIWIGO_ADMIN_EMAIL= + diff --git a/services/50-piwigo/misc/nine.sh b/services/50-piwigo/misc/nine.sh new file mode 100644 index 0000000..2933f8d --- /dev/null +++ b/services/50-piwigo/misc/nine.sh @@ -0,0 +1,45 @@ +#!/bin/bash + + +function uppiwigo { + if [[ $PIWIGO_ACTIVATE == 1 && $PIWIGO_LOCAL == 1 ]] + then + Title ${PIWIGO_SERVICE_NAME^^} + + if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]] + then + EchoVert "DATABASE" + Echo ${PIWIGO_SERVICE_NAME^^} + docker-compose exec $MARIADB_SERVICE_NAME /nine/init.sh $PIWIGO_SERVICE_NAME + Echo + fi + + EchoVert "CONTAINER" + upservice ${PIWIGO_SERVICE_NAME} + chmod -R a+wr ./services/50-piwigo/volume/data + Echo + fi +} + +function destroypiwigo { + if [[ $PIWIGO_LOCAL == 1 ]] + then + Title "DESTROY $PIWIGO_SERVICE_NAME" + + stop $PIWIGO_SERVICE_NAME 1 + docker-compose rm -s -v -f "$PIWIGO_SERVICE_NAME" + + if [[ -z $1 ]]; then + Question_ouinon "Souhaitez-vous supprimer la BDD associé à $PIWIGO_SERVICE_NAME ?"; + response=$? + fi + if [[ "$response" == 0 || ! -z $1 ]] + then + EchoRouge "Delete BDD = $PIWIGO_SERVICE_NAME" + docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $PIWIGO_SERVICE_NAME + rm -rf services/50-piwigo/volume/data + fi + + echo "" + fi +} \ No newline at end of file