summaryrefslogtreecommitdiff
path: root/bin/setup.php
diff options
context:
space:
mode:
Diffstat (limited to 'bin/setup.php')
-rwxr-xr-xbin/setup.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/setup.php b/bin/setup.php
new file mode 100755
index 0000000..ade01c6
--- /dev/null
+++ b/bin/setup.php
@@ -0,0 +1,28 @@
+#!/usr/bin/env php
+
+<?php
+
+$rootDir = dirname(__DIR__);
+$buildDir = "$rootDir/build";
+
+// check if .env is propery set
+if (! file_exists("$buildDir/.env")) {
+ copy("$rootDir/.env.example", "$buildDir/.env");
+ exit('Adjust .env in build directory first.');
+}
+else if (strpos(file_get_contents("$buildDir/.env"), 'example.org') !== false) {
+ exit('Adjust .env in build directory first.');
+}
+
+// load .env
+$dotenv = \Dotenv\Dotenv::createImmutable($buildDir);
+$dotenv->load();
+
+// change to build dir
+chdir($buildDir);
+
+// create .env.production for mastodon setup
+exec("touch $buildDir/.env.production");
+
+// run mastodon:setup
+exec("docker-compose run --rm -v $buildDir/.env.production:/opt/mastodon/.env.production web bundle exec rake mastodon:setup");