dev environment // clone project
- git clone [email protected]:xlvcode/devops-part-one.git
- cd dev-ops-part-one // install curl
- sudo apt install curl //install PPA
- cd ~
- curl -sL https://deb.nodesource.com/setup_11.x -o nodesource_setup.sh
- sudo bash nodesource_setup.sh // install npm & node.js
- sudo apt-get install nodejs // install node.js & npm //install mongodb
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
- echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
- sudo apt-get update
- sudo apt-get install -y mongodb-org=4.0.0 mongodb-org-server=4.0.0 mongodb-org-shell=4.0.0 mongodb-org-mongos=4.0.0 mongodb-org-tools=4.0.0
- echo "mongodb-org hold" | sudo dpkg --set-selections echo "mongodb-org-server hold" | sudo dpkg --set-selections echo "mongodb-org-shell hold" | sudo dpkg --set-selections echo "mongodb-org-mongos hold" | sudo dpkg --set-selections echo "mongodb-org-tools hold" | sudo dpkg --set-selections
- sudo service mongod start //install dependencies for production mode.
- sudo npm install //run application
- npm run demon
Staging environment Тоже самое, что и production, только приложение ( пункт 15) запускается командой => 15. npm run test
production environment // install curl
- sudo apt install curl //install PPA
- cd ~
- curl -sL https://deb.nodesource.com/setup_11.x -o nodesource_setup.sh
- sudo bash nodesource_setup.sh // install npm & node.js
- sudo apt-get install nodejs // install node.js & npm //install mongodb
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
- echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
- sudo apt-get update
- sudo apt-get install -y mongodb-org=4.0.0 mongodb-org-server=4.0.0 mongodb-org-shell=4.0.0 mongodb-org-mongos=4.0.0 mongodb-org-tools=4.0.0
- echo "mongodb-org hold" | sudo dpkg --set-selections echo "mongodb-org-server hold" | sudo dpkg --set-selections echo "mongodb-org-shell hold" | sudo dpkg --set-selections echo "mongodb-org-mongos hold" | sudo dpkg --set-selections echo "mongodb-org-tools hold" | sudo dpkg --set-selections
- sudo service mongod start //install dependencies for production mode.
- sudo npm install —production //intall PM2 (process manager)
- npm install -g pm2
- pm2 start ecosystem.config.js // install NGINX
- sudo apt-get update
- sudo apt-get install nginx
- sudo mv default /etc/nginx/sites-available/default
- sudo service nginx restart