This guide can be used for a fresh DPGA web app server in the production stage.
Step 1 - Create an account AWS / Google cloud / Digital ocean.
Step 2 - Create an Ubuntu 22.04 instance.
Step 3 - Now access the ubuntu terminal through SSH keys OR the web terminal.
Step 4 - Now we need to install Apache, PHP, MySql, and PHPMyAdmin. Run the below commands in the ubuntu terminal.
sudo apt-get update
sudo apt-get install zip unzip
sudo apt-get install apache2
sudo apt install php libapache2-mod-php
sudo systemctl restart apache2
sudo apt install mysql-server
sudo apt install php-mysql php-gd
sudo apt-get install phpmyadmin
Step 5 - Now we create a database user. Go to MySQL section and run the below command
CREATE USER ''@'localhost' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON * . * TO ''@'localhost';
FLUSH PRIVILEGES;
Step 6 - As of now PHPMyAdmin is installed on the server but we are unable to access it through the browser.
Use the below commands to access PHPMyAdmin in the browser:
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo systemctl restart apache2
Now try to access PHPMyAdmin in browser via following URL
Step 7 - Now PHPMyAdmin is accessible through the browser. Login with mysql user details which you created in step 5.
Step 8 - Now create a database in PHPMyAdmin dashboard and import the sample database file(webapp_database.sql) which is available in the dpga_webapp.zip folder(this folder is available in the source code).
Step 9 - Now we move our files to webdirectory, unzip our code files to html folder.
sudo unzip dpga_webapp.zip /var/www/html/
Step 10 - Now we need to edit a few details(host details, database details, email details) in our code files so the web app runs smoothly.
Step 11 - Now all things are completed. Webapp should be running and accessible through server IP. Now we need to map a domain name to this server. So this webapp is also accessible through a domain name.
Open DNS settings and add an A record that points out to our server IP. Now wait for 20-30 minutes and after you see that domain hitting our IP address.
Step 12 - Now we install the SSL certificate. Here we are installing Let’s Encrypt free certificate which needs to renew every 90 days (renewal can be automated through a cron).
For SSL installation, follow this guide
Step 13 - For the smooth working of all edge cases in the web app we need to run several cron at a specific time. Login as admin and in the menu click on the cron details tab. Here you get an all crons list with time. Set all these crons so web app works as expected.
For cron setup we can follow this guide
Currently, we use AWS EC2 instance as production server to host the webapp.
Webapp runs on an Ubuntu 22.04 machine with aaPanel for simplifying the hosting on Ubuntu and running commands via a GUI.
Through this GUI Panel, you can easily manage all files, databases, crons, SSL certificates, server details, PHP versions, etc.
Other utilities installed are Apache, PHP, MySql, and PHPMyAdmin
Backend is written via in Codeigniter 3 framework in PHP language.
MySQL used for database
Frontend is developed using the Bootstrap 5 framework.
REST APIs are used to pull data from the database.
Domain and IP Address: app.digitalpublicgoods.net pointing to 15.222.197.93 Using A record on Google Domains
SSL using Let’s Encrypt
Refer comments in the code for explanation of different functions, etc. Variable names are made simple and to the point.