CMS is a Task Management System coupled with Form Maker to automate and ease Data Management and Communication between CCA Users and Society Users. This product is tailor made for the Co-Curricular Activities Department at Lahore University of Management Sciences (LUMS).
- CCA Management System (CCA)
Note: This installation guide is for Ubuntu 18.04
- Install Node JS
- Install MongoDB
- Install PM2
- Set Up NGINX - Remote Server Only
Run the following commands in terminal:
sudo apt update
sudo apt install nginx
Run the following command to get a list of application profiles:
sudo ufw app list
You should see the following output:
Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH
Note: For this guide, we will be using the HTTP profile
Now run the following command to apply application profile:
sudo ufw allow 'Nginx HTTP'
You can very the change by typing:
sudo ufw status
This would give the following output:
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)
Get public IP address by running the following command:
curl -4 icanhazip.com
This would give you your global IP address.
Now run the following commands from any directory:
sudo mkdir -p /var/www/<your_ip_address_here>/html
sudo chown -R $USER:$USER /var/www/<your_ip_address_here>/html
sudo chmod -R 755 /var/www/<your_ip_address_here>/html
Then by running the following command the configuration block will be edited:
sudo nano /etc/nginx/sites-available/<your_ip_address_here>
Copy paste the follwoing text in the editor and save the file:
server {
listen 80;
listen [::]:80;
root /var/www/<your_ip_address_here>/html;
index index.html index.htm index.nginx-debian.html;
server_name <your_ip_address_here>;
location /api {
proxy_pass http://localhost:3030;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /dev {
proxy_pass http://localhost:3231;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location / {
try_files $uri $uri/ =404;
}
}
Now create a link between the file and the directory sites-enabled
:
sudo ln -s /etc/nginx/sites-available/<your_ip_address_here> /etc/nginx/sites-enabled
Make a minor change in Nginx's configuraiton file:
sudo nano /etc/nginx/nginx.conf
Find the following line:
#server_names_hash_bucket_size 64;
Uncomment the line by removing #
in the start. Now save and close the file.
Check that there are no syntax errors in any Nginx file:
sudo nginx -t
If there aren't any problems, then restart Nginx by the following command:
sudo systemctl restart nginx
Run the following command in any directory:
ssh-keygen
Enter the following when prompted Enter file in which to save the key
:
~/.ssh/id_cms_test
Now run the following command and copy the output:
cat ~/.ssh/id_cms_test
Go to GitHub SSH and GPG Keys Setting and press New SSH key
. Paste there and press Add SSH key
to save.
Clone the repoistory and change deployer's directory by running the following commands in any directory:
mkdir ~/GitHub
git clone https://github.com/drageelr/cms.git
cp -r ~/GitHub/cms/deployer~/deployer
To configure deployer for your server edit 2 files,dp-script-1
and dp-script-2
, using nano
text editor:
nano ~/deployer/resources/<file_name_here>
Replace the ip address 167.71.224.73
in both files with your ip address and save the file.
Now start the deployer by executing the following commands:
cd ~/deployer
npm install
pm2 start bin/www.js --name "cms-deployer"
To verify that the deployer is running, run command:
pm2 status
- Go to
http://<your_ip_address_here>/dev/site
- Select
Branch
to deploy from andDatabase
to run on. - Press
Start Server
to deploy. - Press
Refresh
to check status of server.
- Place this repository on the server in the directory
~/GitHub
- Run the commands (from root directory of the system) in the text file
deployer/resources/dp-script-1
from line2
-8
- Run the commands (from root of this repository) in the text file
deployer/resources/dp-script-2
from line1
-10
- Run the command (from server folder)
pm2 start bin/www.js --name "cms-server"
Note: Make sure to replace the IP address 167.71.224.73
with your IP address
Run the following command in any directory:
ssh-keygen
Enter the following when prompted Enter file in which to save the key
:
~/.ssh/id_cms_test
Now run the following command and copy the output:
cat ~/.ssh/id_cms_test
Go to GitHub SSH and GPG Keys Setting and press New SSH key
. Paste there and press Add SSH key
to save.
Clone the repoistory and change deployer's directory by running the following commands in any directory:
mkdir ~/GitHub
git clone https://github.com/drageelr/cms.git
cp -r ~/GitHub/cms/deployer~/deployer
To configure deployer for your server edit 2 files,dp-script-1
and dp-script-2
, using nano
text editor:
nano ~/deployer/resources/<file_name_here>
Replace the ip address 167.71.224.73
in both files with your ip address and save the file.
Now start the deployer by executing the following commands:
cd ~/deployer
npm install
pm2 start bin/www.js --name "cms-deployer"
To verify that the deployer is running, run command:
pm2 status
- Go to
http://<your_ip_address_here>/dev/site
- Select
Branch
to deploy from andDatabase
to run on. - Press
Start Server
to deploy. - Press
Refresh
to check status of server.
- Clone the repository to your local directory.
git clone https://github.com/drageelr/cms.git
cd cms
- Install client-side dependencies and start React App
cd client
npm install
npm start
- Install server-side dependencies and start the server from another terminal / command-line
cd server
npm install
npm start
- API Specification Document
- Commit Process and Restrictions
- Commit Format and Guidelines
- JS Code Conventions
- CMS Wiki (WIP)