usefulfiles/smartoffice-server-setup.md
Martin Donnelly ad8a35c3c7 initial
2016-03-08 11:07:47 +00:00

64 lines
1.4 KiB
Markdown

##Setup server for Smart Office
###Basic updates and shell files
```
sudo apt-get update
sudo apt-get --assume-yes install build-essential git nginx htop screen wget
wget https://dl.dropboxusercontent.com/u/233909/smartoffice/.screenrc -O ~/.screenrc
wget https://dl.dropboxusercontent.com/u/233909/smartoffice/.bash_aliases -O ~/.bash_aliases
```
###Configure and turn on swapfile
This makes it easier to build on installs with less than 1G of ram.
```
sudo swapon -s
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon -s
sudo swapon /swapfile
```
### Setup Node
```
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
source .bashrc
nvm install v5.5.0
npm install -g gulp bower pm2 npm-check npm-install-missing
```
### Get Source and Build
```
mkdir ~/live
mkdir ~/dev && cd ~/dev
git clone https://censis.visualstudio.com/DefaultCollection/SmartOffice/_git/SmartOfficeGit
cd ~/dev/SmartOffice/Git
npm install .
npm-install-missing
bower install
cp -ra . ~/live
```
###Configure Nginx
```
sudo fuser -k 80/tcp
sudo wget https://dl.dropboxusercontent.com/u/233909/smartoffice/smartoffice.nginx -O /etc/nginx/sites-available/smartoffice && sudo ln -s /etc/nginx/sites-available/smartoffice /etc/nginx/sites-enabled/smartoffice
sudo /etc/init.d/nginx restart
```
###Start Server
```
cd ~/live && pm2 start app.js --watch
pm2 logs app
pm2 monit
```