Written by

Here’s the third article of this series dedicated to our new Marketplace. We introduced it a few weeks ago, and we added many frameworks for dev learning and quick prototyping.

So, in this last post, enjoy…


… custom scripts for editors, DevOps, and everyone!

Among the reasons we had to rebuild our marketplace, is the ability to create and distribute install scripts efficiently. What we had in mind was use-cases where you’re developing a Web service or application, and you need to deploy it regularly1) or you want to distribute it in a 1‑click install2).

To help you through this process, we built this new platform that powers our marketplace. As we said earlier, we now rely on simple scripts to provision a new instance. You choose your preferred language3), and we run it.

Specify your environment

Each script creates a new Sites type instance to host your app. You sometimes need to configure it a bit, especially regarding URL rewriting and all. To specify common settings, you must declare a YFM4) with the regarding options and values.

Here we declare a PHP site, stick to PHP 7.25), with a MySQL database. If you run the script right now, it will do nothing more than creating a new Sites and a MySQL database.

Then, clear the environment6), and execute your install process, like downloading the last release, extract it, install and configure stuff, etc.

Collect user informations

You sometimes need to grab some user information, like the locale, admin password, and username, to preset the instance accurately.

You can declare a list of form fields you want the user to fill-in before provisioning the instance. Rely on the YMF part to add the fields definitions, with validation rules:

That’s all! You can now use them in your script as they are sourced by the platform when running it:

We want the experience to be the more frictionless for users when they run install scripts. That’s why we recommend not to ask for too much information before provisioning the instance, but only the mandatory ones. It lets them configure their instance when the provisioning has finished.

Distribute your code

If you write a script to install an open source software or your solution, why not to distribute it through our platform? That’s precisely why we built this new marketplace: for the community!

Just go to the add an application script view in your administration interface, fill in the form, and check the Public application checkbox. It registers your app for a review, and we’ll publish it quickly on the marketplace.

Administration interface: Add a new application script
Administration interface: Add a new application script
We do a review of the scripts before releasing them publicly in the marketplace. It ensures no one will try to compromise your account by distribution malicious scripts. Nevertheless, we can’t review the sources distributed across the script itself when downloading the release tarball. As a customer, you must check your install and verify its consistency. If you write a script, please inline checksum and signature tests to ensure the sources integrity.

You’ve got a new way to increase the quality of the alwaysdata’s community, and we hope you will contribute by releasing scripts for your own solutions.

Take a look at the official documentation (it includes the whole script used in this blog post), and let us know which scripts you want to add!

Notes

Notes
1i.e., if you’re agency and this is your homemade solution
2i.e., you’re editing an open source software and want it available to everyone easily
3from Bash to Python or Ruby
4which is a simple YAML dataset in comments
5it automatically takes the last minor release of the 7.2 branch
6always better to avoid conditions