From 1a81f10d89d047b687332650517511c0822a46c9 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Tue, 30 Nov 2021 16:11:45 +0000 Subject: [PATCH 1/4] Add a DNS warning during install --- app/config/variables.php | 2 +- app/tasks/install.php | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index e6313a9776..e57f4fb420 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -68,7 +68,7 @@ return [ 'default' => 'localhost', 'required' => true, 'question' => 'Enter a DNS A record hostname to serve as a CNAME for your custom domains.' . PHP_EOL . 'You can use the same value as used for the Appwrite hostname.', - 'filter' => '' + 'filter' => 'domainTarget' ], [ 'name' => '_APP_CONSOLE_WHITELIST_ROOT', diff --git a/app/tasks/install.php b/app/tasks/install.php index 0898ae67c1..24743403ae 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -11,6 +11,19 @@ use Utopia\Config\Config; use Utopia\View; use Utopia\Validator\Text; +function formatArray(array $arr) { + $mask = "%10.10s %-10.10s %10.10s\n"; + printf($mask, "Type", "Name", "Value"); + + // array_walk($arr, function(&$key) use ($descriptionColumnLimit){ + // $key = explode("\n", wordwrap($key, $descriptionColumnLimit)); + // }); + + foreach($arr as $key => $value) { + printf($mask, $key, $value[0], $value[1]); + } +} + $cli ->task('install') ->desc('Install Appwrite') @@ -167,6 +180,16 @@ $cli if(empty($input[$var['name']])) { $input[$var['name']] = $var['default']; } + + if ($var['filter'] === 'domainTarget') { + if ($input[$var['name']] !== 'localhost') { + Console::warning("If you haven't already done so, make sure you create an 'A' or 'AAAA' DNS record for '".$input[$var['name']]."' pointing to your external server IP. \nYour DNS Table should look like so: "); + formatArray([ + 'A/AAAA' => ['@', 'Your IP'], + ]); + Console::warning("Use 'AAAA' if you have an IPv6 address and 'A' if you have an IPv4 address."); + } + } } $templateForCompose = new View(__DIR__.'/../views/install/compose.phtml'); From c1ef83eec74058e8837770a1ac3964f8e27449cf Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 1 Dec 2021 02:39:42 +0400 Subject: [PATCH 2/4] feat: update PR --- app/tasks/install.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 24743403ae..9f3f138dd9 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -11,19 +11,6 @@ use Utopia\Config\Config; use Utopia\View; use Utopia\Validator\Text; -function formatArray(array $arr) { - $mask = "%10.10s %-10.10s %10.10s\n"; - printf($mask, "Type", "Name", "Value"); - - // array_walk($arr, function(&$key) use ($descriptionColumnLimit){ - // $key = explode("\n", wordwrap($key, $descriptionColumnLimit)); - // }); - - foreach($arr as $key => $value) { - printf($mask, $key, $value[0], $value[1]); - } -} - $cli ->task('install') ->desc('Install Appwrite') @@ -183,11 +170,11 @@ $cli if ($var['filter'] === 'domainTarget') { if ($input[$var['name']] !== 'localhost') { - Console::warning("If you haven't already done so, make sure you create an 'A' or 'AAAA' DNS record for '".$input[$var['name']]."' pointing to your external server IP. \nYour DNS Table should look like so: "); - formatArray([ - 'A/AAAA' => ['@', 'Your IP'], - ]); - Console::warning("Use 'AAAA' if you have an IPv6 address and 'A' if you have an IPv4 address."); + Console::info("\nIf you haven't already done so, set the following record for {$input[$var['name']]} on your DNS provider: \n"); + $mask = "%-15.15s %-10.10s %-30.30s\n"; + printf($mask, "Type", "Name", "Value"); + printf($mask, "A or AAAA", "@", ""); + Console::info("\nUse 'AAAA' if you're using an IPv6 address and 'A' if you're using an IPv4 address.\n"); } } } From 859444703faeaee9fb2123aef719cb9c989a3c73 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 1 Dec 2021 02:41:53 +0400 Subject: [PATCH 3/4] feat: update PR --- app/tasks/install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 9f3f138dd9..6ada31d09e 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -170,11 +170,11 @@ $cli if ($var['filter'] === 'domainTarget') { if ($input[$var['name']] !== 'localhost') { - Console::info("\nIf you haven't already done so, set the following record for {$input[$var['name']]} on your DNS provider: \n"); + Console::warning("\nIf you haven't already done so, set the following record for {$input[$var['name']]} on your DNS provider:\n"); $mask = "%-15.15s %-10.10s %-30.30s\n"; printf($mask, "Type", "Name", "Value"); printf($mask, "A or AAAA", "@", ""); - Console::info("\nUse 'AAAA' if you're using an IPv6 address and 'A' if you're using an IPv4 address.\n"); + Console::warning("\nUse 'AAAA' if you're using an IPv6 address and 'A' if you're using an IPv4 address.\n"); } } } From f70e2479062b4c47da0ceff0e3ddf0a49c1c5803 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 9 May 2022 13:13:41 +0100 Subject: [PATCH 4/4] Update app/tasks/install.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matej Bačo --- app/tasks/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 6ada31d09e..da2ad8d5a6 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -173,7 +173,7 @@ $cli Console::warning("\nIf you haven't already done so, set the following record for {$input[$var['name']]} on your DNS provider:\n"); $mask = "%-15.15s %-10.10s %-30.30s\n"; printf($mask, "Type", "Name", "Value"); - printf($mask, "A or AAAA", "@", ""); + printf($mask, "A or AAAA", "@", ""); Console::warning("\nUse 'AAAA' if you're using an IPv6 address and 'A' if you're using an IPv4 address.\n"); } }