-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathproduction_server.txt
52 lines (43 loc) · 1.81 KB
/
production_server.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# START
sudo apt-get update # always start with an Update
# CREATE FOLDER FOR PROJECT
mkdir production
cd production/
# GIT
git init # new git environment
git remote add origin [email protected]:riodw/BloomBus-Server.git
git pull origin master
ls # see if all the files from GitHub have been downloaded
# INSTALL ALL THE PROJECT DEPENDENCIES
npm install
ls # see if the folder "node_modules" has been created
# MONGO DATABASE
chmod a+x mongod # give the Bash Script file "mongod" execution permissions
sudo apt-get install -y mongodb # install mongodb (not with npm because npm is weird about mongodb)
top # check to see if proccess "mongodb" is running, if it is KILL it with the following command - P.S. press "q" to quit
sudo service mongodb stop
top # press "q" to quit
sudo mkdir -p /data/db/ # where the database is stored - this is a required folder for MongoDB
sudo chown `id -u` /data/db # change permissions on the folder so MongoDB can access it
# START MONGODB
mongod # WAIT FOR MONGODB TO PRINT 'waiting for connections on port 27017'
# NOW STOP MONGODB - <Ctrl-C>
# PM2
sudo npm install pm2 -g
pm2 startup ubuntu
sudo su -c "env PATH=$PATH:/opt/node/bin pm2 startup ubuntu -u bloombus --hp /home/bloombus" # This line will be provided by PM2: LOOK FOR IT
pm2 save
# LET PM2 RUN MONGODB
# Need to make a Shell Script that starts 'mongod' file that PM2 can run
touch mongod.sh
nano mongod.sh
# Paste these lines in the nano IDE - (All 2 lines, THE WHOLE THING):
#!/bin/bash
mongod
Hit <Ctrl-X>
Hit <y>
Hit <Enter>
cat mongod.sh # Make sure the 2 lines are saved in the file
# START THE SERVER
pm2 start mongod.sh # FIRST START THE DATABASE... THEN!...
pm2 start server.js -- real # Start the server - remember to pass the command line arg "real". P.S. Command line args go after the "--" if there are no args then leave out the "--"