From 1e1e7112406d4ef2d66b8e6949fa7878e6cf718a Mon Sep 17 00:00:00 2001 From: Owain Jones <owanes@noc.ac.uk> Date: Fri, 12 Feb 2016 13:19:19 +0000 Subject: [PATCH] added stuff for HHVM, automatically set up github api key variables for composer and bower --- deploy.sh | 14 +++++++++++++- hhvm.service | 10 ++++++++++ install.sh | 16 ++++++++++++++++ nginx.conf | 4 ++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 hhvm.service diff --git a/deploy.sh b/deploy.sh index bbc3a1d..a377d04 100644 --- a/deploy.sh +++ b/deploy.sh @@ -40,6 +40,8 @@ git clone git@gitlab.noc.soton.ac.uk:owanes/gliders-website.git # then fetch all our log files and parse them! cd gliders-tools python setup.py install +sudo cp fetchlogs.service /etc/systemd/system/ +sudo systemctl enable fetchlogs echo "please enter your mysql root user password" read -s pass @@ -48,11 +50,21 @@ echo "CREATE USER 'gliders'@'%' IDENTIFIED BY '"$pass"' ;" | mysql -u root -p$pa echo "GRANT ALL ON gliders.* TO 'gliders'@'%';" | mysql -u root -p$pass cd bin sh migrate_data.sh +sudo systemctl start fetchlogs # Set up a GitHub API key and add it to .bash_profile # export API_KEY=... +echo "Deploying the website requires interacting with GitHub a lot." +echo "We need a GitHub API Key so we don't go over the public limits." +echo "Please go to: https://github.com/settings/tokens/new?scopes=repo&description=`hostname`" +echo "Generate the token and then paste it into the prompt below." +read -p "Token: " GITHUB_API_KEY +echo "export GITHUB_API_KEY=$GITHUB_API_KEY" >> ~/.bashrc +echo "export BOWERPHP_TOKEN=$GITHUB_API_KEY" >> ~/.bashrc +composer config -g github-oauth.github.com $GITHUB_API_KEY +export BOWERPHP_TOKEN=$GITHUB_API_KEY # Deploy the website cd /home/gliders/code/gliders-website sh bin/deploy.sh /var/gliders/www_dev dev -sh bin/deploy.sh /var/gliders/www prod \ No newline at end of file +sh bin/deploy.sh /var/gliders/www prod diff --git a/hhvm.service b/hhvm.service new file mode 100644 index 0000000..6c4a92b --- /dev/null +++ b/hhvm.service @@ -0,0 +1,10 @@ +[Unit] +Description=HHVM HipHop Virtual Machine (FCGI) + +[Service] +ExecStartPre=/bin/mkdir -p /var/run/hhvm +ExecStartPre=/bin/chown -R gliders:nginx /var/run/hhvm +ExecStart=/usr/local/bin/hhvm --user gliders --mode daemon -d hhvm.server.type=fastcgi -d hhvm.server.file_socket=/var/run/hhvm/sock + +[Install] +WantedBy=multi-user.target diff --git a/install.sh b/install.sh index 01672a2..af5fc8f 100644 --- a/install.sh +++ b/install.sh @@ -123,3 +123,19 @@ systemctl enable haveged # Enable SystemD User services to start automatically on machine # boot and continue running even if the user never logs in... loginctl enable-linger gliders + +# (optional) Compile HHVM -- this will take ages! +# yum install cpp gcc-c++ cmake git psmisc {binutils,boost,jemalloc}-devel \ +# {ImageMagick,sqlite,tbb,bzip2,openldap,readline,elfutils-libelf,gmp,lz4,pcre}-devel \ +# lib{xslt,event,yaml,vpx,png,zip,icu,mcrypt,memcached,cap,dwarf}-devel \ +# {unixODBC,expat,mariadb}-devel lib{edit,curl,xml2,xslt}-devel \ +# glog-devel oniguruma-devel ocaml gperf enca libjpeg-turbo-devel openssl-devel \ +# mariadb mariadb-server make -y +# git clone https://github.com/facebook/hhvm -b master hhvm --recursive +# cd hhvm +# cmake . +# make -j4 +# make install +# cd - +# cp hhvm.service /etc/systemd/system/ +# systemctl enable hhvm diff --git a/nginx.conf b/nginx.conf index 3f9b19e..8441e3d 100644 --- a/nginx.conf +++ b/nginx.conf @@ -39,6 +39,10 @@ http { server unix:/var/run/php5-fpm.sock; #for PHP-FPM running on UNIX socket } + upstream hhvmfcgi { + server unix:/var/run/hhvm/sock; + } + # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. -- GitLab