forked from apache/shindig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
124 lines (110 loc) · 4.72 KB
/
Makefile
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
SOCIALCONF = java/graaasp/src/main/resources/
SOCIALJPA = java/graaasp/src/main/resources/socialjpa.properties
SHINDIGCONF = java/common/conf/
SHINDIG = java/common/conf/shindig.properties
WEBCONF = java/server-resources/src/main/webapp/WEB-INF/
WEBXML = java/server-resources/src/main/webapp/WEB-INF/web.xml
WAR = java/server/target/shindig-server-2.5.0.war
TOMCAT = /Library/Tomcat
default:
@echo "Compiling shindig"
@mvn -Dmaven.test.skip
compile:
@echo "Cleaning and compiling shindig"
@mvn clean && mvn -Dmaven.test.skip
info:
# Server urls
# ===========
# Reacttest:
# http://reacttest.epfl.ch
# http://shindigdev.epfl.ch
# Production:
# http://graasp.epfl.ch
# http://shindig.epfl.ch
#
# Commands
# ========
# $ make prepare # clean everything and loads local/prod/react settings into project
# $ make # compile locally
# $ make compile # call "mvn clean" and compile locally
# $ make start # start the local server
# $ make react # compile .war for reactest
# $ make prod # compile .war for production
# $ make deploy_react # deploy .war to reacttest
# $ make deploy_prod # deploy .war to production
# $ make restart_react # restart shindig at reacttest
# $ make restart_prod # restart shindig at production
start:
@echo "Starting the server"
@cd java/server && mvn jetty:run
prepare: clean settings
clean:
@echo "Cleaning temporary changes"
@echo "socialjpa.properties"
@if [[ -a $(SOCIALJPA)_development ]]; then cp $(SOCIALJPA)_development $(SOCIALJPA); fi
@rm -rf $(SOCIALJPA)_* > /dev/null 2>&1
@echo "shindig.properties"
@if [[ -a $(SHINDIG)_development ]]; then cp $(SHINDIG)_development $(SHINDIG); fi
@rm -rf $(SHINDIG)_* > /dev/null 2>&1
@echo "web.xml"
@if [[ -a $(WEBXML)_development ]]; then cp $(WEBXML)_development $(WEBXML); fi
@rm -rf $(WEBXML)_* > /dev/null 2>&1
@if [[ -a reacttest.war ]]; then rm reacttest.war; fi
@if [[ -a production.war ]]; then rm production.war; fi
@mvn clean
settings:
@echo "Getting config files and putting them into correct locations"
@rm -rf prod_config
@git clone ssh://[email protected]/opt/git/config.git prod_config
@cp prod_config/shindig/web.xml_* $(WEBCONF)
@cp prod_config/shindig/shindig.properties_* $(SHINDIGCONF)
@cp prod_config/shindig/socialjpa.properties_* $(SOCIALCONF)
@cp $(SOCIALJPA)_development $(SOCIALJPA)
@cp $(SHINDIG)_development $(SHINDIG)
@cp $(WEBXML)_development $(WEBXML)
@rm -rf prod_config
all: prod react
prod:
@echo "Creating production.war file"
@echo "socialjpa.properties"
@cp $(SOCIALJPA)_production $(SOCIALJPA)
@echo "shindig.properties"
@cp $(SHINDIG)_production $(SHINDIG)
@echo "web.xml"
@cp $(WEBXML)_production $(WEBXML)
@mvn clean
@mvn -Dmaven.test.skip && cp $(WAR) production.war \
&& echo "Move production.war to ROOT.war for Tomcat"
react:
@echo "Creating reacttest.war file"
@echo "socialjpa.properties"
@cp $(SOCIALJPA)_reacttest $(SOCIALJPA)
@echo "shindig.properties"
@cp $(SHINDIG)_reacttest $(SHINDIG)
@echo "web.xml"
@cp $(WEBXML)_reacttest $(WEBXML)
@mvn clean
@mvn -Dmaven.test.skip && cp $(WAR) reacttest.war \
&& echo "Move reacttest.war to ROOT.war for Tomcat"
restart_react:
echo "Restarting the reacttest server"
ssh [email protected] '$(TOMCAT)/bin/shutdown.sh > /dev/null 2>&1 || true; nohup $(TOMCAT)/bin/startup.sh;'
deploy_react:
echo "Starting deployment of reacttest.war to Test server (reacttest.epfl.ch|shindigdev.epfl.ch)"
echo "Copying file to the remote server"
scp -C reacttest.war [email protected]:/Library/Tomcat/webapps/ROOT.war.new
echo "Backing up the previous version and setting the new one"
ssh [email protected] 'cd $(TOMCAT)/webapps; if [[ -a ROOT.war ]]; then mv ROOT.war ROOT.war.bak; fi; mv ROOT.war.new ROOT.war'
echo "Restarting the reacttest server"
ssh [email protected] '$(TOMCAT)/bin/shutdown.sh > /dev/null 2>&1 || true; rm -rf $(TOMCAT)/webapps/ROOT; nohup $(TOMCAT)/bin/startup.sh;'
restart_prod:
echo "Restarting the production server"
ssh [email protected] '$(TOMCAT)/bin/shutdown.sh > /dev/null 2>&1 || true; nohup $(TOMCAT)/bin/startup.sh;'
deploy_prod:
echo "Starting deployment of production.war to main server (graasp.epfl.ch|shindig.epfl.ch)"
echo "Copying file to the remote server"
scp -C production.war [email protected]:/Library/Tomcat/webapps/ROOT.war.new
echo "Backing up the previous version and setting the new one"
ssh [email protected] 'cd $(TOMCAT)/webapps; if [[ -a ROOT.war ]]; then mv ROOT.war ROOT.war.bak; fi; mv ROOT.war.new ROOT.war'
echo "Restarting the production server"
ssh [email protected] '$(TOMCAT)/bin/shutdown.sh > /dev/null 2>&1 || true; rm -rf $(TOMCAT)/webapps/ROOT; nohup $(TOMCAT)/bin/startup.sh;'