Deploy Brinjel on Clever Cloud

Brinjel is an open-source field management software designed for market gardeners, helping them plan seasons, track harvests, and optimize agricultural production. Created by and for market gardeners, it emphasizes an intuitive interface and features tailored to real-world needs.

In this article, we present the adaptations made to enable the deployment of Brinjel on Clever Cloud, thus providing scalable, secure, and sovereign infrastructure for farmers and agricultural institutions.

Why Choose Clever Cloud for Brinjel?

Running an Elixir container on Clever Cloud offers several advantages:

  • Scalability: The infrastructure automatically adjusts to the workload, ensuring smooth operation even during peak usage.
  • Security and Sovereign Data Management: Clever Cloud provides hosting compliant with data sovereignty requirements.
  • Ease of Deployment: With just a few commands, an application can be deployed to production, with seamless integration of complementary services like databases, storage, and emails.

Adaptations Made for Deployment

To make Brinjel fully operational on Clever Cloud, several improvements have been implemented:

Integration of MailPace

Email sending is now handled via MailPace, an integrated solution at Clever Cloud. The adaptation was made through the Swoosh module by adding dynamic adapter support.

PostgreSQL URL Support

Adding support for POSTGRESQL_ADDON_URI enables better database management by directly utilizing the URL provided by Clever Cloud.

S3 Support for File Management

Implementing an S3 backend via Clever Cloud’s Cellar add-on ensures optimized storage of images and files.

Hardware and Method: Deployment on Clever Cloud

Below are the detailed steps to deploy Brinjel on Clever Cloud, allowing for a quick and efficient installation of the application in a sovereign cloud environment.

Initial Configuration

Start by retrieving the official version of Brinjel from its main repository, apply the specific deployment modifications from your fork, then merge the changes before proceeding with the deployment.
Type the following commands:

git clone https://framagit.org/brinjel/brinjel.git && cd brinjel 
git remote add deploy https://framagit.org/wanoo/brinjel.git 
git fetch deploy 
git checkout -b deploy-clevercloud deploy/deploy-clevercloud 
git merge origin/main

Creating the Application on Clever Cloud

Create a new Elixir application and add the necessary services.
Type the following commands:

clever login 
clever create --type elixir --region par --org brinjel-prod 
clever addon create postgresql-addon brinjel-db --plan xxs_med --org --link brinjel-prod --addon-version 17 
clever addon create cellar-addon brinjel-cellar --plan s --org --link brinjel-prod 
clever addon create mailpace brinjel-mail --org --link brinjel-prod

Setting Up Environment Variables

Add the necessary environment variables to ensure the application runs properly.
Type the following commands:

clever env set PHX_HOST "brinjel.mydomain.ltd"
clever env set BRINJEL_FIRST_USER_EMAIL "admin@mydomain.ltd"
clever env set BRINJEL_FIRST_USER_FARM_NAME "MaJolieFerme"
clever env set BRINJEL_FIRST_USER_PASSWORD "ChangeMe_Brinjel12345"
clever env set BRINJEL_FROM_EMAIL "noreply@mydomain.ltd"
clever env set CELLAR_ADDON_BUCKET "brinjel-prod-mydomain"

clever env set ADMIN_USER_IDS "1"
clever env set BRINJEL_ENVIRONMENT "prod"
clever env set BRINJEL_FIRST_USER_CREATE "true"
clever env set BRINJEL_PHOTO_STORE "s3"
clever env set BRINJEL_SWOOSH_ADAPTER "mailpace"
clever env set CC_CACHE_DEPENDENCIES "true"
clever env set CC_MIX_BUILD_GOAL "compile"
clever env set CC_PHOENIX_ASSETS_DIR "assets"
clever env set CC_PHOENIX_DIGEST_GOAL "assets.deploy"
clever env set CC_PHOENIX_RUN_ECTO_MIGRATE "true"
clever env set CC_PHOENIX_SERVER_GOAL "phx.server"
clever env set CC_POST_BUILD_HOOK "mix sass.install"
clever env set CC_RUN_COMMAND "mix release && _build/prod/rel/brinjel/bin/brinjel eval \"Brinjel.Release.createdb\" && _build/prod/rel/brinjel/bin/brinjel eval \"Brinjel.Release.migrate\" && _build/prod/rel/brinjel/bin/brinjel start"
clever env set DISABLE_REGISTRATION "true"
clever env set LANG "fr"
clever env set MIX_ENV "prod"
clever env set PADDLE_API_KEY "test"
clever env set PADDLE_CLIENT_TOKEN "paddle_token"
clever env set PADDLE_ENVIRONMENT "sandbox"
clever env set PADDLE_NOTIFICATION_KEY "good_key"
clever env set PHX_SERVER "true"
clever env set PORT "8080"
clever env set SECRET_KEY_BASE "$(openssl rand -base64 64 | tr -d '\n')"

Deploying the Application

Before proceeding with deployment, two configuration steps are required:

Configuring the Cellar Bucket on Clever Cloud

  • Access the Clever Cloud console.
  • Select the Cellar add-on.
  • Create the bucket defined by the CELLAR_ADDON_BUCKET variable as “brinjel-prod-mydomain”.
  • Save the changes and verify that access is working correctly.

Domain Validation for MailPace on Clever Cloud

  • Access the Clever Cloud console.
  • Select the MailPace add-on.
  • Go to the MailPace dashboard.
  • Add and validate the domain mydomain.ltd.
  • Follow MailPace’s instructions to add the necessary DNS records.

    clever deploy


Once Deployment is Complete

The application will be accessible at the URL defined in PHX_HOST.
You can then monitor the application through the Clever Cloud dashboard and adjust settings as needed.

Conclusion

This work around deploying Brinjel on Clever Cloud primarily demonstrates the flexibility and ease with which an open-source application can be adapted and hosted on a sovereign, high-performance, and resilient infrastructure.
The goal here is not to replicate an existing SaaS offering, but rather to showcase how a business tool can leverage a modern cloud to ensure its sustainability and scalability.

This approach fits into a logic of collaboration and open innovation: making software adoption easier, exploring new technical opportunities, and offering solutions tailored to the specific needs of users. Clever Cloud positions itself as a facilitator of these initiatives, providing reliable and optimized infrastructure.

A big thank you to André Hoarau, creator of Brinjel, for his work on this tool.
This proof-of-concept illustrates the adaptability of Clever Cloud’s solutions and paves the way for other open-source projects looking to benefit from high-performance and sovereign hosting.

If you would like to support the Brinjel project and its development, we encourage you to use its official SaaS version available on the Brinjel website.

Blog

À lire également

Deploy Brinjel on Clever Cloud

Brinjel is an open-source field management software designed for market gardeners, helping them plan seasons, track harvests, and optimize agricultural production. Created by and for market gardeners, it emphasizes an intuitive interface and features tailored to real-world needs.
Company

Simplify the management of Clever Cloud services via Kubernetes with our new operator

For the past two years, we've been enabling our customers to combine the ease of deployment of Clever Cloud with an existing Kubernetes infrastructure through an operator.
Engineering

Keycloak as a Service: identity management without the complexity

Ensuring identification and access management (IAM) in an application is a challenge that is as strategic as it is complex. But beyond the initial configuration, it is the maintenance, updates and supervision of the solution that most mobilise your teams. What if you could concentrate on your applications... while a managed solution took care of the rest?
Company