Pārlūkot izejas kodu

Use manifest v2

Girish Ramakrishnan 5 gadi atpakaļ
vecāks
revīzija
71382b8d86
2 mainītis faili ar 22 papildinājumiem un 22 dzēšanām
  1. 2 2
      CloudronManifest.json
  2. 20 20
      start.sh

+ 2 - 2
CloudronManifest.json

@@ -7,7 +7,7 @@
   "version": "2.6.0-1",
   "healthCheckPath": "/wp-includes/version.php",
   "httpPort": 8000,
-  "manifestVersion": 1,
+  "manifestVersion": 2,
   "website": "https://wordpress.org/",
   "contactEmail": "apps@cloudron.io",
   "icon": "logo.png",
@@ -32,6 +32,6 @@
   "changelog": "file://CHANGELOG",
   "postInstallMessage": "file://POSTINSTALL.md",
   "optionalSso": true,
-  "minBoxVersion": "1.8.1",
+  "minBoxVersion": "4.1.3",
   "documentationUrl": "https://cloudron.io/documentation/apps/wordpress/"
 }

+ 20 - 20
start.sh

@@ -8,16 +8,16 @@ mkdir -p /run/wordpress/sessions /app/data/wp-snapshots
 
 # Detect the wordpress prefix from existing database. This is a bit of a hack because some wordpress plugins
 # seem to leave the old wp_ tables behind.
-table_prefix=$(mysql --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} --host=${MYSQL_HOST} ${MYSQL_DATABASE} -e 'SHOW TABLES' --batch 2>/dev/null | sed -n 's/\(.*_\)usermeta/\1/p' | grep -v ^wp_ | head -n1)
+table_prefix=$(mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e 'SHOW TABLES' --batch 2>/dev/null | sed -n 's/\(.*_\)usermeta/\1/p' | grep -v ^wp_ | head -n1)
 [[ -n "${table_prefix}" ]] || table_prefix="wp_"
 echo "==> Using table prefix ${table_prefix}"
 
 # Settings to be updated on every run. Regenerating salts means users have to relogin
-sed -e "s/##MYSQL_DATABASE/${MYSQL_DATABASE}/" \
-    -e "s/##MYSQL_USERNAME/${MYSQL_USERNAME}/" \
-    -e "s/##MYSQL_PASSWORD/${MYSQL_PASSWORD}/" \
-    -e "s/##MYSQL_HOST/${MYSQL_HOST}:${MYSQL_PORT}/" \
-    -e "s,##APP_ORIGIN,${APP_ORIGIN}," \
+sed -e "s/##MYSQL_DATABASE/${CLOUDRON_MYSQL_DATABASE}/" \
+    -e "s/##MYSQL_USERNAME/${CLOUDRON_MYSQL_USERNAME}/" \
+    -e "s/##MYSQL_PASSWORD/${CLOUDRON_MYSQL_PASSWORD}/" \
+    -e "s/##MYSQL_HOST/${CLOUDRON_MYSQL_HOST}:${CLOUDRON_MYSQL_PORT}/" \
+    -e "s,##APP_ORIGIN,${CLOUDRON_APP_ORIGIN}," \
     -e "s/##AUTH_KEY/$(pwgen -1cns 64)/" \
     -e "s/##SECURE_AUTH_KEY/$(pwgen -1cns 64)/" \
     -e "s/##LOGGED_IN_KEY/$(pwgen -1cns 64)/" \
