create account

Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus) by cocaaladioxine

View this thread on: hive.blogpeakd.comecency.com
· @cocaaladioxine · (edited)
$3.06
Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)
![](https://images.ecency.com/DQmUtiZApFCUDZWNLptmj4zWmSRJgUvxYY988XV8f9HbFeG/installing_appsmith_with_a_twist.png)
<center>*Thumbnail Image generated with Bing Image Creator and reworked with Canva. 
Yep, I saw his arm going through the screen !*</center>


After my previous article on installing Nextcloud on my Raspberry Pi 4, this article delves into the installation of a low-code tool on the same Raspberry Pi 4 device. The need for such a tool arose from several small projects that could benefit from a straightforward interface connected to a database. An example of one such project is my Hive auto voter, which I detailed in my previous post titled [So many projects, so little time...](https://ecency.com/hive-169321/@cocaaladioxine/so-many-projects-so-little).

In this article, we will explore the installation of Appsmith, and when that doesn't work due to compatibility issues, I switched to Directus, an alternative low-code tool. Let's get started.


This guide assumes that you already have a functional Docker and Apache2 environment, as well as a running MariaDB instance, on your server.

## Appsmith: A Brief Overview

Before we delve into the installation process, let's briefly touch on what Appsmith is. Appsmith is a low-code, open-source web application builder that allows users to create web applications quickly and efficiently. It simplifies the development process by offering a drag-and-drop interface to design user interfaces and connect them to databases or other data sources. With Appsmith, users can create custom applications, dashboards, and interactive web pages without extensive coding.

For more information, you can visit the [Appsmith website](https://www.appsmith.com/).

![](https://images.ecency.com/DQmfYX7HHTMebTyfhNcrWGcULPm69c179i2tKyWgYYkSVPp/appsmith_website.png)
<center>*AppSmith Website*</center>



## Appsmith Docker Installation

Initially, the plan was to install Appsmith on the Raspberry Pi 4 using Docker. Appsmith provides installation instructions for Docker in their documentation, which you can find [here](https://docs.appsmith.com/getting-started/setup/installation-guides/docker).

The process is as follows:

### Step 1: Installing Docker-Compose

To install Appsmith using Docker, we first need to install Docker-Compose. Run the following command:

```shell
$ sudo apt-get install docker-compose
```

### Step 2: Preparing the Environment

Create a directory for Appsmith, download the example Docker Compose file, and edit the Docker Compose file as follows:

```shell
$ sudo mkdir appsmith
$ sudo curl -L https://bit.ly/docker-compose-be -o $PWD/docker-compose.yml
$ sudo vim docker-compose.yml
```

In the Docker Compose file, ensure that you modify the ports to prevent overlap with other installed applications, and change "appsmith-ee" to "appsmith-ce" in the image path to specify the open-source version. After making these adjustments, run the following command to start the Docker container:

```shell
$ sudo docker-compose up -d
```

Unfortunately, this approach does not work on a Raspberry Pi 4 due to MongoDB compatibility issues, as discussed in this [GitHub thread](https://github.com/appsmithorg/appsmith/issues/23150). 
Given the complexity of resolving these issues and my limited availability for personal projects, I opted to explore alternative solutions.

## Exploring Directus

For an alternative solution, I turned to [AlternativeTo](https://alternativeto.net/software/appsmith/), a website that lists alternative software options. My search was specifically focused on open-source or freemium solutions, as I wanted to install a standalone version without any significant costs. Among several alternatives, Directus emerged as the most attractive choice.

Other candidates I considered included:

1. **[NocoDb](https://nocodb.com/)**:  However, upon closer inspection, it didn't meet my expectations.

2. **[Airtable](www.airtable.com)**: While it's a well-known platform, it didn't convince me as it appeared to be primarily spreadsheet-oriented.

3. **[BaseRow](https://baserow.io/)**:  Similar to Airtable and NocoDb, it was also geared towards spreadsheets and didn't align with my preferences.

### Directus: A Quick Introduction

Before proceeding with the Directus installation, here's a brief overview of what Directus is. Directus is an open-source content management system (CMS) and database interface that provides a user-friendly, customizable platform for managing content and data. It's an excellent tool for building custom databases and data-driven applications with ease.


![](https://images.ecency.com/DQmbJjbxu583FdyVxYSuVpHuS9N9EB6n1gqZeKPXEG4AzQA/directus_web_site.png)
 <center>*The Directus website*</center>

For more detailed information, you can visit the [Directus website](https://directus.io/).

## Installing Directus

Directus can be easily installed on your Raspberry Pi 4 using Docker. Follow these steps to set it up:

### Step 1: Create a Directus Docker Container

Use the following command to create a Directus Docker container:

```shell
$ sudo docker run \
--restart always \
-p 8055:8055 \
-e KEY=[arandomkey] \
-e SECRET=[abiglongrandomsecret] \
directus/directus
```

In this command, "KEY" and "SECRET" are placeholders for security keys. It's essential to customize these keys for your installation. Make sure to note the generated admin user and password, as you'll need these to access Directus.

### Step 2: Accessing Directus

Once the Docker container is up and running, you can access your Directus instance by visiting your Raspberry Pi 4's IP address on the defined port, which is 8055 in this case. Simply connect with the admin user and password you noted earlier, and you'll have a functional Directus interface at your disposal.

![](https://images.ecency.com/DQmXChKPDMnjZSybFFwUTTwxWi8E3naQ9tNmj9u5aKXgkZa/directus_home_page.png)
<center>*Your Directus instance homepage*</center>



However, you may notice that Directus initially connects to an SQLite local database within the Docker container, which may not be suitable for your needs. If you prefer to connect to an external database like MariaDB on your Raspberry Pi 4, you can follow these additional steps.

### Step 3: Connecting Directus to MariaDB

To link Directus to your MariaDB database, start by creating a user and granting the necessary privileges. Connect to your MariaDB instance and execute the following commands, customizing the username and password as needed:

```sql
CREATE USER 'directus'@'%' IDENTIFIED BY 'DiReCtUsPassWord';
GRANT ALL ON <yourdb>.* TO 'directus'@'%';
FLUSH PRIVILEGES;
```

After configuring MariaDB, proceed to create a new Docker Compose file for Directus:

```shell
$ sudo mkdir directus
$ sudo vim docker-compose.yml
```

Insert the following content into the Docker Compose file:

```yaml
version: "3"
services:
  directus:
    image: directus/directus:latest
    ports:
      - 8055:8055
    volumes:
      - ./database:/directus/database
      - ./uploads:/directus/uploads
    environment:
      KEY: "[arandomkey]"
      SECRET: "[abiglongrandomsecret]"
      ADMIN_EMAIL: "admin@example.com"
      ADMIN_PASSWORD: "admin123"
      DB_CLIENT: "mysql"
      DB_HOST: "[yourmariadbhost]"
      DB_PORT: 3306
      DB_DATABASE: "[yourdb]"
      DB_USER: "directus"
      DB_PASSWORD: "DiReCtUsPassWord"
      DB_CHARSET: "utf8mb4"
      WEBSOCKETS_ENABLED: "true"
restart: always
```
Start the docker with :

```shell
$ sudo docker-compose up
```

After setting up Directus, the installation process presented a few challenges. There were several identified issues, including missing primary key columns, default collation differences between the database and tables or fields collation, and an outdated version of Directus. While these issues could be resolved with a little effort, I decided to proceed, with the intention of addressing these errors at a later time since they weren't critical for my immediate requirements.

Additionally, the mounted upload directory proved to be not writable, which was another minor hiccup.

I managed to create a simple initial dashboard that displays the last executions of the Hive auto-voter and the current voting percentage. However, I recognized that I needed to delve deeper into Directus to harness its full potential.

Next, I decided to set up Apache2 for Directus, following the same configuration approach as I did for Nextcloud. You can refer to my article [Setting Up Nextcloud on a Raspberry Pi](https://ecency.com/hive-169321/@cocaaladioxine/setting-up-nextcloud-on-a) for the detailed Apache2 setup. Specifically for Directus, here's what I did:

### Configuring Apache2

First, I needed to create an SSL certificate. I used the following command to generate the certificate:

```shell
$ sudo certbot --apache -d directus.backpageek.eu
```

The command may not find the server initially because we haven't declared it yet. Simply press 'c' to cancel, and the certificate will be created regardless.

Next, I navigated to the `/etc/apache2/sites-available` directory and copied the configuration file from my Nextcloud setup as a template:

```shell
$ sudo cp 001-nextcloud.conf 002-directus.conf
```

Then, I edited the newly created `002-directus.conf` file with the following content:

```apache
<VirtualHost *:80>
    ServerName directus.backpageek.eu

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    RewriteCond %{SERVER_NAME} =directus.backpageek.eu
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    ServerName directus.backpageek.eu

    # Reverse proxy based on https://httpd.apache.org/docs/current/mod/mod_proxy_wstunnel.html
    RewriteEngine On
    ProxyPreserveHost On
    AllowEncodedSlashes NoDecode

    ProxyPass / http://localhost:8055/ nocanon
    ProxyPassReverse / http://localhost:8055/

    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteCond %{HTTP:Connection} upgrade [NC]
    RewriteCond %{THE_REQUEST} "^[a-zA-Z]+ /(.*) HTTP/\d+(\.\d+)?$"
    RewriteRule .? "ws://localhost:11000/%1" [P,L]

    # Enable h2, h2c, and http1.1
    Protocols h2 h2c http/1.1

    # Solves slow upload speeds caused by http2
    H2WindowSize 5242880

    # TLS
    SSLEngine               on
    SSLProtocol             -all +TLSv1.2 +TLSv1.3
    SSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305
    SSLHonorCipherOrder     off
    SSLSessionTickets       off
    SSLCertificateFile /etc/letsencrypt/live/directus.backpageek.eu/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/directus.backpageek.eu/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
    # Disable HTTP TRACE method.
    TraceEnable off
    <Files ".ht*">
        Require all denied
    </Files>

    # Support big file uploads
    LimitRequestBody 0
</VirtualHost>
```

In this configuration file, replace `directus.backpageek.eu` with your domain and update SSL certificate paths as necessary.

After configuring Apache2 for Directus, I created a symlink to enable the site:

```shell
$ sudo ln -s 002-directus.conf ../sites-enabled/002-directus.conf
```

Finally, I restarted Apache2:

```shell
$ sudo systemctl restart apache2
```

Your Directus instance should now be accessible!



![](https://images.ecency.com/DQmSddwDyQx7kR1LgpM1HwKtsXKS58m4bTqtpvRZszpE66D/directus_data_model.png)
<center> *The database available tables* </center>

## Conclusion 

In summary, while Directus offers promising features, it has certain limitations, such as connecting to only one database and filling it with its own tables. In my specific case, this limitation sufficed, but future plans may involve setting up a phpMyAdmin instance on my Raspberry Pi to better organize and clean my database. This involves applying best practices, including setting primary keys and ensuring clean collations, especially considering my prior experience using MySQL. Once everything is clean, I will explore creating a simple data editing page.

-----

## *Informations*

*To craft this post, I took note of each step involved in the process, arranged them in a logical order, and annotated them for clarity. I then enriched it with contextual information. This initial draft was then input into ChatGPT, which generated an article that was nearly ready for publication. I added additional lines and paragraphs, revised the text and incorporated even more information in order to get the current revision.*

*For the thumbnail image, I used Bing Image Creator with the following prompt : "IT developer dressed like a blacksmith chasing a rabbit belgian comic strip style" and reworked it using Canva.*
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 120 others
properties (23)
authorcocaaladioxine
permlinkinstalling-appsmith-on-a-raspberry
categoryhive-169321
json_metadata"{"image":["https://images.ecency.com/DQmUtiZApFCUDZWNLptmj4zWmSRJgUvxYY988XV8f9HbFeG/installing_appsmith_with_a_twist.png","https://images.ecency.com/DQmfYX7HHTMebTyfhNcrWGcULPm69c179i2tKyWgYYkSVPp/appsmith_website.png","https://images.ecency.com/DQmbJjbxu583FdyVxYSuVpHuS9N9EB6n1gqZeKPXEG4AzQA/directus_web_site.png","https://images.ecency.com/DQmXChKPDMnjZSybFFwUTTwxWi8E3naQ9tNmj9u5aKXgkZa/directus_home_page.png","https://images.ecency.com/DQmSddwDyQx7kR1LgpM1HwKtsXKS58m4bTqtpvRZszpE66D/directus_data_model.png"],"tags":["hive-169321","projects","raspberrypi","appsmith","directus","archon","diy","vyb","oneup","leofinance"],"description":"I installed a Directus instance on my RPI4. Check out how I did it.","app":"ecency/3.0.36-vision","format":"markdown+html","image_ratios":["1.7753","1.6264","1.6909","1.5764","1.5822"]}"
created2023-11-04 10:54:39
last_update2023-11-04 10:55:27
depth0
children9
last_payout2023-11-11 10:54:39
cashout_time1969-12-31 23:59:59
total_payout_value1.544 HBD
curator_payout_value1.515 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length12,962
author_reputation3,935,504,781,379
root_title"Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,569,432
net_rshares6,241,189,081,393
author_curate_reward""
vote details (184)
@ecency ·
**Yay!** 🤗<br>Your content has been **boosted with Ecency Points**, by @cocaaladioxine. <br>Use Ecency daily to boost your growth on platform! <br><br><b>Support Ecency</b><br>[Vote for new Proposal](https://hivesigner.com/sign/update-proposal-votes?proposal_ids=%5B283%5D&approve=true)<br>[Delegate HP and earn more](https://ecency.com/hive-125125/@ecency/daily-100-curation-rewards)
properties (22)
authorecency
permlinkre-2023115t2422511z
categoryhive-169321
json_metadata{"tags":["ecency"],"app":"ecency/3.0.20-welcome","format":"markdown+html"}
created2023-11-05 02:42:03
last_update2023-11-05 02:42:03
depth1
children0
last_payout2023-11-12 02:42:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length384
author_reputation618,496,950,684,028
root_title"Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,587,093
net_rshares0
@hivebuzz ·
Congratulations @cocaaladioxine! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@cocaaladioxine/upvoted.png?202311062225"></td><td>You received more than 2500 upvotes.<br>Your next target is to reach 2750 upvotes.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@cocaaladioxine) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out our last posts:**
<table><tr><td><a href="/hive-122221/@hivebuzz/pum-202310-delegations"><img src="https://images.hive.blog/64x128/https://i.imgur.com/fg8QnBc.png"></a></td><td><a href="/hive-122221/@hivebuzz/pum-202310-delegations">Our Hive Power Delegations to the October PUM Winners</a></td></tr><tr><td><a href="/hive-122221/@hivebuzz/pud-202311-feedback"><img src="https://images.hive.blog/64x128/https://i.imgur.com/zHjYI1k.jpg"></a></td><td><a href="/hive-122221/@hivebuzz/pud-202311-feedback">Feedback from the November Hive Power Up Day</a></td></tr><tr><td><a href="/hive-122221/@hivebuzz/pum-202310-result"><img src="https://images.hive.blog/64x128/https://i.imgur.com/mzwqdSL.png"></a></td><td><a href="/hive-122221/@hivebuzz/pum-202310-result">Hive Power Up Month Challenge - October 2023 Winners List</a></td></tr></table>
properties (22)
authorhivebuzz
permlinknotify-cocaaladioxine-20231106t224921
categoryhive-169321
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2023-11-06 22:49:21
last_update2023-11-06 22:49:21
depth1
children0
last_payout2023-11-13 22:49:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,496
author_reputation369,388,583,816,020
root_title"Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,638,172
net_rshares0
@hivebuzz ·
Congratulations @cocaaladioxine! You received a personal badge!

<table><tr><td>https://images.hive.blog/70x70/http://hivebuzz.me/badges/birthday-3.png</td><td>Happy Hive Birthday! You are on the Hive blockchain for 3 years!</td></tr></table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@cocaaladioxine) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>


**Check out our last posts:**
<table><tr><td><a href="/hive-122221/@hivebuzz/lpud-202311"><img src="https://images.hive.blog/64x128/https://i.imgur.com/pVZi2Md.png"></a></td><td><a href="/hive-122221/@hivebuzz/lpud-202311">LEO Power Up Day - November 15, 2023</a></td></tr></table>
properties (22)
authorhivebuzz
permlinknotify-cocaaladioxine-20231114t081934
categoryhive-169321
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2023-11-14 08:19:36
last_update2023-11-14 08:19:36
depth1
children0
last_payout2023-11-21 08:19:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length695
author_reputation369,388,583,816,020
root_title"Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,846,510
net_rshares0
@snippets ·
Thanks for sharing AppSmith. Never heard of it but it looks promising. Also found your DB options shared useful.😄  
👍  
properties (23)
authorsnippets
permlinkre-cocaaladioxine-s3mq12
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2023.10.1"}
created2023-11-05 02:39:03
last_update2023-11-05 02:39:03
depth1
children4
last_payout2023-11-12 02:39:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length115
author_reputation801,725,525,485
root_title"Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,587,054
net_rshares4,794,162,717
author_curate_reward""
vote details (1)
@cocaaladioxine ·
$0.11
AppSmith clearly seems to be much more powerful than Directus. I've seen it in action at work and you can develop full fledged application with it. I'm a bit sad that it won't run on my raspberry 😕. 
👍  
properties (23)
authorcocaaladioxine
permlinkre-snippets-2023115t1218739z
categoryhive-169321
json_metadata{"type":"comment","tags":["hive-169321"],"app":"ecency/3.0.44-mobile","format":"markdown+html"}
created2023-11-05 11:18:06
last_update2023-11-05 11:18:06
depth2
children3
last_payout2023-11-12 11:18:06
cashout_time1969-12-31 23:59:59
total_payout_value0.056 HBD
curator_payout_value0.055 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length199
author_reputation3,935,504,781,379
root_title"Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,594,304
net_rshares225,569,067,043
author_curate_reward""
vote details (1)
@snippets ·
I used to run Nextcloud on raspberry pi … it was a stretch. :)
👍  
properties (23)
authorsnippets
permlinkre-cocaaladioxine-2023115t192341453z
categoryhive-169321
json_metadata{"type":"comment","tags":["hive-169321"],"app":"ecency/3.0.44-mobile","format":"markdown+html"}
created2023-11-05 11:23:42
last_update2023-11-05 11:23:42
depth3
children2
last_payout2023-11-12 11:23:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length62
author_reputation801,725,525,485
root_title"Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,594,416
net_rshares4,721,077,163
author_curate_reward""
vote details (1)
@stemsocial ·
re-cocaaladioxine-installing-appsmith-on-a-raspberry-20231106t213649761z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the <a href='/trending/hive-196387'>STEMsocial community</a>. Feel free to join us on <a href='https://discord.gg/9c7pKVD'>discord</a> to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.&nbsp;<br />&nbsp;<br />
</div>
properties (22)
authorstemsocial
permlinkre-cocaaladioxine-installing-appsmith-on-a-raspberry-20231106t213649761z
categoryhive-169321
json_metadata{"app":"STEMsocial"}
created2023-11-06 21:36:48
last_update2023-11-06 21:36:48
depth1
children0
last_payout2023-11-13 21:36:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length565
author_reputation22,918,229,493,305
root_title"Installing AppSmith on a Raspberry Pi 4 (with a twist named Directus)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,635,837
net_rshares0