{"id":13316403,"url":"https://github.com/BeaAnt/multiEnvMeanStackDeploy","last_synced_at":"2025-03-10T23:31:46.750Z","repository":{"id":41784867,"uuid":"484161889","full_name":"BeaAnt/multiEnvMeanStackDeploy","owner":"BeaAnt","description":"Deploy a MEAN stack web application to multiple environment. Use Nginx on AWS Linux instances and configure Github Actions for the website code to get automatically build and deploy. Quality check with SonarQube (test environment)","archived":false,"fork":false,"pushed_at":"2022-05-09T09:10:09.000Z","size":548,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-03-05T01:10:18.279Z","etag":null,"topics":["angular","aws","github-actions","mean-stack","mongodb","multi-environment","nginx","nodejs","sonarqube"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BeaAnt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-21T18:25:53.000Z","updated_at":"2022-07-28T17:28:58.000Z","dependencies_parsed_at":"2022-08-11T17:02:31.930Z","dependency_job_id":null,"html_url":"https://github.com/BeaAnt/multiEnvMeanStackDeploy","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeaAnt%2FmultiEnvMeanStackDeploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeaAnt%2FmultiEnvMeanStackDeploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeaAnt%2FmultiEnvMeanStackDeploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeaAnt%2FmultiEnvMeanStackDeploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeaAnt","download_url":"https://codeload.github.com/BeaAnt/multiEnvMeanStackDeploy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242944822,"owners_count":20210707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","aws","github-actions","mean-stack","mongodb","multi-environment","nginx","nodejs","sonarqube"],"created_at":"2024-07-29T18:21:38.255Z","updated_at":"2025-03-10T23:31:46.260Z","avatar_url":"https://github.com/BeaAnt.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# multiEnvMeanStackDeploy   \nDeploy a MEAN stack webapplication to multiple environment. Use Nginx on AWS Linux instances and configure Github Actions for the website code to get automatically build and deploy. Quality check with SonarQube (test environment)\n\n## Prerequisites    \ncreate 2 deployment environments so that you can push in both development and production environments   \n\n**development environment:**    \n1.Create a AWS EC2 instance with an Ubuntu machine image and download the ssh keys    \n2.Install and configure Nginx web server    \n3.Configure UFW   \n4.Install MongoDB follow link https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/       \n5.Install Node.js and PM2   \n\n![image](https://user-images.githubusercontent.com/57292753/166952834-e8c43522-1777-4e05-86a8-ff509f4260ae.png)       \n\n**production environment:**     \n1.Create a AWS EC2 instance with an Ubuntu machine image and download the ssh keys    \n2.Install and configure Nginx web server    \n3.Configure UFW   \n4.Install MongoDB follow link https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/   \n5.Install Node.js and PM2        \n\n## Deploy MEAN Stack Application to Multiple Environments with GitHub Actions        \n\n**Create a repo on Github**   \n1.Create the content/application files for the Mean Stack Application:      \n  (A MEAN Stack application is made up of a front-end app built with Angular that connects to a back-end api built with Node.js + Express + MongoDB)    \n  The backend folder : contains  Node.js + MongoDB API that supports user registration, login with JWT authentication and user management.    \n  The frontend folder : contains an example of how to build a simple user registration and login system using Angular 8   \n2.Create a workflow file: The action must be created inside a .github/workflow/ folder in a root directory for it to be accessible by Github    \n\n**Create a GitHub repository secrets**    \nClick on tab *Settings* of the Github repo, go to *Secrets* section. Click *New repository secret* to create 7 differently named secrets for each environment:    \nSSH_PRIVATE_KEY_DEV  -\u003e the contents of a PRIVATE part of the SSH key:.pem file (development environment)    \nSSH_PRIVATE_KEY_UAT  -\u003e the contents of a PRIVATE part of the SSH key: .pem file(production environment)   \nHOST_DNS_DEV  -\u003e Public DNS record of the EC2 instance(development environment)  \nHOST_DNS_UAT  -\u003e Public DNS record of the EC2 instance(production environment)  \nTARGET_PATH_F -\u003e remote path where you want to deploy your Frontend code (development environment)       \nTARGET_PATH_B -\u003e remote path where you want to deploy your Backend code (development environment)    \nTARGET_PATH_PROD_F -\u003e remote path where you want to deploy your Frontend code (production environment)    \nTARGET_PATH_PROD_B -\u003e remote path where you want to deploy your Backend code (production environment)   \nUSERNAME  -\u003e the username of the EC2 instance   \n\n**Create a Github Environments**    \nClick on tab *Settings* of the Github repo, go to *Environments* section. Click *New environment* to create 2 environment:    \nDEV -\u003e to deploy the code in a development environment    \nPROD -\u003e to deploy the code in a production environment. Configure a protection (approval) rule in the environment:The distribution process will be suspended until approval is granted before the PROD run       \n\n\n**Quality check with sonarQube**    \n1. Create a Sonarqube project\n2. Create a sonar-project.properties file in project’s root folder (branch dev): this file contains the project key that identifies the project in the SonarQube service \n3. Configure a workflow YAML file with https://github.com/marketplace/actions/sonarqube-scanner-action  \n4. Create a Github secret:    \nSONAR_HOST_URL – Required this tells the scanner where SonarQube is hosted    \nSONAR_TOKEN – Required this is the token used to authenticate access to SonarQube   \n\nCommit to the dev branch and the GitHub Actions deployments will start automatically. You can view the distributions, including details about each run, on the Actions tab.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBeaAnt%2FmultiEnvMeanStackDeploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBeaAnt%2FmultiEnvMeanStackDeploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBeaAnt%2FmultiEnvMeanStackDeploy/lists"}