This repository has been archived by the owner on Mar 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.sh
executable file
·101 lines (80 loc) · 3.19 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# Ubuntu 14.04 dev install script
#
# This script should take a clean ubuntu 14.04 install
# and install all the necessary dependencies to have
# a working Symfony development environment.
#
# Run this script as your unprivileged user (ubuntu or yourname)
set -e
DOCKER_COMPOSE_VERSION=1.4.0rc3
# Needed for some Symfony CLI commands
if [ ! -f /usr/bin/mysql ]; then
echo "Installing MySQL command line client."
sudo apt-get install -y mysql-client-5.6
fi
# Extended file system Access Control List support
if [ ! -f /usr/bin/setfacl ]; then
echo "Installing extended Access Control List support."
sudo apt-get install -y acl
fi
# Support for running PHP on the Command Line
if [ ! -f /usr/bin/php ]; then
echo "Installing PHP command line support."
sudo apt-get install -y php5-cli
fi
if [ ! -f /usr/bin/curl ]; then
echo "Installing curl utility."
sudo apt-get install -y curl
fi
# Default folder in Ubuntu for small user-installed applications
if [ ! -d ~/bin ]; then
echo "Creating ~/bin."
mkdir ~/bin
fi
# Docker management tool, formerly known as Fig
if [ ! -e ~/bin/docker-compose ]; then
echo "Installing docker-compose (aka Fig)."
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 > ~/bin/docker-compose
chmod +x ~/bin/docker-compose
fi
# Command line PHP test runner
if [ ! -e ~/bin/phpunit ]; then
echo "Installing PHPunit."
curl -L https://phar.phpunit.de/phpunit.phar > ~/bin/phpunit
chmod +x ~/bin/phpunit
fi
# PHP Composer package manager
if [ ! -f ~/bin/composer ]; then
echo "Installing PHP composer."
curl -sS https://getcomposer.org/installer | php -- --install-dir=/home/$USER/bin --filename=composer
fi
# Docker container service
if [ ! -f /usr/bin/docker ]; then
echo "Installing Docker."
curl -s https://get.docker.io/ubuntu/ | sudo sh
fi
# Remove need for sudo when using docker; needs desktop relogin to become effective
if groups "$USER" | grep -q -v -E ' docker(\s|$)'; then
echo "Adding your user to 'docker' group, removing the need for using 'sudo' with docker."
sudo usermod -a -G docker $USER
echo "Your user accounts's group membership has been changed. Please log out from your user account, log back in to activate the changes, and then run this script again."
exit 0
fi
# Build the Docker images
echo "Building Docker images."
docker build -t symfony/worker-base worker-base
docker build -t symfony/worker-dev worker-dev
# Give the user and web server group full write access to all given directories
echo "Make log folders writable for web server group."
for WRITABLE_FOLDER in var/nginx
do
mkdir -p ${WRITABLE_FOLDER}
# set permission for existing files
setfacl -R -m g:www-data:rwX -m u:$USER:rwX ${WRITABLE_FOLDER}
# set default permissions for future files
setfacl -dR -m g:www-data:rwX -m u:$USER:rwX ${WRITABLE_FOLDER}
done
echo "Don't forget to run manually run the following commands in your Symfony project folder before accessing the project:"
echo "setfacl -R -m g:www-data:rwX -m u:$USER:rwX app/cache app/logs web/assets"
echo "setfacl -dR -m g:www-data:rwX -m u:$USER:rwX app/cache app/logs web/assets"