From ad8a35c3c71eff743b12089deb3e777a88fdd26c Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Tue, 8 Mar 2016 11:07:47 +0000 Subject: [PATCH] initial --- .bash_aliases | 12 +++++++ .screenrc | 28 +++++++++++++++++ apikeys.md | 18 +++++++++++ smartoffice-server-setup.md | 63 +++++++++++++++++++++++++++++++++++++ smartoffice.nginx | 12 +++++++ 5 files changed, 133 insertions(+) create mode 100644 .bash_aliases create mode 100644 .screenrc create mode 100644 apikeys.md create mode 100644 smartoffice-server-setup.md create mode 100644 smartoffice.nginx diff --git a/.bash_aliases b/.bash_aliases new file mode 100644 index 0000000..39160e2 --- /dev/null +++ b/.bash_aliases @@ -0,0 +1,12 @@ +alias ls='ls -h --color=auto' +alias snano='sudo nano' + +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + +alias top='htop' +alias h='history|grep' +alias f='find|grep' +alias df='df -h' +alias size='du -sh ./*' \ No newline at end of file diff --git a/.screenrc b/.screenrc new file mode 100644 index 0000000..392ea2a --- /dev/null +++ b/.screenrc @@ -0,0 +1,28 @@ +altscreen on +autodetach on +defbce on +deflogin on + +vbell off +vbell_msg "" +bell_msg "!!! Ding !!!" + +termcapinfo xterm|xterms|xs|rxvt ti@:te@ +terminfo xterm|xterms|xs|rxvt ti@:te@: +term screen-256color + +#caption always "%{= kc}%H (system load: %l)%-21=%{= .m}%D %d.%m.%Y %0c" +defscrollback 2048 +startup_message off +hardstatus on +hardstatus alwayslastline +hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]' + +bind ' ' windowlist -b +bind ',' prev +bind '.' next + +#let pgup/pgdn scroll under urxvt (see .Xdefaults) +bindkey "^[[5;2~" eval "copy" "stuff ^u" +bindkey -m "^[[5;2~" stuff ^u +bindkey -m "^[[6;2~" stuff ^d \ No newline at end of file diff --git a/apikeys.md b/apikeys.md new file mode 100644 index 0000000..0c0425a --- /dev/null +++ b/apikeys.md @@ -0,0 +1,18 @@ +##Api keys + + +LifX +``` +c9bab9ace3433eff72d64f4d871fad575ac050b3783939ccde1b03e8b25c932b +``` + +Amazon AWS +``` +accessKeyId: 'AKIAJWJS75F7WNCGK64A', +secretAccessKey: '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' +``` + +Forecast +``` +APIKey: '0657dc0d81c037cbc89ca88e383b6bbf' +``` \ No newline at end of file diff --git a/smartoffice-server-setup.md b/smartoffice-server-setup.md new file mode 100644 index 0000000..662120d --- /dev/null +++ b/smartoffice-server-setup.md @@ -0,0 +1,63 @@ +##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 + +``` diff --git a/smartoffice.nginx b/smartoffice.nginx new file mode 100644 index 0000000..9e905ad --- /dev/null +++ b/smartoffice.nginx @@ -0,0 +1,12 @@ +server { + listen [::]:80; + listen 80; + + location / { + proxy_pass http://localhost:3000; + proxy_set_header Host $host; +# auth_basic "Restricted"; +# auth_basic_user_file /etc/nginx/.htpasswd; + + } +} \ No newline at end of file