Skip to content

Instantly share code, notes, and snippets.

@ynurmahomed
Forked from anonymous/default
Last active December 18, 2015 04:09
Show Gist options
  • Save ynurmahomed/5723758 to your computer and use it in GitHub Desktop.
Save ynurmahomed/5723758 to your computer and use it in GitHub Desktop.

Baixa e instala os programas necessários para o geremin. Deve ser executado como superuser.

O arquivo default serve para poder usar o mod_rewrite do Apache, este deve ser colocado na pasta env/apache/ no diretório onde o provision.sh será executado.

Após executado o diretório raiz dos sites servidos pelo Apache será o /vagrant.

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
# Para poder usar o mod_rewrite
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
#!/usr/bin/env bash
# Testa se o script já foi executado e termina a execução se true
test -f /etc/bootstraped && exit
# Proxy da UFU :/
PROXY_UFU="http://proxy.ufu.br:3128/"
PROXY=$PROXY_UFU # use PROXY="" para desabilitar
export http_proxy=$PROXY
apt-get update
#
# MongoDB
#
MONGO_VERSION="2.4.*"
MONGO_DATABASE="geremin"
MONGO_USER=$MONGO_DATABASE
MONGO_PASSWORD=$MONGO_USER
MONGO_ROLES="'readWrite'" # use "'role','role',..."
# Instala o pacote
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
PACKAGE="deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
echo $PACKAGE | sudo tee /etc/apt/sources.list.d/10gen.list
apt-get update
# Instala MongoDB
apt-get install -y --force-yes mongodb-10gen=$MONGO_VERSION
# Cria BD e user
newUser="db.addUser({user: '$MONGO_USER', pwd: '$MONGO_PASSWORD', roles: [$MONGO_ROLES]})"
echo $newUser
mongo --eval "$newUser" $MONGO_DATABASE
#
# Apache
#
APACHE_VERSION="2.2.*"
# Instala o apache e cria link simbólico de '/var/www' para '/vagrant'
apt-get install -y apache2=$APACHE_VERSION
rm -rf /var/www
ln -fs /vagrant /var/www
# Ativa o 'mod_rewrite' do apache
a2enmod rewrite
sudo cp /vagrant/env/apache/default /etc/apache2/sites-available/default
service apache2 restart
#
# PHP
#
PHP_PPA="ppa:ondrej/php5"
PHP_VERSION="5.4.*"
# Instala o 'add-apt-repository'
apt-get install -y python-software-properties
# Instala o ppa
add-apt-repository -y $PHP_PPA
apt-get update
# Instala o PHP
apt-get install -y --force-yes php5=$PHP_VERSION
#
# Git
#
sudo apt-get install -y git
#
# Composer
#
# Baixa e instala o Composer
apt-get install -y curl
[[ $PROXY = "" ]] && proxy_option="" || proxy_option="--proxy $PROXY"
curl -sS $proxy_option https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
# Sinaliza que este script já foi executado
date > /etc/bootstraped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment