This project is fully managed and developed by :
- Abiyyu
- Ari
- Faris
- Litfan
Environment =
- Cloud Computing Platform : Openstack
- Virtual Machine Specification :
- CPU : 4 Core
- RAM : 8GB
- Storage : 50GB
- OS : Ubuntu 22.04
- Runtime = Node.js
- Database = MariaDB
- Database Manager = PHPMyAdmin
- Public Exposer = Cloudflare Zero Trust
MariaDB is a SQL Database. The command bellow is how to install MariaDB
sudo apt install mariadb-server
This command will take to multiple prompt for us to fill. Like for the root password, removing test user, and test database, etc.
sudo mysql_secure_installation
Create User named lafa
with password and accesible from any IP and Domain
CREATE USER 'lafa'@'%' IDENTIFIED BY '<DATABASE USER PASS>';
Grant all privileges on user lafa
>GRANT ALL PRIVILEGES ON *.* TO 'lafa'@'%' WITH GRANT OPTION;
Update privileges
FLUSH PRIVILEGES;
List Allowed Host who can accessed User lafa
, to make sure we can accessed it from Any IP & Domain
SELECT host FROM mysql.user WHERE User = 'lafa';
Create nodejs
database
CREATE DATABASE nodejs;
Get into nodejs
database
USE nodejs;
Create users
table in nodejs
database
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL UNIQUE,
type VARCHAR(255) NOT NULL
);
Please change <user>
and <pass>
. Also change <type>
to user
or admin
INSERT INTO `users` (`id`, `username`, `password`, `type`) VALUES (1, '<user>', '<pass>', '<type>');
sudo apt install phpmyadmin apache2
Connect PHPMyAdmin to MariaDB, edit /etc/phpmyadmin/config-db.php
sudo nano /etc/phpmyadmin/config-db.php
Please change <DATABASE USER PASS>
to the password of lafa user in database
$dbuser='lafa';
$dbpass='<DATABASE USER PASS>';
$basepath='';
$dbname='nodejs';
$dbserver='localhost';
$dbport='3306';
$dbtype='mysql';
Edit /etc/phpmyadmin/config-db.php
sudo nano /etc/apache2/sites-available/phpmyadmin.conf
Insert this script to expose it to a ServerName
through port 80
<VirtualHost *:80>
# phpMyAdmin default Apache configuration
ServerName phpmyadmin.ritufan.site
DocumentRoot /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
# limit libapache2-mod-php to files and directories necessary by pma
<IfModule mod_php7.c>
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
</IfModule>
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
</VirtualHost>
node index.js
This will make your app accesible from http://0.0.0.0:3000
. That means any IP Request directed to your Host
and port 3000
will lead you to the app.
- You must have a Domain. In our case it's
ritufan.site
- Register your Domain into Dash Cloudflare
- After your domain is registered, go into
Zero Trust
on the Side Panel
- Go to
Network > Tunnels
on the Side Panel
- Create Tunnels
- Select Cloudflared
- Name your Tunnel, and then Save
- Install and run Connectors, there will be specific command provided depends on your environment. Select your environment and then run the command on your Host.
- Route your Tunnel
- Public Hostname will route
Domain
to your App byIP
andPort
. For Example :
- Private Hostname will expose your
Subnet
from the Connector Earlier. For Example :
- If all is setup correctly, your app should be accessable from the Domain you setup in the Public Hostname.