- Login to AWS and create an AWS EC2 instance.
- SSH into the instance and clone the GitHub repo.
- Navigate to the
docker-compose.ymlfile. - We are going to deploy the application using docker containers.
- Install the Docker inside the machine and follow the commands to run the Server, UI containers for the application.
Update your existing list of packages.
sudo apt updateInstall pre-requisite packages.
sudo apt install apt-transport-https ca-certificates curl software-properties-commonAdd the GPC key for official Docker repository.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpgAdd Docker repository to APT sources.
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullUpdate the existing packages again.
sudo apt updateInstall from Docker repo instead of Ubuntu repo.
apt-cache policy docker-ceInstall Docker.
sudo apt install docker-ceCheck the status.
sudo systemctl status dockerRun Docker without sudo option.
sudo usermod -aG docker ${USER}
su - ${USER}
groups
sudo usermod -aG docker usernameWe maintain the database outside the container for managing the admin services better. Create a MySQL RDS instance in AWS and connect to the database machine using any DB client.
Execute the SQL script named db.sql in the database-scripts directory to build the default database.
The initial username is set as admin and the password is LoveLocalNews2023!
Note: Change the initial username and passsword as soon as possible to maintain security
Both the Server and UI applications are run using docker-compose.yml file.
- Clone the GitHub repository into the system.
- Navigate to the
docker-compose.ymlfile and adjust as needed. - Navigate inside
react-uidirectory and open the.envfile and replace the localhost with EC2 public IP. - Navigate inside the
flask-serverdirectory and open theconfig.pyfile and fill in the AWS RDS database host URI. - Run the container.
docker compose build
docker compose up- The following commands are only needed when you want to relaunch the application.
docker compose down --rmi all -v
docker compose build
docker compose up- Access the application at:
http://IP_ADDRESS/loginpage