From 8dfe2097992307b572b42647b53a76dd5d93aaa9 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 11 Jan 2021 22:36:50 +0100 Subject: Possiblity to autoinstall in Docker Compose (#3353) * Possiblity to autoinstall in Docker Compose #fix https://github.com/FreshRSS/FreshRSS/issues/3349 It is simply calling our existing CLI: do-install.php and create-user.php https://github.com/FreshRSS/FreshRSS/tree/master/cli FreshRSS will typically be ready a few seconds before the database, so introduce a tolerance when the database is not available / up (yet) by trying a few times to connect. Also useful to avoid service interruption when DB service is restarted. Example: ```yml freshrss-app: image: freshrss/freshrss container_name: freshrss-app hostname: freshrss-app restart: unless-stopped ports: - "8080:80" depends_on: - freshrss-db volumes: - data:/var/www/FreshRSS/data - extensions:/var/www/FreshRSS/extensions environment: CRON_MIN: '*/20' FRESHRSS_ENV: development FRESHRSS_INSTALL: |- --api_enabled --base_url https://rss.example.net --db-base freshrss --db-host freshrss-db --db-password freshrss --db-type pgsql --db-user freshrss --default_user admin --language en FRESHRSS_USER: |- --api_password freshrss --email user@example.net --language en --password freshrss --user admin TZ: Europe/Paris ``` * Minor type f in find * shellcheck --- cli/do-install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli/do-install.php') diff --git a/cli/do-install.php b/cli/do-install.php index fd51003ab..258b5b688 100755 --- a/cli/do-install.php +++ b/cli/do-install.php @@ -3,7 +3,7 @@ require(__DIR__ . '/_cli.php'); if (!file_exists(DATA_PATH . '/do-install.txt')) { - fail('FreshRSS seems to be already installed! Please use `./cli/reconfigure.php` instead.'); + fail('FreshRSS seems to be already installed!' . "\n" . 'Please use `./cli/reconfigure.php` instead.', EXIT_CODE_ALREADY_EXISTS); } $params = array( @@ -107,7 +107,7 @@ if (!$ok) { fail('FreshRSS database error: ' . (empty($_SESSION['bd_error']) ? 'Unknown error' : $_SESSION['bd_error'])); } -echo '• Remember to create the default user: ', $config['default_user'] , "\n", +echo 'ℹ️ Remember to create the default user: ', $config['default_user'], "\t", './cli/create-user.php --user ', $config['default_user'], " --password 'password' --more-options\n"; accessRights(); -- cgit v1.2.3