The site is behind Cloudflare dns proxy.
External ip address: 130.240.200.76
Internal ip address: 172.30.103.212
Functionality:
- Ansible control node. Responsible for deploying the website.
- HAProxy for loadbalancing incoming http traffic between webservers.
Open ports:
22: OpenSSH
80: HTTP - Managed by HAProxy
443: HTTPS - Managed by HAProxy
Internal ip address: 172.30.103.214
Functionality:
- Mongo database
- Simulator
- NFS server for webserver profile picture uploads
Open ports:
22: OpenSSH
80: HTTP - Managed by Nginx
Internal ports (for reverse proxy)
3000: Web server
8080: Backend server & Socket.io
Internal ip addresses:
172.30.103.213
172.30.103.214
Functionality:
- Web server.
- Backend server.
- Redis session store + websocket online user cache.
- Nginx acting as a reverse proxy for web, backend, and websocket traffic.
- NFS client for profile picture uploads.
Open ports:
22: OpenSSH
8080: Simulator
27017: MongoDB
6379: Redis
2049: NFS
Node >= 16.10, Redis
sudo pacman -S node redis
corepack enable
git clone [email protected]:chrfin-4/M7011E.git
cd M7011E
yarn install
yarn dev
Deployment of this project is done through ansible.
4 Servers running Ubuntu 20.04:
1 Loadbalancer server (Control node)
2 Webservers (Managed nodes)
1 Simulator / database server. (Managed node)
Create an ubuntu
user on each server.
sudo adduser ubuntu
The control node need ssh access to all managed nodes + itself.
Switch to the ubuntu
user:
sudo -iu ubuntu
Generate a default ssh key
ssh-keygen
Copy the public ssh key.
cat ~/.ssh/id_rsa.pub # Copy output of command
Switch to the ubuntu
user:
sudo -iu ubuntu
Append the public ssh key to authorized_keys
sudo -iu ubuntu
echo '<clipboard>' >> ~/.ssh/authorized_keys
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
Switch to the ubuntu
user:
sudo -iu ubuntu
Get the deployment files, for example through git:
git clone https://github.com/chrfin-4/M7011E.git
cd M7011E/deployment
Update the hosts
file with the proper ip addresses for each node.
[loadbalancers]
x.x.x.x
[webservers]
x.x.x.x
x.x.x.x
[dbservers]
x.x.x.x
Create a file exerge.pem
that contains a concatenated certificate and key.
Example:
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
Create a file vault_password
that contains the ansible-vault password used to decrypt group_vars/all/vault.yaml
.
Switch to the ubuntu
user:
sudo -iu ubuntu
Go to deployments
cd M7011E/deployments
Execute playbook
ansible-playbook site.yaml