How to deploy the Fauna DB Boilerplate

Preview

The Fauna DB Boilerplate helps you to deploy and manage an application integrated with Fauna on the edge. The template includes the creation of a static interface to facilitate you to create, retrieve, update, and delete items in your collections.


Before using this template, you need to:

You must also activate:

Edge Functions


Application Acceleration

You need to activate these modules via Real-Time Manager (RTM). To do so:

  1. Access Real-Time Manager (RTM) > Account menu
  2. Select the Billing & Subscriptions option.
  3. Select the Subscriptions tab.
  4. Activate the switch for each module.

To get Fauna DB Boilerplate, access Real-Time Manager (RTM) and select the Start with a template option on the homepage.

This will open a new page where you can select the Fauna DB Boilerplate card.


Once you’re in the template’s page, click the Settings tab to open the configuration form and provide the information to configure your application.

Fields identified with an asterisk are mandatory.

  • Application Name *: the name of your edge application on Azion.
  • GitHub Personal Token *: your GitHub personal token.
  • Fauna DB Secret Key *: the secret key to authorize the connection with your database.

After completing all the information, click the Next button, located in the bottom-right corner to start the deployment.


You’ll be able to follow the deployment process through a window showing off the logs. When it’s complete, the deployment page appears, confirming the edge application has been successfully created.

This page shows you the following sections:

  • Access your Edge Application section includes the link to visit and explore your edge application.
  • Build Summary contains the application’s name and function.
  • The Deployment details tab can be opened to access the logs related to the deployment.
  • What do you want to do next? provides recommendations regarding advanced options to enhance your edge application: Customize Domain, Manage Edge Application, View Edge Application Metrics, View Edge Application Logs, and the Back to Home button.

By deploying this template, the script creates:

  • An edge application to run your project and manage all your settings.
  • An Azion domain to access your edge application. You can also set up a custom domain to run on this edge application.
  • An edge function containing custom logic.
  • A GitHub repository for your project. The repository includes a GitHub Action that, by being activated, guarantees a continuous deployment workflow.
  • A static interface, based on HTML, to manage the database.

Managing your database collection

Section titled Managing your database collection

You can use the Azion domain to access it through the browser, as explained on the deployment section, and interact with it through the static interface that was created.

By using this interface, you’re able to create, retrieve, update, and delete items in your Posts collection, which is now linked to this new application. To do so, the interface provides an input area and icon buttons to manage your data as required.

All changes will be reflected on your application and your Fauna database as well.


Considering that this initial setup may not be optimal for your specific edge application, all settings can be customized any time you need by using RTM.

To manage and edit your edge application’s settings, proceed as follows:

  1. Access RTM.
  2. On the upper-left corner, select Products menu > Edge Application.
  • You’ll be redirected to the Edge Application page. It lists all the edge applications you’ve created.
  1. Find the edge application related to the Fauna DB Boilerplate and select it.
  • The list is organized alphabetically. You can also use the search bar located in the upper-left corner of the list; currently, it filters only by Application Name.

After selecting the edge application you’ll work on, you’ll be directed to a page containing all the settings you can configure.

Once the template is deployed, you can also edit and update your args and code, as well as implement a continuous deployment workflow. However, you’ll need first to declare secrets on your project’s GitHub repository to complete the second build with the changes. When the second build is completed, you’ll be able to manage your project with a continuous deployment workflow and edit the args as desired.

To do so, open your new Hello World template repository on GitHub. Then, go to Settings > Secrets and variables > Action to add your variables, following these instructions:

  1. Add the Azion personal token to the secrets:
Terminal window
AZION_PERSONAL_TOKEN=<value>
  1. Add the environments that’ll be used in the action workflow in the main.yml file, included in the .github/workflows folder of your repository:
.github/workflows/main.yml
- name: edge-...
id: azion_edge
...
with:
....
azionPersonalToken: ${{ secrets.AZION_PERSONAL_TOKEN }}
....
  1. Open a pull request to merge the changes to the main branch and start the automatic deployment.

Now, your project is ready to work with a continuous deployment workflow, updating instantly any changes in the application or the repository.

The edge application created during the deployment has an assigned Azion domain to make it accessible through the browser. The domain has the following format: xxxxxxxxxx.map.azionedge.net/. However, you can add a custom domain for users to access your edge application through it.

go to Domains reference

Contributors