A frontend to launching ephemeral WordPress instances that auto-destroy after some time.
- An ubuntu box managed by ServerPilot.
- A ServerPilot plan. One of the paid plans. Economy plan is OK. This is to take advantage of multiple sysusers management.
- sshpass installed on the box. (Just
apt-get install sshpass
after you have the Ubuntu box set up). - Have a domain name you fully control.
- Add a wildcard A record for every subdomain under that domain, pointing to the box's IP addresss.
This software is implemented as a WordPress plugin that can be added on top of WordPress and configured via wp-admin.
On plugin activation, this plugin will create two tables on the same database your WordPress is running. Named sites
and purged
.
- Install the plugin and activate it.
- Create the needed pages (home and
/create
). - Configure ServerPilot credentials.
-
Get the bundle from GitHub.
wp plugin install https://github.com/Automattic/jurassic.ninja/archive/master.zip
-
Install composer dependencies
cd wp-content/plugins/jurassic.ninja composer install --no-dev
-
Activate the plugin
wp plugin activate jurassic.ninja
Your WordPress site will need a total of three pages in order for Jurassic Ninja to work with all its features:
Create a new page and call it "Home". For the page's content the minimum needed is that it contains a link to the /create
page. You can use the contents of home.md as a starting point.
In wp-admin go to Settings > Reading
and configure the homepage as a static page and choose the page you just created called "Home".
All the frontend site launching is done by a little piece of Javascript that detects if the current page is on the /create
path. If this is the case, it launches a request in the background to this plugin's REST API in order to launch a new site.
Create a new page and call it "Create". Use create
as the slug.
Add this content to it using the Text version of the editor:
<img id="img1" class="aligncenter" style="display: none;" data-failure-img-src="https://i.imgur.com/vdyaxmx.gif" src="https://media.giphy.com/media/uIRyMKFfmoHyo/giphy.gif" />
<img id="img2" class="aligncenter" style="display: none;" src="https://i1.wp.com/media.giphy.com/media/KF3r4Q6YCtfOM/giphy.gif?ssl=1" />
<p id="progress" class="lead" style="text-align: center;" data-success-message="The new WP is ready to go, visit it!" data-error-message="Oh No! There was a problem launching the new WP.">Launching a fresh WP with a Jetpack ...</p>
Create a new page and call it "Specialops". You can use the contents of specialops.md as a starting point.
-
Visit the Jurassic Ninja Settings page in wp-admin.
-
Configure your Server pilot credentials:
- client id: You can get this from the Account Settings > API.
- client key: Same as API Key. This is in the same page as the client id.
- server id: When you click on a server, the last bit of the URL will be the sever id.
-
Configure the top-domain on which this is going to create sites.
It may be convenient to test this plugin using the Jetpack monorepo Docker setup.
Make sure that your copy of this repo and the Jetpack monorepo are stored within the same directory, and that Docker is installed and running before proceeding.
- Create
jndb
folder in the root of this source code, where WordPress DB will be stored:
mkdir ./jndb
- create and run Docker containers:
docker-compose up
-
Navigate to http://localhost to create WordPress site, Activate Jurassic Ninja plugin. Other plugins are optional
-
Setup Jurassic Ninja plugin as mentioned above
Because of the way ServerPilot handles PHP-FPM restarts, the PHP version you use for the Jurassic Ninja app cannot be used for any of the sites you plan to launch.