Last active
August 29, 2015 14:07
-
-
Save slouma2000/ed4245dc5312fafbcbfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://gist.github.com/fideloper/7074502 | |
echo ">>> Starting Install Script" | |
# Update | |
sudo yum -y update | |
sudo rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm | |
# Install MySQL without prompt | |
# sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root' | |
# sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root' | |
echo ">>> Installing Base Items" | |
# http://bixly.com/blog/supervisord-or-how-i-learned-to-stop-worrying-and-um-use-supervisord/ | |
sudo groupadd supervisor | |
sudo usermod -a -G supervisor vagrant | |
# Install base items | |
sudo yum install -y vim curl wget build-essential python-software-properties python-setuptools libaio gcc gcc-c++ make automake autoconf | |
# python stuffs | |
sum yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel | |
echo ">>> Installing Ruby Items ... tools etc ..." | |
# Ruby has many useful tools | |
# sudo yum -y install ruby rubygems curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel | |
# sudo yum -y install ruby-rdoc ruby-devel | |
# sudo gem update --system | |
# Update Again | |
sudo yum update | |
echo ">>> Installing Web Server Items ... httpd php-etc ..." | |
# Install all the other full stuff for web we need | |
sudo yum install -y git-core php54w php54w-cli php54w-common httpd php54w-curl php54w-mbstring php54w-mysql php54w-gd php54w-dom php54w-mcrypt php54w-imap php54w-xdebug php54w-ldap php54w-pdo | |
sudo yum install -y mysql mysql-server | |
# sudo chmod -R 755 /var/lib/mysql/ | |
sudo service mysqld restart | |
# make sure mysqld restarts with the server | |
sudo chkconfig --add mysqld | |
sudo chkconfig --level 345 mysqld on | |
# PHP Config | |
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php.ini | |
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php.ini | |
# no luck with more targeted sed script .. | |
# sudo sed -r '\%<Directory "/var/www/html">%,\%</Directory>% s%(AllowOverride)\s+None%\1 All%i' /etc/httpd/conf/httpd.conf | |
# A bit on the "dangerous" side but for the dev boxes should be fine | |
sudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf | |
# To validate sed works | |
# less +300g /etc/httpd/conf/httpd.conf | |
echo ">>> Configured web services ... restarting httpd " | |
sudo service httpd restart | |
# make sure httpd restarts with the server | |
sudo chkconfig --add httpd | |
sudo chkconfig --level 345 httpd on | |
echo ">>> Installing beanstalkd " | |
# Fireup beanstalkd | |
sudo yum install beanstalkd -y | |
sudo service beanstalkd start | |
# make sure beanstalkd restarts with the server | |
sudo chkconfig --add beanstalkd | |
sudo chkconfig --level 345 beanstalkd on | |
echo ">>> Starting to setup redis ... " | |
# download and install redis | |
sudo yum install redis -y | |
sudo chkconfig --add redis | |
sudo chkconfig --level 345 redis on | |
sudo mkdir /etc/redis | |
sudo cp /etc/redis.conf /etc/redis/redis.conf | |
sed -e "s/^daemonize no$/daemonize yes/" -e "s/^# bind 127.0.0.1$/bind 127.0.0.1/" -e "s/^dir \.\//dir \/var\/lib\/redis\//" -e "s/^loglevel verbose$/loglevel notice/" -e "s/^logfile stdout$/logfile \/var\/log\/redis.log/" /etc/redis.conf > /etc/redis/redis.conf | |
sudo redis-server /etc/redis/redis.conf | |
# gem install redmon | |
# sudo /etc/init.d/redis stop | |
echo ">>> Starting to setup supervisord ... watch procesee " | |
sudo easy_install supervisor | |
# sudo yum install -y supervisor | |
sudo mkdir /etc/supervisor.d/ | |
sudo touch /etc/supervisor.d/laravel-listener.conf | |
sudo touch /etc/supervisord.conf | |
sudo mkdir /var/log/supervisor/ | |
sudo touch /var/log/supervisor/supervisord.log | |
sudo cp /var/www/html/conf/supervisord.conf /etc/supervisord.conf | |
sudo cp /var/www/html/conf/laravel-listener.conf /etc/supervisor.d/laravel-listener.conf | |
str=$'[include]\nfiles = /etc/supervisord.d/*.conf' | |
sudo sh -c "echo '$str' >> /etc/supervisord.conf" | |
sudo supervisord -c /etc/supervisord.conf | |
sudo supervisorctl reread | |
# sudo vi /etc/supervisord.d/laravel-listener.conf | |
#[program:laravel-listener] | |
#command=php artisan queue:listen | |
#directory=/var/www/console.cudaops.com | |
#stdout_logfile=/var/www/console.cudaops.com/app/storage/logs/myqueue_supervisord.log | |
#redirect_stderr=true | |
# | |
# Git Config | |
#rm -rf /var/www | |
#ln -fs /vagrant /var/www | |
echo ">>> Updating ~./bashrc" | |
sed -i "\$a export www='/var/www/html/'" ~/.bashrc | |
# ... Add index.html ... so no one can see directory | |
sudo touch /var/www/html/index.html | |
echo ">>> Installing Composer" | |
# Composer | |
curl -sS https://getcomposer.org/installer | php | |
sudo mv composer.phar /usr/local/bin/composer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:laravel-listener] | |
command=php artisan queue:listen | |
directory=/var/www/html/lv | |
stdout_logfile=/var/www/html/laravel-listener.log | |
redirect_stderr=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Sample supervisor config file. | |
[unix_http_server] | |
file=/tmp/supervisor.sock ; (the path to the socket file) | |
;chmod=0700 ; sockef file mode (default 0700) | |
;chown=nobody:nogroup ; socket file uid:gid owner | |
;username=user ; (default is no username (open server)) | |
;password=123 ; (default is no password (open server)) | |
;[inet_http_server] ; inet (TCP) server disabled by default | |
;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) | |
;username=user ; (default is no username (open server)) | |
;password=123 ; (default is no password (open server)) | |
[supervisord] | |
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) | |
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) | |
logfile_backups=10 ; (num of main logfile rotation backups;default 10) | |
loglevel=info ; (log level;default info; others: debug,warn,trace) | |
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | |
nodaemon=false ; (start in foreground if true;default false) | |
minfds=1024 ; (min. avail startup file descriptors;default 1024) | |
minprocs=200 ; (min. avail process descriptors;default 200) | |
; the below section must remain in the config file for RPC | |
; (supervisorctl/web interface) to work, additional interfaces may be | |
; added by defining them in separate rpcinterface: sections | |
[rpcinterface:supervisor] | |
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | |
[supervisorctl] | |
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket | |
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket | |
;username=chris ; should be same as http_username if set | |
;password=123 ; should be same as http_password if set | |
;prompt=mysupervisor ; cmd line prompt (default "supervisor") | |
;history_file=~/.sc_history ; use readline history if available | |
[include] | |
files = /etc/supervisor.d/*.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
# For a list of vagrant boxes visit the site below | |
# http://www.vagrantbox.es/ | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# Every Vagrant virtual environment requires a box to build off of. | |
config.vm.box = "centos6.4" | |
# The url from where the 'config.vm.box' box will be fetched if it | |
# doesn't already exist on the user's system. | |
config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v0.1.0/centos64-x86_64-20131030.box" | |
# Create a forwarded port mapping which allows access to a specific port | |
# within the machine from a port on the host machine. In the example below, | |
# accessing "localhost:8080" will access port 80 on the guest machine. | |
config.vm.network :forwarded_port, guest: 80, host: 8080 | |
config.vm.provision :shell, :path => "boostrap.sh" | |
# Create a private network, which allows host-only access to the machine | |
# using a specific IP. | |
# config.vm.network :private_network, ip: "10.0.0.100", :netmask => "255.255.0.0" | |
config.vm.hostname = "consoledev.local" | |
# Synced folders are configured below | |
config.vm.synced_folder "html/", "/var/www/html/" | |
#https://github.com/mitchellh/vagrant/issues/713#issuecomment-4416384 | |
config.vm.provider :virtualbox do |vb| | |
# vb.customize ['setextradata', :id, 'VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root', '1' ] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment