-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprovision.sh
executable file
·58 lines (41 loc) · 2.24 KB
/
provision.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
#!/bin/sh
# ----------------------------------------------------------------------------------------------------------------------
# Change working directory
# ----------------------------------------------------------------------------------------------------------------------
cd $(dirname $0)
# ----------------------------------------------------------------------------------------------------------------------
# Set environment variables
# ----------------------------------------------------------------------------------------------------------------------
if [ ! -f ./.env ]; then
echo "ERROR: .env file not found in project root. Please create it from .env.dist file."
exit 1
fi
. ./.env && ENV_VARS=`cat ./.env`
# ----------------------------------------------------------------------------------------------------------------------
# Pull from SVC
# ----------------------------------------------------------------------------------------------------------------------
git checkout .
git pull
# ----------------------------------------------------------------------------------------------------------------------
# Install salt dependencies
# ----------------------------------------------------------------------------------------------------------------------
sudo apt-get -y install git-core
sudo apt-get -y install python-setuptools
sudo easy_install GitPython
curl -L https://bootstrap.saltstack.com | sudo sh
# ----------------------------------------------------------------------------------------------------------------------
# Run SaltStack States
# ----------------------------------------------------------------------------------------------------------------------
sudo rm /etc/salt/minion
sudo rm -rf /srv/salt/
sudo cp salt/minion.conf /etc/salt/minion
sudo cp -a salt /srv/salt
sudo ${ENV_VARS} salt-call --local state.highstate
# ----------------------------------------------------------------------------------------------------------------------
# Finalize
# ----------------------------------------------------------------------------------------------------------------------
./bin/console cache:clear --env=dev
./bin/console cache:clear --env=prod
sudo chmod -R 775 var
sudo chown -R root:www-data var
sudo service apache2 restart