Blueprints are a way to define an environment for a certain service or services. For example, when we have a WordPress website we need: NGINX/Apache, PHP and a MySQL database. For Express, React, Next, Nuxt and the alike this would be: NodeJS.
This combination, together with configuration, can be called a blueprint.
As the name suggests blueprints are reusable as templates. If you create multiple environments you can base them on the same blueprint.
Forest.host also comes packed with some nice blueprints you can use out of the box already.
Using an existing blueprint
When creating a new environment we can choose to use an existing blueprint. When deploying a WordPress site we could choose to use the WordPress on PHP8
.
When using an existing blueprint you only need to provide:
Repository
Select the repository that holds your projects code.
Switch to edit mode (button at the bottom right).
Here we have some choices to make depending on our project.
We will touch the options that are relevant. Read this article explaining all the blueprint options.
Build commands
Build commands are all the commands required to get from the code in your repository to code that can be ran on a server. For NodeJS, NextJS, React and related frameworks this will probably include npm install
and probably something like npm run build
.
And for PHP projects there is composer install
of course.
Silence and interaction
It is good to note that these commands should not be interactive. Running npm init
for example would wait for user input. The build process on Forest is automated. So a command waiting for input will be waiting for input that will never come.
Some commands have flags for this, like Composer: composer install --no-interaction
.
Deploy path
A deploy path is required and this tells the Forest what directory in the repository should be deployed after building.
As explained above we use build commands that result in a collection of code that is executable on our server. This might be a directory with WordPress, themes and plugins, a NextJS/React APP or something similar.
Index file
The index file will be the entry point of the application. For PHP this is index.php
by default and often suffices. For NodeJS projects this can differ from app.js
to index.js
.
You can use whatever index file you want here.
Creating a custom blueprint
If none of the existing blueprints fit your needs we can also craft our own. Clicking on create your own blueprint at the bottom of the blueprint sidebar on the left enables us to draft our own blueprint.
In the left sidebar are all service and storage options. Simply drag options from the sidebar to the blueprint area.
Blueprints are very powerful and allow you to design a lot of different setups and combinations. This article explains all blueprint options.
We are almost ready for launch!
Before we do, let’s check if we need to set environment variables >