Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2571703
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/bin/configure.sh b/bin/configure.sh
index 221337a2..92bf60ff 100755
--- a/bin/configure.sh
+++ b/bin/configure.sh
@@ -1,76 +1,81 @@
#!/bin/bash
# Uninstall the old config
if [ -d config ]; then
echo "Uninstalling the old config."
find -L config/ -type f | while read file; do
file=$(echo $file | sed -e 's|^config||g')
file="./$file"
rm -v $file
done
fi
if [ "$1" == "" ]; then
echo "Failed to find the configuration folder, please pass one as argument (e.g. config.demo)."
exit 1
fi
if [ ! -d $1 ]; then
echo "Failed to find the configuration folder, please pass one as argument (e.g. config.demo)."
exit 1
fi
echo "Installing $1."
# Link new config
rm config
ln -s $1 config
# Install new config
find -L config/ -type f | while read file; do
dir=$(dirname $file | sed -e 's|^config||g')
dir="./$dir"
if [ ! -d $dir ]; then
mkdir -p $dir
fi
cp -v $file $dir/
done
# Generate random secrets
if ! grep -q "COTURN_STATIC_SECRET" .env; then
COTURN_STATIC_SECRET=$(openssl rand -hex 32);
echo "COTURN_STATIC_SECRET=${COTURN_STATIC_SECRET}" >> src/.env
fi
if ! grep -q "MEET_WEBHOOK_TOKEN" .env; then
MEET_WEBHOOK_TOKEN=$(openssl rand -hex 32);
echo "MEET_WEBHOOK_TOKEN=${MEET_WEBHOOK_TOKEN}" >> src/.env
fi
if ! grep -q "MEET_SERVER_TOKEN" .env; then
MEET_SERVER_TOKEN=$(openssl rand -hex 32);
echo "MEET_SERVER_TOKEN=${MEET_SERVER_TOKEN}" >> src/.env
fi
+if ! grep -q "APP_KEY=base64:" .env; then
+ APP_KEY=$(openssl rand -base64 32);
+ echo "APP_KEY=base64:${APP_KEY}" >> src/.env
+fi
+
# Customize configuration
sed -i \
-e "s/{{ host }}/${HOST:-kolab.local}/g" \
-e "s/{{ openexchangerates_api_key }}/${OPENEXCHANGERATES_API_KEY}/g" \
-e "s/{{ firebase_api_key }}/${FIREBASE_API_KEY}/g" \
-e "s/{{ public_ip }}/${PUBLIC_IP:-172.18.0.1}/g" \
-e "s/{{ admin_password }}/${ADMIN_PASSWORD}/g" \
src/.env
if [ -f /etc/letsencrypt/live/${HOST}/cert.pem ]; then
echo "Using the available letsencrypt certificate for ${HOST}"
cat >> .env << EOF
KOLAB_SSL_CERTIFICATE=/etc/letsencrypt/live/${HOST}/cert.pem
KOLAB_SSL_CERTIFICATE_FULLCHAIN=/etc/letsencrypt/live/${HOST}/fullchain.pem
KOLAB_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/${HOST}/privkey.pem
PROXY_SSL_CERTIFICATE=/etc/letsencrypt/live/${HOST}/fullchain.pem
PROXY_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/${HOST}/privkey.pem
EOF
fi
diff --git a/config.demo/src/database/seeds/AppKeySeeder.php b/config.demo/src/database/seeds/AppKeySeeder.php
deleted file mode 100644
index 56063a9e..00000000
--- a/config.demo/src/database/seeds/AppKeySeeder.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-namespace Database\Seeds;
-
-use Laravel\Passport\Passport;
-use Illuminate\Database\Seeder;
-use Illuminate\Encryption\Encrypter;
-
-class AppKeySeeder extends Seeder
-{
- /**
- * Run the database seeds.
- *
- * This emulates './artisan key:generate'
- *
- * @return void
- */
- public function run()
- {
- $key = $this->generateRandomKey();
- $this->writeNewEnvironmentFileWith($key);
- }
-
- /**
- * Generate a random key for the application.
- *
- * @return string
- */
- protected function generateRandomKey()
- {
- return 'base64:' . base64_encode(
- Encrypter::generateKey(\config('app.cipher'))
- );
- }
-
- /**
- * Write a new environment file with the given key.
- *
- * @param string $key
- * @return void
- */
- protected function writeNewEnvironmentFileWith($key)
- {
- file_put_contents(\app()->environmentFilePath(), preg_replace(
- $this->keyReplacementPattern(),
- 'APP_KEY=' . $key,
- file_get_contents(\app()->environmentFilePath())
- ));
- }
-
- /**
- * Get a regex pattern that will match env APP_KEY with any random key.
- *
- * @return string
- */
- protected function keyReplacementPattern()
- {
- $escaped = preg_quote('=' . \config('app.key'), '/');
- return "/^APP_KEY{$escaped}/m";
- }
-}
diff --git a/config.demo/src/database/seeds/DatabaseSeeder.php b/config.demo/src/database/seeds/DatabaseSeeder.php
index bef5f2d2..15fde748 100644
--- a/config.demo/src/database/seeds/DatabaseSeeder.php
+++ b/config.demo/src/database/seeds/DatabaseSeeder.php
@@ -1,34 +1,33 @@
<?php
use Illuminate\Database\Seeder;
use Database\Seeds;
// phpcs:ignore
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call([
- Seeds\AppKeySeeder::class,
Seeds\PassportSeeder::class,
Seeds\IP4NetSeeder::class,
Seeds\TenantSeeder::class,
Seeds\DiscountSeeder::class,
Seeds\DomainSeeder::class,
Seeds\SkuSeeder::class,
Seeds\PackageSeeder::class,
Seeds\PlanSeeder::class,
Seeds\PowerDNSSeeder::class,
Seeds\UserSeeder::class,
Seeds\OauthClientSeeder::class,
Seeds\ResourceSeeder::class,
Seeds\SharedFolderSeeder::class,
Seeds\MeetRoomSeeder::class,
]);
}
}
diff --git a/config.prod/src/database/seeds/AppKeySeeder.php b/config.prod/src/database/seeds/AppKeySeeder.php
deleted file mode 100644
index 56063a9e..00000000
--- a/config.prod/src/database/seeds/AppKeySeeder.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-namespace Database\Seeds;
-
-use Laravel\Passport\Passport;
-use Illuminate\Database\Seeder;
-use Illuminate\Encryption\Encrypter;
-
-class AppKeySeeder extends Seeder
-{
- /**
- * Run the database seeds.
- *
- * This emulates './artisan key:generate'
- *
- * @return void
- */
- public function run()
- {
- $key = $this->generateRandomKey();
- $this->writeNewEnvironmentFileWith($key);
- }
-
- /**
- * Generate a random key for the application.
- *
- * @return string
- */
- protected function generateRandomKey()
- {
- return 'base64:' . base64_encode(
- Encrypter::generateKey(\config('app.cipher'))
- );
- }
-
- /**
- * Write a new environment file with the given key.
- *
- * @param string $key
- * @return void
- */
- protected function writeNewEnvironmentFileWith($key)
- {
- file_put_contents(\app()->environmentFilePath(), preg_replace(
- $this->keyReplacementPattern(),
- 'APP_KEY=' . $key,
- file_get_contents(\app()->environmentFilePath())
- ));
- }
-
- /**
- * Get a regex pattern that will match env APP_KEY with any random key.
- *
- * @return string
- */
- protected function keyReplacementPattern()
- {
- $escaped = preg_quote('=' . \config('app.key'), '/');
- return "/^APP_KEY{$escaped}/m";
- }
-}
diff --git a/config.prod/src/database/seeds/DatabaseSeeder.php b/config.prod/src/database/seeds/DatabaseSeeder.php
index b6b4d24a..9388bf56 100644
--- a/config.prod/src/database/seeds/DatabaseSeeder.php
+++ b/config.prod/src/database/seeds/DatabaseSeeder.php
@@ -1,24 +1,23 @@
<?php
use Illuminate\Database\Seeder;
use Database\Seeds;
// phpcs:ignore
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call([
- Seeds\AppKeySeeder::class,
Seeds\PassportSeeder::class,
Seeds\PowerDNSSeeder::class,
Seeds\SkuSeeder::class,
Seeds\AdminSeeder::class,
]);
}
}
diff --git a/docker/webapp/init.sh b/docker/webapp/init.sh
index efe32b55..236bfee9 100755
--- a/docker/webapp/init.sh
+++ b/docker/webapp/init.sh
@@ -1,32 +1,31 @@
#!/bin/bash
set -e
rm -rf /src/kolabsrc
cp -a /src/kolabsrc.orig /src/kolabsrc
cd /src/kolabsrc
rm -rf vendor/ composer.lock .npm storage/framework
mkdir -p storage/framework/{sessions,views,cache}
php -dmemory_limit=-1 $(command -v composer) install
npm install
find bootstrap/cache/ -type f ! -name ".gitignore" -delete
-./artisan key:generate
./artisan storage:link
./artisan clear-compiled
./artisan cache:clear
./artisan horizon:install
if [ ! -f 'resources/countries.php' ]; then
./artisan data:countries
fi
npm run dev
./artisan db:ping --wait
php -dmemory_limit=512M ./artisan migrate --force
if test "$( env APP_DEBUG=false ./artisan -n users | wc -l )" -lt "1"; then
php -dmemory_limit=512M ./artisan db:seed
fi
./artisan data:import || :
nohup ./artisan horizon >/dev/null 2>&1 &
./artisan octane:start --host=$(grep OCTANE_HTTP_HOST .env | tail -n1 | sed "s/OCTANE_HTTP_HOST=//")
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Mar 19, 8:52 AM (20 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
458527
Default Alt Text
(8 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment