Updated cv
This commit is contained in:
parent
d3cfa85a86
commit
3015aac6d6
2
docs/text.txt
Normal file
2
docs/text.txt
Normal file
@ -0,0 +1,2 @@
|
||||
http://pastebin.com/jNaZHVkE
|
||||
|
@ -11,6 +11,7 @@ Amazon AWS
|
||||
|
||||
```
|
||||
accessKeyId: 'AKIAJWJS75F7WNCGK64A',
|
||||
|
||||
secretAccessKey: '8irYxThCp4xxyrbr00HzWcODe2qdNrR7X7S5BKup'
|
||||
```
|
||||
|
||||
|
216
scripts/nginx.conf
Normal file
216
scripts/nginx.conf
Normal file
@ -0,0 +1,216 @@
|
||||
# Run as a less privileged user for security reasons.
|
||||
#user www-data;
|
||||
|
||||
# The maximum number of connections for Nginx is calculated by:
|
||||
# max_clients = worker_processes * worker_connections
|
||||
# It is better if you set the worker_processes count 1 less than your cpu cores. You have other processes running as well!
|
||||
worker_processes 1;
|
||||
|
||||
# Maximum open file descriptors per process;
|
||||
# should be > worker_connections.
|
||||
worker_rlimit_nofile 50000;
|
||||
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
# When you need > 8000 * cpu_cores connections, you start optimizing your OS,
|
||||
# and this is probably the point at which you hire people who are smarter than
|
||||
# you, as this is *a lot* of requests.
|
||||
worker_connections 4096 ;
|
||||
use epoll;
|
||||
# accept_mutex off;
|
||||
|
||||
# Accept as many connections as possible.
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
############################################################################ General Settings
|
||||
# Define the MIME types for files.
|
||||
# Usually located at mime.types;
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Update charset_types due to updated mime.types
|
||||
charset_types text/xml text/plain text/vnd.wap.wml application/x-javascript application/rss+xml text/css application/javascript application/json;
|
||||
|
||||
client_max_body_size 20m;
|
||||
client_body_buffer_size 128k;
|
||||
large_client_header_buffers 2 1k;
|
||||
|
||||
## Hide the Nginx version number.
|
||||
server_tokens off;
|
||||
|
||||
server_names_hash_bucket_size 512;
|
||||
server_names_hash_max_size 512;
|
||||
server_name_in_redirect off;
|
||||
variables_hash_max_size 2048;
|
||||
variables_hash_bucket_size 64;
|
||||
|
||||
# Speed up file transfers by using sendfile() to copy directly
|
||||
# between descriptors rather than using read()/write().
|
||||
sendfile on;
|
||||
|
||||
# Tell Nginx not to send out partial frames; this increases throughput
|
||||
# since TCP frames are filled up before being sent out. (adds TCP_CORK)
|
||||
tcp_nopush on;
|
||||
|
||||
# Tell Nginx to enable the Nagle buffering algorithm for TCP packets, which
|
||||
# collates several smaller packets together into one larger packet, thus saving
|
||||
# bandwidth at the cost of a nearly imperceptible increase to latency. (removes TCP_NODELAY)
|
||||
tcp_nodelay on;
|
||||
|
||||
# Don't put the IP to the end of url when there's a redirection
|
||||
port_in_redirect off;
|
||||
|
||||
# Let's make a lot of keepalive requests possible
|
||||
keepalive_requests 100000;
|
||||
|
||||
# How long to allow each connection to stay idle; longer values are better
|
||||
# for each individual client, particularly for SSL, but means that worker
|
||||
# connections are tied up longer. (Default: 65)
|
||||
keepalive_timeout 30;
|
||||
client_body_timeout 30;
|
||||
client_header_timeout 60;
|
||||
send_timeout 30;
|
||||
|
||||
## Reset lingering timed out connections. Deflect DDoS.
|
||||
reset_timedout_connection on;
|
||||
|
||||
|
||||
############################################################################ Gzip Settings
|
||||
# Enable Gzip compressed.
|
||||
# Pagespeed might not allow us to turn it on
|
||||
gzip on;
|
||||
|
||||
gzip_buffers 16 8k;
|
||||
|
||||
# This feature allow you to use static GZipped versions of your files (you need to create them yourself) and serve those gzipped files directly through Nginx. Nginx just looks for a filename identical to the one requested by the browsers, but with a “.gz” extension (eg. if 'index.html' is requested, nginx will look for a 'index.html.gz' file next to it). If it exists, Nginx serves this -already compressed- file and does not perform gzip compression, thus reducing CPU overhead and response time.
|
||||
gzip_static on;
|
||||
|
||||
# Enable compression both for HTTP/1.0 and HTTP/1.1 (required for CloudFront).
|
||||
gzip_http_version 1.1;
|
||||
|
||||
# Compression level (1-9).
|
||||
# 5 is a perfect compromise between size and cpu usage, offering about
|
||||
# 75% reduction for most ascii files (almost identical to level 9).
|
||||
gzip_comp_level 7;
|
||||
|
||||
# Don't compress anything that's already small and unlikely to shrink much
|
||||
# if at all (the default is 20 bytes, which is bad as that usually leads to
|
||||
# larger files after gzipping).
|
||||
gzip_min_length 1064;
|
||||
|
||||
# Compress data even for clients that are connecting to us via proxies,
|
||||
# identified by the "Via" header (required for CloudFront).
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
|
||||
# Tell proxies to cache both the gzipped and regular version of a resource
|
||||
# whenever the clients Accept-Encoding capabilities header varies;
|
||||
# Avoids the issue where a non-gzip capable client (which is extremely rare
|
||||
# today) would display gibberish if their proxy gave them the gzipped version.
|
||||
gzip_vary on;
|
||||
|
||||
# Disable gzip for non-supporting browsers.
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
# Compress all output labeled with one of the following MIME-types.
|
||||
gzip_types application/atom+xml
|
||||
application/javascript
|
||||
application/json
|
||||
application/rss+xml
|
||||
application/vnd.ms-fontobject
|
||||
application/x-font-ttf
|
||||
application/x-web-app-manifest+json
|
||||
application/x-javascript
|
||||
application/xhtml+xml
|
||||
application/xml
|
||||
font/opentype
|
||||
image/svg+xml
|
||||
image/x-icon
|
||||
image/bmp
|
||||
text/css
|
||||
text/richtext
|
||||
text/xsd
|
||||
text/xsl
|
||||
text/xml
|
||||
text/plain
|
||||
text/x-component
|
||||
text/javascript;
|
||||
#text/html is always compressed by HttpGzipModule
|
||||
|
||||
############################################################################ Caching
|
||||
# Define a cache path for fastcgi caching under the zone name microcache
|
||||
fastcgi_cache_path /var/cache/nginx/ levels=1:2 keys_zone=microcache:10m max_size=1000m inactive=60m;
|
||||
proxy_cache_path /var/cache/nginx/proxy/ levels=1:2 keys_zone=proxy:10m;
|
||||
|
||||
# Improve static content handling by caching metadata, not the files itself
|
||||
open_file_cache max=1000 inactive=1h;
|
||||
open_file_cache_valid 2h;
|
||||
open_file_cache_min_uses 1;
|
||||
open_file_cache_errors on;
|
||||
|
||||
# Define a zone for limiting the number of simultaneous
|
||||
# connections nginx accepts. 1m means 32000 simultaneous
|
||||
# sessions. We need to define for each server the limit_conn
|
||||
# value refering to this or other zones.
|
||||
# ** This syntax requires nginx version >=
|
||||
# ** 1.1.8. Cf. http://nginx.org/en/CHANGES. If using an older
|
||||
# ** version then use the limit_zone directive below
|
||||
# ** instead. Comment out this
|
||||
# ** one if not using nginx version >= 1.1.8.
|
||||
# limit_conn_zone $binary_remote_addr zone=arbeit:10m;
|
||||
|
||||
# For the filefield_nginx_progress module to work. From the
|
||||
# README. Reserve 1MB under the name 'uploads' to track uploads.
|
||||
# upload_progress uploads 1m;
|
||||
|
||||
############################################################################ Security
|
||||
# Enable the builtin cross-site scripting (XSS) filter available
|
||||
# in modern browsers. Usually enabled by default we just
|
||||
# reinstate in case it has been somehow disabled for this
|
||||
# particular server instance.
|
||||
# https://www.owasp.org/index.php/List_of_useful_HTTP_headers.
|
||||
add_header X-XSS-Protection '1; mode=block';
|
||||
|
||||
# Enable clickjacking protection in modern browsers. Available in
|
||||
# IE8 also. See
|
||||
# https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
|
||||
# This may conflicts with pseudo streaming (at least with Nginx version 1.0.12).
|
||||
# Uncomment the line below if you are not using media streaming.
|
||||
# For sites being framing on the same domqin uncomment the line below.
|
||||
#add_header X-Frame-Options SAMEORIGIN;
|
||||
|
||||
# For sites accepting to be framed in any context comment the
|
||||
# line below.
|
||||
add_header X-Frame-Options DENY;
|
||||
|
||||
## Block MIME type sniffing on IE.
|
||||
add_header X-Content-Options nosniff;
|
||||
|
||||
############################################################################ Logging
|
||||
log_format custom '$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $body_bytes_sent '
|
||||
'"$http_referer" "$http_user_agent"';
|
||||
|
||||
#log_format varnish_log '$http_x_forwarded_for - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent "$http_referer" ' ;
|
||||
|
||||
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
# '$status $body_bytes_sent "$http_referer" '
|
||||
# '"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
############################################################################ Pagespeed
|
||||
# Edit this file to add your domain.
|
||||
# https://developers.google.com/speed/pagespeed/module/domains
|
||||
# include conf.d/pagespeed/pagespeed.conf;
|
||||
|
||||
# Virtual Host Configs
|
||||
include conf.d/*.conf;
|
||||
# include sites-enabled/*;
|
||||
|
||||
############################################################################ CLOUDFLARE GET REALIP PROBE
|
||||
# include nomad-conf/realip.add;
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
GIT_SERVER=
|
||||
GIT_FRONTEND=
|
||||
NVM="$HOME/.nvm"
|
||||
NVM_VERSION="5.7.0"
|
||||
DEV="$HOME/dev"
|
||||
@ -7,13 +9,20 @@ STAGING="$HOME/staging"
|
||||
SERVER="O-BrandServer"
|
||||
FRONT="O-Brand"
|
||||
SWAP="/swapfile"
|
||||
DBSETUP="obrand-admin-server/dbrebuild.sh"
|
||||
DBSETUP="$DEV/$SERVER/dbrebuild.sh"
|
||||
PKG_MANAGER=$( command -v yum || command -v apt-get ) || echo "Neither yum nor apt-get found"
|
||||
PKG_DEVICE=$(basename $PKG_MANAGER)
|
||||
pidof systemd && SYSTEMDCALL=1 || SYSTEMDCALL=0
|
||||
UPDATE=no
|
||||
DATABASE=no
|
||||
NGINX=no
|
||||
|
||||
RED=`tput setaf 1`
|
||||
GREEN=`tput setaf 2`
|
||||
YELLOW=`tput setaf 3`
|
||||
PURPLE=`tput setaf 5`
|
||||
RESET=`tput sgr0`
|
||||
|
||||
fancy_echo() {
|
||||
local fmt="$1"; shift
|
||||
|
||||
@ -36,6 +45,12 @@ case $i in
|
||||
NGINX=YES
|
||||
shift # past argument=value
|
||||
;;
|
||||
-i|--install)
|
||||
UPDATE=YES
|
||||
NGINX=YES
|
||||
DATABASE=YES
|
||||
shift # past argument=value
|
||||
;;
|
||||
|
||||
--default)
|
||||
DEFAULT=YES
|
||||
@ -48,10 +63,14 @@ esac
|
||||
done
|
||||
|
||||
|
||||
fancy_echo "Installing Obrand Admin Server ..."
|
||||
fancy_echo "${YELLOW}Installing Obrand Admin Server ...${RESET}"
|
||||
## Update initial packages
|
||||
|
||||
fancy_echo Cleaning...
|
||||
read -s -p "Enter Password for sudo: " sudoPW
|
||||
|
||||
# Download files.
|
||||
|
||||
fancy_echo "${RED}Cleaning...${RESET}"
|
||||
|
||||
if [ ! -d "$DEV" ]; then
|
||||
mkdir -p $DEV
|
||||
@ -69,27 +88,34 @@ else
|
||||
fi
|
||||
|
||||
|
||||
if [[ $UPDATE = "yes" ]]; then
|
||||
if [[ $UPDATE = "YES" ]]; then
|
||||
fancy_echo "${PURPLE}Updating system packages${RESET}"
|
||||
|
||||
if [ $(basename $PKG_MANAGER) = "yum" ]; then
|
||||
sudo yum --assumeyes upgrade
|
||||
sudo yum --assumeyes install git make automake gcc gcc-c++ kernel-devel nginx htop screen wget curl postgresql postgresql-contrib
|
||||
echo $sudoPW | sudo -S yum --assumeyes upgrade
|
||||
echo $sudoPW | sudo -S yum --assumeyes install deltarpm psmisc
|
||||
echo $sudoPW | sudo -S yum --assumeyes install epel-release git make automake gcc gcc-c++ kernel-devel nginx htop screen wget curl postgresql postgresql-server postgresql-contrib
|
||||
else
|
||||
sudo apt-get -y -q --force-yes update
|
||||
sudo apt-get -y -q --force-yes upgrade
|
||||
sudo apt-get --assume-yes install build-essential git nginx htop screen wget curl postgresql postgresql-contrib
|
||||
echo $sudoPW | sudo -S apt-get -y -q --force-yes update
|
||||
echo $sudoPW | sudo -S apt-get -y -q --force-yes upgrade
|
||||
echo $sudoPW | sudo -S apt-get --assume-yes install build-essential git nginx htop screen wget curl postgresql postgresql-contrib
|
||||
fi
|
||||
fi
|
||||
|
||||
# set up and install swap file
|
||||
if [[ ! -f "$SWAP" ]]; then
|
||||
sudo fallocate -l 1G $SWAP
|
||||
sudo chmod 600 $SWAP
|
||||
sudo mkswap $SWAP
|
||||
sudo swapon $SWAP
|
||||
fancy_echo "${YELLOW}Setting up swapfile...${RESET}"
|
||||
|
||||
echo $sudoPW | sudo -S fallocate -l 1G $SWAP
|
||||
echo $sudoPW | sudo -S chmod 600 $SWAP
|
||||
echo $sudoPW | sudo -S mkswap $SWAP
|
||||
echo $sudoPW | sudo -S swapon $SWAP
|
||||
fi
|
||||
|
||||
# setup node and npm
|
||||
if [ ! -d "$NVM" ]; then
|
||||
fancy_echo "${YELLOW}Installing Node...${RESET}"
|
||||
|
||||
# Will enter here if $DIRECTORY exists, even if it contains spaces
|
||||
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
|
||||
@ -98,17 +124,25 @@ if [ ! -d "$NVM" ]; then
|
||||
|
||||
source $HOME/.bashrc
|
||||
source $NVM/nvm.sh
|
||||
nvm install $NVM_VERSION
|
||||
fi
|
||||
|
||||
nvm install $NVM_VERSION
|
||||
|
||||
|
||||
# get source and build
|
||||
|
||||
# Install global packages.
|
||||
fancy_echo "Installing global packages ..."
|
||||
|
||||
fancy_echo "${YELLOW}Installing Node Global Packages...${RESET}"
|
||||
|
||||
npm set progress=false
|
||||
npm install -g gulp bower pm2 npm-check npm-install-missing ember-cli phantomjs-prebuilt
|
||||
|
||||
pm2 completion install
|
||||
NPM_PATH=$(which npm)
|
||||
|
||||
echo $sudoPW | sudo -S su -c "env PATH=$PATH:${NPM_PATH%/npm} pm2 startup linux -u $USER --hp $HOME"
|
||||
|
||||
if [ ! -d "$LIVE" ]; then
|
||||
mkdir $LIVE
|
||||
fi
|
||||
@ -122,7 +156,7 @@ cd $DEV
|
||||
# Get latest version of Obrand Admin
|
||||
|
||||
if [ ! -d "$DEV/$FRONT/.git" ]; then
|
||||
git clone https://censis.visualstudio.com/DefaultCollection/_git/O-Brand
|
||||
git clone $GIT_FRONTEND
|
||||
else
|
||||
cd $DEV/$FRONT
|
||||
git pull origin master
|
||||
@ -130,7 +164,7 @@ else
|
||||
fi
|
||||
|
||||
if [ ! -d "$DEV/$SERVER/.git" ]; then
|
||||
git clone https://censis.visualstudio.com/DefaultCollection/O-Brand/_git/O-BrandServer
|
||||
git clone $GIT_SERVER
|
||||
else
|
||||
cd $DEV/$SERVER
|
||||
git pull origin master
|
||||
@ -158,28 +192,92 @@ cd $DEV/$FRONT/dist
|
||||
|
||||
cp -ra . $STAGING/wwwroot
|
||||
|
||||
if [[ $DATABASE = "yes" ]]; then
|
||||
if [[ $DATABASE = "YES" ]]; then
|
||||
fancy_echo "${PURPLE}Setting up Database server...${RESET}"
|
||||
|
||||
echo Setting up Database server...
|
||||
if [ $(basename $PKG_MANAGER) = "yum" ]; then
|
||||
|
||||
# sudo su - postgres -c "$DEV/$DBSETUP"
|
||||
# node dbconfig.js
|
||||
PGHOME=/var/lib/pgsql
|
||||
if [ ! -d "$PGHOME" ]; then
|
||||
PGHOME=/var/lib/pgsql92
|
||||
fi
|
||||
|
||||
echo $sudoPW | sudo -S rsync -vua `echo $DEV/$SERVER/pg_hba.conf` `echo $PGHOME/data`;
|
||||
echo $sudoPW | sudo -S chown postgres:postgres `echo $PGHOME/data/pg_hba.conf`
|
||||
|
||||
# if [ -e "/var/lib/pgsql9/data/pg_hba.conf" ]; then
|
||||
if sudo -u postgres test -f "/var/lib/pgsql9/data/pg_hba.conf"; then
|
||||
echo "${RED}Other...${RESET}"
|
||||
echo $sudoPW | sudo -s cp `echo $DEV/$SERVER/pg_hba.conf` /var/lib/pgsql9/data/pg_hba.conf
|
||||
fi
|
||||
|
||||
if [ $SYSTEMDCALL -eq 1 ]; then
|
||||
echo $sudoPW | sudo -S systemctl enable postgresql
|
||||
sudo -S postgresql-setup initdb
|
||||
else
|
||||
echo $sudoPW | sudo -S service postgresql initdb
|
||||
echo $sudoPW | sudo -S service postgresql restart
|
||||
fi
|
||||
else
|
||||
PGHOME=/var/lib/postgresql
|
||||
echo $sudoPW | sudo -S rsync -vua `echo $DEV/$SERVER/pg_hba.conf` /etc/postgresql/9.3/main/pg_hba.conf;
|
||||
echo $sudoPW | sudo -S service postgresql restart
|
||||
fi
|
||||
|
||||
cd $DEV/$SERVER
|
||||
node dbconfig.js
|
||||
fi
|
||||
|
||||
|
||||
echo Copying...
|
||||
fancy_echo "${YELLOW}Copying files to LIVE...${RESET}"
|
||||
rsync -uav --exclude .git $STAGING/ $LIVE
|
||||
|
||||
|
||||
|
||||
|
||||
# Configure nginx
|
||||
if [[ $NGINX = "yes" ]]; then
|
||||
if [[ $NGINX = "YES" ]]; then
|
||||
fancy_echo "${PURPLE}Setting up NGinx...${RESET}"
|
||||
echo $sudoPW | sudo -S fuser -k 80/tcp
|
||||
|
||||
sudo fuser -k 80/tcp
|
||||
echo $sudoPW | sudo -S cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.$(date "+%b_%d_%Y_%H.%M.%S")
|
||||
|
||||
sudo wget https://dl.dropboxusercontent.com/u/233909/obrand/obrand.nginx -O /etc/nginx/sites-available/obrand && sudo ln -s /etc/nginx/sites-available/obrand /etc/nginx/sites-enabled/obrand
|
||||
if [ $(basename $PKG_MANAGER) = "yum" ]; then
|
||||
|
||||
sudo rm /etc/nginx/sites-enabled/default
|
||||
if [ $SYSTEMDCALL -eq 1 ]; then
|
||||
echo $sudoPW | sudo -S systemctl start nginx
|
||||
else
|
||||
echo $sudoPW | sudo -S service nginx start
|
||||
fi
|
||||
|
||||
wget https://dl.dropboxusercontent.com/u/233909/obrand/obrand.nginx -O $HOME/obrand.nginx
|
||||
echo $sudoPW | sudo -S cp $HOME/obrand.nginx /etc/nginx/conf.d/obrand.conf
|
||||
|
||||
wget https://dl.dropboxusercontent.com/u/233909/obrand/nginx.conf -O $HOME/nginx.conf
|
||||
echo $sudoPW | sudo -S cp $HOME/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
if [ -f "/etc/nginx/conf.d/virtual.conf" ]; then
|
||||
echo $sudoPW | sudo -S mv /etc/nginx/conf.d/virtual.conf /etc/nginx
|
||||
fi
|
||||
|
||||
if [ -d "/var/cache/nginx/proxy" ]; then
|
||||
echo $sudoPW | sudo -S mkdir -p /var/cache/nginx/proxy
|
||||
fi
|
||||
|
||||
if [ $SYSTEMDCALL -eq 1 ]; then
|
||||
echo $sudoPW | sudo -S systemctl restart nginx
|
||||
else
|
||||
echo $sudoPW | sudo -S service nginx restart
|
||||
fi
|
||||
|
||||
else
|
||||
echo $sudoPW | sudo -S wget https://dl.dropboxusercontent.com/u/233909/obrand/obrand.nginx -O /etc/nginx/sites-available/obrand && sudo ln -s /etc/nginx/sites-available/obrand /etc/nginx/sites-enabled/obrand
|
||||
echo $sudoPW | sudo -S rm /etc/nginx/sites-enabled/default
|
||||
echo $sudoPW | sudo -S /etc/init.d/nginx restart
|
||||
fi
|
||||
fi
|
||||
|
||||
npm set progress=true
|
||||
sudo /etc/init.d/nginx restart
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
@ -9,10 +9,18 @@ FRONT="SODashServer"
|
||||
SWAP="/swapfile"
|
||||
PKG_MANAGER=$( command -v yum || command -v apt-get ) || echo "Neither yum nor apt-get found"
|
||||
PKG_DEVICE=$(basename $PKG_MANAGER)
|
||||
pidof systemd && SYSTEMDCALL=1 || SYSTEMDCALL=0
|
||||
UPDATE=no
|
||||
DATABASE=no
|
||||
NGINX=no
|
||||
|
||||
RED=`tput setaf 1`
|
||||
GREEN=`tput setaf 2`
|
||||
YELLOW=`tput setaf 3`
|
||||
PURPLE=`tput setaf 5`
|
||||
RESET=`tput sgr0`
|
||||
|
||||
|
||||
fancy_echo() {
|
||||
local fmt="$1"; shift
|
||||
|
||||
@ -35,7 +43,12 @@ case $i in
|
||||
NGINX=YES
|
||||
shift # past argument=value
|
||||
;;
|
||||
|
||||
-i|--install)
|
||||
UPDATE=YES
|
||||
NGINX=YES
|
||||
DATABASE=YES
|
||||
shift # past argument=value
|
||||
;;
|
||||
--default)
|
||||
DEFAULT=YES
|
||||
shift # past argument with no value
|
||||
@ -47,10 +60,12 @@ esac
|
||||
done
|
||||
|
||||
|
||||
fancy_echo "Installing Smart Office Console Server ..."
|
||||
fancy_echo "${YELLOW}Installing Smart Office Console Server ...${RESET}"
|
||||
## Update initial packages
|
||||
|
||||
fancy_echo Cleaning...
|
||||
read -s -p "Enter Password for sudo: " sudoPW
|
||||
|
||||
fancy_echo "${RED}Cleaning...${RESET}"
|
||||
|
||||
if [ ! -d "$DEV" ]; then
|
||||
mkdir -p $DEV
|
||||
@ -69,26 +84,33 @@ fi
|
||||
|
||||
|
||||
if [[ $UPDATE = "YES" ]]; then
|
||||
fancy_echo "${PURPLE}Updating system packages${RESET}"
|
||||
|
||||
if [ $(basename $PKG_MANAGER) = "yum" ]; then
|
||||
sudo yum --assumeyes upgrade
|
||||
sudo yum --assumeyes install git make automake gcc gcc-c++ kernel-devel nginx htop screen wget curl postgresql postgresql-contrib
|
||||
echo $sudoPW | sudo -S yum --assumeyes upgrade
|
||||
echo $sudoPW | sudo -S yum --assumeyes install deltarpm psmisc
|
||||
echo $sudoPW | sudo -S yum --assumeyes install git make automake gcc gcc-c++ kernel-devel nginx htop screen wget curl
|
||||
else
|
||||
sudo apt-get -y -q --force-yes update
|
||||
sudo apt-get -y -q --force-yes upgrade
|
||||
sudo apt-get --assume-yes install build-essential git nginx htop screen wget curl postgresql postgresql-contrib
|
||||
echo $sudoPW | sudo -S apt-get -y -q --force-yes update
|
||||
echo $sudoPW | sudo -S apt-get -y -q --force-yes upgrade
|
||||
echo $sudoPW | sudo -S apt-get --assume-yes install build-essential git nginx htop screen wget curl
|
||||
fi
|
||||
fi
|
||||
|
||||
# set up and install swap file
|
||||
if [[ ! -f "$SWAP" ]]; then
|
||||
sudo fallocate -l 1G $SWAP
|
||||
sudo chmod 600 $SWAP
|
||||
sudo mkswap $SWAP
|
||||
sudo swapon $SWAP
|
||||
fancy_echo "${YELLOW}Setting up swapfile...${RESET}"
|
||||
|
||||
echo $sudoPW | sudo -S fallocate -l 1G $SWAP
|
||||
echo $sudoPW | sudo -S chmod 600 $SWAP
|
||||
echo $sudoPW | sudo -S mkswap $SWAP
|
||||
echo $sudoPW | sudo -S swapon $SWAP
|
||||
fi
|
||||
|
||||
# setup node and npm
|
||||
if [ ! -d "$NVM" ]; then
|
||||
fancy_echo "${YELLOW}Installing Node...${RESET}"
|
||||
|
||||
# Will enter here if $DIRECTORY exists, even if it contains spaces
|
||||
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
|
||||
@ -97,32 +119,23 @@ if [ ! -d "$NVM" ]; then
|
||||
|
||||
source $HOME/.bashrc
|
||||
source $NVM/nvm.sh
|
||||
nvm install $NVM_VERSION
|
||||
fi
|
||||
|
||||
nvm install $NVM_VERSION
|
||||
|
||||
# get source and build
|
||||
|
||||
# Install global packages.
|
||||
npm set progress=false
|
||||
|
||||
if [[ $UPDATE = "YES" ]]; then
|
||||
fancy_echo "Installing global packages ..."
|
||||
npm install -g gulp bower pm2 npm-check npm-install-missing ember-cli phantomjs-prebuilt
|
||||
fi
|
||||
|
||||
if [ ! -d "$LIVE" ]; then
|
||||
mkdir $LIVE
|
||||
fi
|
||||
|
||||
if [ ! -d "$DEV" ]; then
|
||||
mkdir $DEV
|
||||
fancy_echo "${YELLOW}Installing Node Global Packages...${RESET}"
|
||||
npm install -g gulp bower pm2@latest npm-check npm-install-missing ember-cli phantomjs-prebuilt
|
||||
pm2 update
|
||||
fi
|
||||
|
||||
cd $DEV
|
||||
|
||||
# Get latest version of Obrand Admin
|
||||
|
||||
# Get latest version of smartoffice Admin Server
|
||||
if [ ! -d "$DEV/$FRONT/.git" ]; then
|
||||
git clone http://gitlab.silvrtree.co.uk/martind2000/SODashServer.git
|
||||
else
|
||||
@ -131,32 +144,57 @@ else
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Get latest version of Obrand Admin Server
|
||||
|
||||
cd $DEV/$FRONT
|
||||
cd $DEV/$FRONT
|
||||
|
||||
npm install . && npm-install-missing
|
||||
bower install
|
||||
gulp default
|
||||
rsync -uav --exclude .git $DEV/$FRONT/ $STAGING
|
||||
|
||||
|
||||
|
||||
echo Copying...
|
||||
fancy_echo "${YELLOW}Copying files to LIVE...${RESET}"
|
||||
rsync -uav --exclude .git $STAGING/ $LIVE
|
||||
|
||||
npm set progress=true
|
||||
|
||||
|
||||
# Configure nginx
|
||||
if [[ $NGINX = "YES" ]]; then
|
||||
fancy_echo "${PURPLE}Setting up NGinx...${RESET}"
|
||||
echo $sudoPW | sudo -S fuser -k 80/tcp
|
||||
|
||||
sudo fuser -k 80/tcp
|
||||
echo $sudoPW | sudo -S cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.$(date "+%b_%d_%Y_%H.%M.%S")
|
||||
|
||||
sudo wget https://dl.dropboxusercontent.com/u/233909/smartoffice/smartoffice.nginx -O /etc/nginx/sites-available/smartoffice.nginx && sudo ln -s /etc/nginx/sites-available/smartoffice.nginx /etc/nginx/sites-enabled/smartoffice.nginx
|
||||
if [ $(basename $PKG_MANAGER) = "yum" ]; then
|
||||
|
||||
sudo rm /etc/nginx/sites-enabled/default
|
||||
if [ $SYSTEMDCALL -eq 1 ]; then
|
||||
echo $sudoPW | sudo -S systemctl start nginx
|
||||
else
|
||||
echo $sudoPW | sudo -S service nginx start
|
||||
fi
|
||||
|
||||
sudo /etc/init.d/nginx restart
|
||||
wget https://dl.dropboxusercontent.com/u/233909/smartoffice/smartoffice.nginx -O $HOME/smartoffice.nginx
|
||||
echo $sudoPW | sudo -S cp $HOME/smartoffice.nginx /etc/nginx/conf.d/smartoffice.conf
|
||||
|
||||
fi
|
||||
wget https://dl.dropboxusercontent.com/u/233909/smartoffice/nginx.conf -O $HOME/nginx.conf
|
||||
echo $sudoPW | sudo -S cp $HOME/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
if [ -f "/etc/nginx/conf.d/virtual.conf" ]; then
|
||||
echo $sudoPW | sudo -S mv /etc/nginx/conf.d/virtual.conf /etc/nginx
|
||||
fi
|
||||
|
||||
if [ -d "/var/cache/nginx/proxy" ]; then
|
||||
echo $sudoPW | sudo -S mkdir -p /var/cache/nginx/proxy
|
||||
fi
|
||||
|
||||
if [ $SYSTEMDCALL -eq 1 ]; then
|
||||
echo $sudoPW | sudo -S systemctl restart nginx
|
||||
else
|
||||
echo $sudoPW | sudo -S service nginx restart
|
||||
fi
|
||||
|
||||
else
|
||||
echo $sudoPW | sudo -S wget https://dl.dropboxusercontent.com/u/233909/smartoffice/smartoffice.nginx -O /etc/nginx/sites-available/smartoffice.conf && sudo ln -s /etc/nginx/sites-available/smartoffice.conf /etc/nginx/sites-enabled/smartoffice.conf
|
||||
echo $sudoPW | sudo -S rm /etc/nginx/sites-enabled/default
|
||||
echo $sudoPW | sudo -S /etc/init.d/nginx restart
|
||||
fi
|
||||
fi
|
||||
|
@ -41,3 +41,12 @@ export PATH="$PATH:$HOME/android-sdk-macosx/tools:$HOME/android-sdk-macosx/platf
|
||||
|
||||
[[ -s /Users/martin/.nvm/nvm.sh ]] && . /Users/martin/.nvm/nvm.sh # This loads NVM
|
||||
|
||||
|
||||
##
|
||||
# Your previous /Users/martin/.bash_profile file was backed up as /Users/martin/.bash_profile.macports-saved_2016-05-04_at_13:31:48
|
||||
##
|
||||
|
||||
# MacPorts Installer addition on 2016-05-04_at_13:31:48: adding an appropriate PATH variable for use with MacPorts.
|
||||
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
|
||||
# Finished adapting your PATH environment variable for use with MacPorts.
|
||||
|
||||
|
@ -24,22 +24,26 @@ prompt_git() {
|
||||
|
||||
# Check for uncommitted changes in the index.
|
||||
if ! $(git diff --quiet --ignore-submodules --cached); then
|
||||
s+='+';
|
||||
# s+='+';
|
||||
s+=' 🚧';
|
||||
fi;
|
||||
|
||||
# Check for unstaged changes.
|
||||
if ! $(git diff-files --quiet --ignore-submodules --); then
|
||||
s+='!';
|
||||
# s+='!';
|
||||
s+=' ❗️';
|
||||
fi;
|
||||
|
||||
# Check for untracked files.
|
||||
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
||||
s+='?';
|
||||
# s+='?';
|
||||
s+=' 🚩';
|
||||
fi;
|
||||
|
||||
# Check for stashed files.
|
||||
if $(git rev-parse --verify refs/stash &>/dev/null); then
|
||||
s+='$';
|
||||
# s+='$';
|
||||
s+=' 📤';
|
||||
fi;
|
||||
|
||||
fi;
|
||||
@ -51,7 +55,7 @@ prompt_git() {
|
||||
git rev-parse --short HEAD 2> /dev/null || \
|
||||
echo '(unknown)')";
|
||||
|
||||
[ -n "${s}" ] && s=" [${s}]";
|
||||
[ -n "${s}" ] && s=" ${s} ";
|
||||
|
||||
echo -e "${1}${branchName}${2}${s}";
|
||||
else
|
||||
@ -113,7 +117,8 @@ PS1+="\[${white}\] in ";
|
||||
PS1+="\[${green}\]\w"; # working directory full path
|
||||
PS1+="\$(prompt_git \"\[${white}\] on \[${violet}\]\" \"\[${blue}\]\")"; # Git repository details
|
||||
PS1+="\n";
|
||||
PS1+="\[${white}\]\$ \[${reset}\]"; # `$` (and reset color)
|
||||
#PS1+="\[${white}\]\$ \[${reset}\]"; # `$` (and reset color)
|
||||
PS1+="\[${white}\]\$ \[${reset}\]"; # ${s} (and reset color)
|
||||
export PS1;
|
||||
|
||||
PS2="\[${yellow}\]→ \[${reset}\]";
|
||||
|
Loading…
Reference in New Issue
Block a user