Commit 4e762263524a35a09c8321362a18e2cbc7f9b482
1 parent
9c0c4509
Exists in
master
and in
2 other branches
pour installation
Showing
1 changed file
with
91 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,91 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +# Upload the sources to our production server, with minimal effort. | |
4 | + | |
5 | +# CONFIGURATION ################################################################ | |
6 | + | |
7 | +USER=mbouchemit | |
8 | +SERVER=storms.irap.omp.eu | |
9 | +REMOTE_DIR=/var/www/html/HELIOPROPA | |
10 | + | |
11 | + | |
12 | +# COLORS ####################################################################### | |
13 | + | |
14 | +Off='\033[0m' # Text Reset | |
15 | + | |
16 | +# Regular Colors | |
17 | +Black='\033[0;30m' # Black | |
18 | +Red='\033[0;31m' # Red | |
19 | +Green='\033[0;32m' # Green | |
20 | +Yellow='\033[0;33m' # Yellow | |
21 | +Blue='\033[0;34m' # Blue | |
22 | +Purple='\033[0;35m' # Purple | |
23 | +Cyan='\033[0;36m' # Cyan | |
24 | +White='\033[0;37m' # White | |
25 | + | |
26 | +# Bold | |
27 | +BBlack='\033[1;30m' # Black | |
28 | +BRed='\033[1;31m' # Red | |
29 | +BGreen='\033[1;32m' # Green | |
30 | +BYellow='\033[1;33m' # Yellow | |
31 | +BBlue='\033[1;34m' # Blue | |
32 | +BPurple='\033[1;35m' # Purple | |
33 | +BCyan='\033[1;36m' # Cyan | |
34 | +BWhite='\033[1;37m' # White | |
35 | + | |
36 | +# Underline | |
37 | +UBlack='\033[4;30m' # Black | |
38 | +URed='\033[4;31m' # Red | |
39 | +UGreen='\033[4;32m' # Green | |
40 | +UYellow='\033[4;33m' # Yellow | |
41 | +UBlue='\033[4;34m' # Blue | |
42 | +UPurple='\033[4;35m' # Purple | |
43 | +UCyan='\033[4;36m' # Cyan | |
44 | +UWhite='\033[4;37m' # White | |
45 | + | |
46 | +# Background | |
47 | +On_Black='\033[40m' # Black | |
48 | +On_Red='\033[41m' # Red | |
49 | +On_Green='\033[42m' # Green | |
50 | +On_Yellow='\033[43m' # Yellow | |
51 | +On_Blue='\033[44m' # Blue | |
52 | +On_Purple='\033[45m' # Purple | |
53 | +On_Cyan='\033[46m' # Cyan | |
54 | +On_White='\033[47m' # White | |
55 | + | |
56 | + | |
57 | +# LOCAL CLEANUP ################################################################ | |
58 | + | |
59 | +# Clear the local cache, it's good design (we're not uploading it anyways) | |
60 | +echo -e "${Green}Cleaning local files...${Off}" | |
61 | +rm -R cache/* | |
62 | + | |
63 | + | |
64 | +# UPLOAD ####################################################################### | |
65 | + | |
66 | +# Delete is dangerous, as we're using a file-based database | |
67 | +# so we need to exclude some directories and files. | |
68 | +echo -e "${Green}Uploading files...${Off}" | |
69 | +rsync -r --delete \ | |
70 | + --exclude .git \ | |
71 | + --exclude *.gitkeep \ | |
72 | + --exclude .idea \ | |
73 | + --exclude bin \ | |
74 | + --exclude cache \ | |
75 | + --exclude config.yml \ | |
1 |
|
|
76 | + . ${USER}@${SERVER}:${REMOTE_DIR} | |
77 | + | |
78 | + | |
79 | +# REMOTE CLEANUP ############################################################### | |
80 | + | |
81 | +# Run some scripts on the server, now | |
82 | +# You're going to need in your sudoers file something like : | |
83 | +# mbouchemit ALL=(apache) NOPASSWD: ALL | |
84 | +echo -e "${Green}Cleaning remote files...${Off}" | |
85 | +ssh -t -t ${USER}@${SERVER} <<-ENDSSH | |
86 | + cd ${REMOTE_DIR} | |
87 | + sudo -u apache rm -Rf cache/* | |
88 | + exit | |
89 | +ENDSSH | |
90 | + | |
91 | +echo -e "${BGreen}Done !${Off}" | ... | ... |