Browse Source

Platformize

Nikola Kotur 3 years ago
parent
commit
ddcd5ad2de
5 changed files with 112 additions and 0 deletions
  1. 51 0
      .platform.app.yaml
  2. 7 0
      .platform/routes.yaml
  3. 11 0
      .platform/services.yaml
  4. 8 0
      README-PSH.md
  5. 35 0
      build-psh.sh

+ 51 - 0
.platform.app.yaml

@@ -0,0 +1,51 @@
+name: app
+type: php:7.4
+
+build:
+    flavor: none
+
+dependencies:
+    php:
+        composer/composer: '^2'
+
+hooks:
+    build: |
+        set -e
+        ./build-psh.sh
+    deploy: |
+        set -e
+
+relationships:
+    database: "db:shlinkdb"
+
+# The size of the persistent disk of the application (in MB).
+disk: 2048
+
+# The mounts that will be performed when the package is deployed.
+mounts:
+    "/build/data/log":
+        source: local
+        source_path: "log"
+    "/build/data/cache":
+        source: local
+        source_path: "cache"
+    "/build/data/locks":
+        source: local
+        source_path: "locks"
+    "/build/data/proxies":
+        source: local
+        source_path: "proxies"
+    "/build/config/params":
+        source: local
+        source_path: "config_params"
+
+web:
+    locations:
+        "/":
+            root: "build/public"
+            passthru: "/index.php"
+
+crons:
+    processIPs:
+        spec: '0 * * * *'
+        cmd: './build/bin/cli visit:locate -q'

+ 7 - 0
.platform/routes.yaml

@@ -0,0 +1,7 @@
+"https://{default}/":
+    type: upstream
+    upstream: "app:http"
+
+"https://www.{default}/":
+    type: redirect
+    to: "https://{default}/"

+ 11 - 0
.platform/services.yaml

@@ -0,0 +1,11 @@
+db:
+    type: mariadb:10.4
+    disk: 2048
+    configuration:
+            schemas:
+              - shlinkdb
+            endpoints:
+                shlinkdb:
+                    default_schema: shlinkdb
+                    privileges:
+                        shlinkdb: admin

+ 8 - 0
README-PSH.md

@@ -0,0 +1,8 @@
+
+```
+platform get y6zmk2ssbramk
+cd y6zmk2ssbramk-shlink/
+git remote add upstream https://github.com/shlinkio/shlink.git
+git fap
+git merge v2.6.2
+```

+ 35 - 0
build-psh.sh

@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+set -e
+
+version=$1
+builtContent="./build"
+composerBin='composer'
+
+# Copy project content to temp dir
+echo 'Copying project files...'
+rm -rf "${builtContent}"
+mkdir -p "${builtContent}"
+rsync -av * "${builtContent}" \
+    --exclude=*docker* \
+    --exclude=Dockerfile \
+    --include=.htaccess \
+    --exclude-from=./.dockerignore
+cd "${builtContent}"
+
+# Remove swoole dependency
+echo "Removing mezzio-swoole..."
+sed -i '/mezzio-swoole/d' composer.json
+
+# Install dependencies
+echo "Installing dependencies with $composerBin..."
+composerFlags="--optimize-autoloader --no-progress --no-interaction"
+${composerBin} install --no-dev --prefer-dist $composerFlags
+
+# Delete development files
+echo 'Deleting dev files...'
+rm composer.*
+
+# Update shlink version in config
+sed -i "s/%SHLINK_VERSION%/${version}/g" config/autoload/app_options.global.php
+
+echo 'Done!'