Jumpstarter

0

This is a plugin for WordPress installations in a Jumpstarter container environment. The main purpose is to combat the problems one encounters when running WordPress in a container envi

Version
Last updated
Active installations
WordPress Version
Tested up to
Rating
Total ratings
This plugin is outdated and might not be supported anymore.

Description

This is a plugin for WordPress installations in a Jumpstarter container environment. The main purpose is to combat the problems one encounters when running WordPress in a container environment under nginx behind multiple http proxy layers.

The plugin is divided into two distinct parts.

  1. The installer/environment synchronizer (js-init.php).
  2. The actual plugin (jumpstarter.php).

The installer

The installer takes care of the following:

  1. Install WordPress if /app/code/wp-db does not exist.
  2. Sync the /app/env.json and /app/code/wp-env.json environments with WordPress.

Install is done the following way:

  1. Configure security salts in wp-config.php if not done already.
  2. Clean up previous failed or aborted installations.
  3. Install WordPress to RAM (in /tmp) to get rid of waiting for disk sync.
  4. Activating core plugins (jumpstarter and sqlite-integration).
  5. Setting the theme specified in wp-env.json.
  6. Run WordPress install hooks registered with add_action("jumpstarter_install",...).
  7. Atomically move the database in place. This allows the install to be idempotent.
  8. Restart by execve’ing itself so environment sync can run.

Environment sync is done the following way:

  1. Setting nginx fastcgi_param HTTPS to “on”/”off” depending on configured domains for the container.
  2. Opening and parsing /app/code/wp-env.json.
  3. If the siteurl has changed it performs a safe search/replace of siteurl in wp_posts, wp_postmeta and wp_options.
  4. Set theme specified in theme if not changed by the user.
  5. Update options specified in options.
  6. Opening and parsing /app/env.json.
  7. Update user details if they are admin default.
  8. Call the hook jumpstarter_sync_env to let themes/plugins modify database state depending on the env.

It also prints logging and error information to stderr.

The plugin

The plugin takes care of the following:

  • Sandboxes all users and overrides any user capabilities defined in /app/code/wp-env.json.
  • Injects a login link to support Jumpstarter reflected login on /wp-login.php.
  • Handles login requests from Jumpstarter by authenticating posts of jumpstarter-auth-token. On successful authentication the user is logged in as the admin user.
  • Hooks in on set_url_scheme and uses the env to determine if the url should use http or https.
  • Disables the possibility to delete the theme that’s specified in the wp env.
  • Rewrites urls passed to wp_enqueue_script and wp_enqueue_style depending on if SSL is on or not.