3 Aws Docker

ERP OS - Setup Guide for AWS - EC2 Ubuntu Instance - Docker

This guide will walk you through the process of setting up the ERP OS software on a AWS EC2 Ubuntu Instance. It includes creating a new Instance and installing the required software on the instance.

Prerequisites

Step 1: Create a new EC2 Ubuntu instance

  1. Log in to your AWS account as a root user.

  2. Search for EC2 and navigate to the EC2 dashboard and click on Launch Instance.

  3. Provide the required folowing details to create a new instance:

    • Provide a name for your instance (e.g., erp os).
    • Select Ubuntu under Quick Start.
    • Select Ubuntu Server 22.04 LTS (HVM), SSD Volume Type from the list of available Amazon Machine Image (AMI).
    • Select the instance type (e.g., t2.small (1 vCPU, 2GiB Memory)). Minimum t2.small is recommended.
    • Select the number of instances (e.g., 1).
    • Select the key pair from dropdown, if not created earlier then click on create a new key pair and provide the following details:
      • Provide a name for the key pair (e.g., erp-os)
      • Select the key pair type (e.g., RSA)
      • Select Private key file format (e.g., .pem)
      • Click on Create key pair.
      • A file will be downloaded to your local computer. Save the file in a safe place. (e.g., erp-os.pem)
  4. Under Network Settings select Create security group or Select existing security group

    • If you select Create security group then tick the checkbox Allow SSH traffic from and select anywhere or My IP from the dropdown.

      If you select anywhere then you can access your instance from anywhere. If you select My IP then you can access your instance from your current IP address only.

    • If you select Select existing security group then select the security group from the dropdown.
  5. Configure the storage settings according to your needs. (e.g., 1 X 15 GiB - General Purpose SSD (gp2))

  6. Click on yellow Launch instance button and wait for the instance to be created.

  7. Open EC2 instance's port for Network traffic. To do this follow the steps below (by default, the port is open for SSH traffic only for security reasons):

    • Go to the Network & Security > Security Groups settings in the left hand navigation
    • Click on the Security group ID that you created in Step 1
    • Click on the Inbound rules tab and click on Edit inbound rules
    • Click on Add rule and select All traffic from the type dropdown, and select Anywhere IPv4 from the source dropdown. Then click on Save rules.

And that's it! You have successfully created a new EC2 Ubuntu instance on AWS (this is your cloud Ubuntu server).

Step 2: Access the instance via SSH

  1. Go to EC2 > Instances and click on the instance that you have created in Step 1.
  2. Click on Connect button and then select SSH client and follow the instruction there.

For example: to connect to your EC2 instance via SSH, locate where your key file was downloaded from terminal and then run the following command in your local computer's terminal:

chmod 400 <key_name>
ssh -i "<key_name>" ubuntu@<Public_IPv4_DNS>

replace <key_name> with the name of the key pair that you have created in Step 1.3 and <Public_IPv4_DNS> with the public IPv4 DNS of your instance. (e.g., ssh -i "erp-os.pem" ubuntu@ec2-13-127-77-90.ap-south-1.compute.amazonaws.com)

  1. When prompted, type "yes" to confirm the connection
  2. You are now connected to the instance via SSH and can run commands on the instance (your cloud Ubuntu server) from your local computer's terminal.

Step 3: Get the ERP OS source code in your instance

  • Option 1: Clone the ERP repository from GitHub

  1. Upload the file that you have downloaded from Codecanyon to a repository of your github account

  2. Access your instance (follow step 2) and Clone your repository (that you have created in above step) to your instance:

git clone https://github.com/your-repo/erp-os.git

Replace https://github.com/your-repo/erp-os.git with your ERP repository's URL.

  • Option 2: Get the file direct from your local computer to your instance

  1. Open a new separate terminal/command promp/powershell on your local computer.

  2. Upload the zip file that you have downloaded from Codecanyon to your instance (Ubuntu cloud server)

scp /<source-file-path> ubuntu@<Public_IPv4_DNS>:

Replace <source-file-path> with the path to the file on your local computer of the file you want to upload. It must be a zip file.

Replace <Public_IPv4_DNS> with the public IPv4 DNS of your instance.

(e.g., to upload into the root folder of your instance scp /home/username/erp-os.zip ubuntu@1ec2-13-127-77-90.ap-south-1.compute.amazonaws.com:)

It will upload the file to the root folder of your instance.

  1. Access your instance (follow step 2) and Install the unzip package on your instance
sudo apt-get install unzip
  1. Locate the file using cd command on your instance and unzip it
unzip <Codecanyon-file-name>.zip

Replace <Codecanyon-file-name> with the name of the file you uploaded to your instance (e.g., unzip erp-os.zip)

Step 4: Now follow the below video to complete the setup


Optional: Point your domain to the instance

  1. Log in to your domain registrar's control panel.
  2. Set an A record for your domain, pointing it to your instance's IP address.

Now, your ERP software should be accessible at http://<Auto-assigned_IP_address>:3000 (or your domain if you configured it). If you encounter any issues, make sure to check the logs and ensure that all services are running correctly.


Extras: for power users

Update the Ubuntu system

If required to update the Ubuntu system, run the following command:

sudo apt update && sudo apt upgrade

If prompted to continue, press Y or select ok and then press enter.

Note: It's best practic to update the system before installing any software.

Fix server related issues

If face any server related issue mostly you can fix it by using the mystreious magic method:

  • Stop the server
  • Then start the server again

Hope it may help you. Don't forget to follow the setp 4 video after starting the server again.


You have successfully deployed your app to the WORLD
🎉 Congratulations! 🎉