@@ -45,12 +45,12 @@ if [[ ! -f "/app/data/.dbsetup" ]]; then
     cp -r /app/code/wp-content-vanilla/* /app/data/wp-content/
 
     # note: we cannot delete the admin user in ldap mode because the default posts are assigned to that user
-    admin_password=$([[ -n "${LDAP_SERVER:-}" ]] && pwgen -1y 16 || echo "changeme")
+    admin_password=$([[ -n "${CLOUDRON_LDAP_SERVER:-}" ]] && pwgen -1y 16 || echo "changeme")
     admin_email="admin@cloudron.local"
 
     # --skip-email is part of 0.23.0 https://github.com/wp-cli/wp-cli/pull/2345 and https://github.com/wp-cli/wp-cli/issues/1164
-    $WP --url="${APP_ORIGIN}" --skip-email core install \
-        --url="${APP_ORIGIN}" \
+    $WP --url="${CLOUDRON_APP_ORIGIN}" --skip-email core install \
+        --url="${CLOUDRON_APP_ORIGIN}" \
         --title="My blog" \
         --admin_user=admin \
         --admin_password="${admin_password}" \
@@ -87,7 +87,7 @@ if [[ ! -f "/run/wordpress/plugins_unpacked" ]]; then
     rm -rf /app/data/wp-content/mu-plugins/wp-mail-smtp/
 
     # only install ldap plugin with sso
-    if [[ -n "${LDAP_SERVER:-}" ]]; then
+    if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then
         unzip -d /app/data/wp-content/mu-plugins/ /app/code/authLdap.zip
         mv /app/data/wp-content/mu-plugins/authLdap-*/* /app/data/wp-content/mu-plugins/
         rm -rf /app/data/wp-content/mu-plugins/authLdap-*/
@@ -101,8 +101,8 @@ fi
 echo "==> Updating domain related settings"
 # Note that wp-config already sets WP_HOME and WP_SITEURL and the values in db below are ignored
 # This is only done for keeping the db dumps more useful
-$WP option update siteurl "${APP_ORIGIN}"
-$WP option update home "${APP_ORIGIN}"
+$WP option update siteurl "${CLOUDRON_APP_ORIGIN}"
+$WP option update home "${CLOUDRON_APP_ORIGIN}"
 
 # If the user has not changed the email, update it to reflect it any domain change
 # TODO: remove this after this release
@@ -114,18 +114,18 @@ fi
 # configure WP mail smtp plugin (smtp_user, smtp_pass can be set when supported)
 echo "==> Configuring smtp mail"
 $WP option update mailer smtp
-$WP option update mail_from "${MAIL_FROM}"
+$WP option update mail_from "${CLOUDRON_MAIL_FROM}"
 # Let user customize the mail from name
 if ! $WP option get mail_from_name; then
     $WP option update mail_from_name WordPress
 fi
-$WP option update smtp_host ${MAIL_SMTP_SERVER}
-$WP option update smtp_port ${MAIL_SMTP_PORT}
+$WP option update smtp_host ${CLOUDRON_MAIL_SMTP_SERVER}
+$WP option update smtp_port ${CLOUDRON_MAIL_SMTP_PORT}
 $WP option update smtp_auth true
-$WP option update smtp_user ${MAIL_SMTP_USERNAME}
-$WP option update smtp_pass "${MAIL_SMTP_PASSWORD}"
+$WP option update smtp_user ${CLOUDRON_MAIL_SMTP_USERNAME}
+$WP option update smtp_pass "${CLOUDRON_MAIL_SMTP_PASSWORD}"
 
-if [[ -n "${LDAP_SERVER:-}" ]]; then
+if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then
     # configure LDAP
     # https://github.com/heiglandreas/authLdap/blob/master/authLdap.php#L644
 
@@ -138,14 +138,14 @@ if [[ -n "${LDAP_SERVER:-}" ]]; then
     {
         "Enabled"       : true,
         "CachePW"       : false,
-        "URI"           : "ldap://${LDAP_SERVER}:${LDAP_PORT}/${LDAP_USERS_BASE_DN}",
+        "URI"           : "ldap://${CLOUDRON_LDAP_SERVER}:${CLOUDRON_LDAP_PORT}/${CLOUDRON_LDAP_USERS_BASE_DN}",
         "Filter"        : "(|(mail=%1\$s)(username=%1\$s))",
         "NameAttr"      : "givenName",
         "SecName"       : "sn",
         "UidAttr"       : "username",
         "MailAttr"      : "mail",
         "WebAttr"       : "",
-        "Groups"        : { "administrator" : "cn=admins,${LDAP_GROUPS_BASE_DN}" },
+        "Groups"        : { "administrator" : "cn=admins,${CLOUDRON_LDAP_GROUPS_BASE_DN}" },
         "GroupSeparator": ";",
         "Debug"         : false,
         "GroupAttr"     : "memberof",