docs: update flight manuals (#38635)

This commit is contained in:
Mrugesh Mohapatra 2020-04-25 02:30:29 +05:30 committed by GitHub
parent d866766223
commit d316c3a2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 88 additions and 17 deletions

View File

@ -11,7 +11,7 @@
- [How we build, test and deploy](/devops.md)
- **<i class="fad fa-plane-alt"></i> Flight Manuals (for Staff & Mods)**
- [01 - List Virtual Machines](/flight-manuals/01-getting-list-of-virtual-machines.md)
- [02 - Provision API Instances](/flight-manuals/02-spinning-api-instances.md)
- [02 - Work on API Instances](/flight-manuals/02-spinning-api-instances.md)
- [03 - Using Reply Templates](/flight-manuals/03-using-reply-templates.md)
----
- **<i class="fad fa-user-friends"></i> Our Community**

View File

@ -1,6 +1,9 @@
# Getting a list of the Virtual Machines
You can get a list of virtual machines from the below vendors only if you have been given access. You may need to list a VM and its public IP for getting SSH access and doing maintenance.
As a member of the staff or the dev-team, you may have been given access to our cloud vendors like Azure, Digital Ocean, etc. Here are some handy commands that you can use to list the Public IP addresses for the Virtual machine instances that are live and deployed.
> [!NOTE]
> You may already have SSH access, but it will not let you list VMs unless you also have access to the vendor portals themselves.
## Azure

View File

@ -1,39 +1,107 @@
### Provisioning VMs with API Code and starting up services
# Work on API Instances
## Installing pre-requisites
Perform updates to packages
```console
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
```
Install tools for binaries (`node-gyp`) etc.
```console
sudo apt install build-essential
```
## First Install
### Provisioning VMs with the Code
1. Install Node LTS.
2. Update `npm` and install PM2 and setup logrotate and startup on boot
```
```console
npm i -g npm
npm i -g pm2
pm2 install pm2-logrotate
pm2 startup
```
3. Clone freeCodeCamp, setup env and keys, install dependencies, and make first build.
```
3. Clone freeCodeCamp, setup env and keys.
```console
git clone https://github.com/freeCodeCamp/freeCodeCamp.git
cd freeCodeCamp
```
Create the `.env` from the secure credentials storage.
4. Create the `.env` from the secure credentials storage.
```
5. Install dependencies
```console
npm ci
```
```
6. Build the server
```console
npm run ensure-env && npm run build:server
```
4. Start Instances
```
7. Start Instances
```console
cd api-server
pm2 start production-start.js -i max --max-memory-restart 600M --name org
```
5. Logging, Monitoring and Reloading on updates to code changes
## Logging and Monitoring
```console
pm2 logs
```
```console
pm2 monitor
```
## Updating Instances (Maintenance)
### Rolling updates for logical changes to code
> [!NOTE]
> We are handling rolling updates to code, logic, via pipelines. You do not need to run these commands. These are here for documentation.
```console
pm2 reload all --update-env && pm2 logs
```
### Stop and start updates for changes in dependencies
1. Stop all instances
```console
pm2 stop all
```
pm2 logs
2. Install dependencies
```console
npm ci
```
3. Build the server
```console
npm run ensure-env && npm run build:server
```
pm2 monitor
4. Start Instances
```console
pm2 start all --update-env && pm2 logs
```
```
pm2 reload all --update-env && pm2 logs
```