-
Notifications
You must be signed in to change notification settings - Fork 0
Deployment
Nulifier edited this page Sep 30, 2015
·
12 revisions
Most of this can be done by just using a pre-made snapshot.
- Setup a user to run the node server under
sudo adduser --disabled-password --system --group --home /var/node --shell /bin/bash node
- Run the command
sudo apt-get install mysql-serverto install the MySQL server. Enter a strong password for the root user. - After the installation is complete, run the command
mysql_secure_installation. It will ask for the current root password and ask you to change it. It isn't required as you have already set it. After that it will ask a series of questions. You can safely answer yes to all of these. - You can login to the MySQL command line with
mysql -u root -pand entering your MySQL root password at the prompt. - Once logged on to MySQL you can create a user by running
CREATE USER 'myusername'@'localhost' IDENTIFIED BY 'mypassword'; - Create a database for the site to use by
CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci; - Grant permission for the site user on that database with
GRANT ALL ON mydatabase.* TO 'myusername'@'localhost';
- Setup Node for Production (Use a PPA to avoid having to update manually)
- Login to the seperate user for running node applications with
sudo su node - Run the command
pm2 startup ubuntuto get a command that should be run as root to start the application - Once that command is run, you may need to edit the home folder in
/etc/init.d/pm2-init.shto point to/var/node - All pm2 commands should be run as this user.
To Do
To Do
- VPN between servers
- PM2