Skip to content

Commit d70357b

Browse files
authored
Code and README (#1)
* created project structure * updated * updated gitignore * updated * updated * updated * updated * update README.md * updated README * updated README
1 parent d331965 commit d70357b

18 files changed

+1117
-33
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@
2121

2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
24+
25+
# IntelliJ
26+
.idea/*
27+
28+
# Scripts
29+
initial/stateful-java-web-app/.scripts/*
30+
initial/stateful-java-web-app/*.sh
31+
complete/stateful-java-web-app/.scripts/*
32+
complete/stateful-java-web-app/*.sh

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "initial/stateful-java-web-app"]
2+
path = initial/stateful-java-web-app
3+
url = https://github.com/Microsoft/stateful-java-web-app.git
4+
[submodule "complete/stateful-java-web-app"]
5+
path = complete/stateful-java-web-app
6+
url = https://github.com/Microsoft/stateful-java-web-app.git
Binary file not shown.
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.microsoft.webapp.samples</groupId>
4+
<artifactId>Stateful-Tracker</artifactId>
5+
<version>1.0.0-SNAPSHOT</version>
6+
<packaging>war</packaging>
7+
8+
<properties>
9+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10+
</properties>
11+
12+
<dependencies>
13+
<dependency>
14+
<groupId>javax.servlet</groupId>
15+
<artifactId>javax.servlet-api</artifactId>
16+
<version>4.0.0</version>
17+
<scope>provided</scope>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.apache.logging.log4j</groupId>
21+
<artifactId>log4j-api</artifactId>
22+
<version>2.11.1</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.apache.logging.log4j</groupId>
26+
<artifactId>log4j-core</artifactId>
27+
<version>2.11.1</version>
28+
</dependency>
29+
</dependencies>
30+
31+
<build>
32+
<sourceDirectory>src</sourceDirectory>
33+
<plugins>
34+
<plugin>
35+
<artifactId>maven-compiler-plugin</artifactId>
36+
<version>3.8.0</version>
37+
<configuration>
38+
<source>1.8</source>
39+
<target>1.8</target>
40+
</configuration>
41+
</plugin>
42+
<plugin>
43+
<artifactId>maven-war-plugin</artifactId>
44+
<version>3.2.2</version>
45+
<configuration>
46+
<failOnMissingWebXml>false</failOnMissingWebXml>
47+
</configuration>
48+
</plugin>
49+
50+
51+
<!--*************************************************-->
52+
<!-- Deploy to Tomcat on localhost -->
53+
<!--*************************************************-->
54+
<!--<plugin>
55+
<groupId>org.codehaus.cargo</groupId>
56+
<artifactId>cargo-maven2-plugin</artifactId>
57+
<version>1.6.7</version>
58+
<configuration>
59+
<container>
60+
<containerId>tomcat8x</containerId>
61+
<type>installed</type>
62+
<home>${TOMCAT_HOME}</home>
63+
</container>
64+
<configuration>
65+
<type>existing</type>
66+
<home>${TOMCAT_HOME}</home>
67+
</configuration>
68+
69+
<deployables>
70+
<deployable>
71+
<groupId>${project.groupId}</groupId>
72+
<artifactId>${project.artifactId}</artifactId>
73+
<type>war</type>
74+
<properties>
75+
<context>/</context>
76+
</properties>
77+
</deployable>
78+
</deployables>
79+
</configuration>
80+
</plugin>-->
81+
82+
<!--*************************************************-->
83+
<!-- Deploy to Tomcat on remote machine or VM -->
84+
<!--*************************************************-->
85+
86+
<plugin>
87+
<groupId>org.codehaus.cargo</groupId>
88+
<artifactId>cargo-maven2-plugin</artifactId>
89+
<version>1.6.7</version>
90+
<configuration>
91+
<container>
92+
<containerId>tomcat8x</containerId>
93+
<type>remote</type>
94+
</container>
95+
96+
<configuration>
97+
<type>runtime</type>
98+
<properties>
99+
<cargo.hostname>${cargo.hostname}</cargo.hostname>
100+
<cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>
101+
<cargo.tomcat.manager.url>${cargo.tomcat.manager.url}</cargo.tomcat.manager.url>
102+
<cargo.remote.username>${cargo.remote.username}</cargo.remote.username>
103+
<cargo.remote.password>${cargo.remote.password}</cargo.remote.password>
104+
</properties>
105+
</configuration>
106+
107+
<deployer>
108+
<type>remote</type>
109+
</deployer>
110+
111+
<deployables>
112+
<deployable>
113+
<groupId>${project.groupId}</groupId>
114+
<artifactId>${project.artifactId}</artifactId>
115+
<type>${project.packaging}</type>
116+
</deployable>
117+
</deployables>
118+
119+
</configuration>
120+
</plugin>
121+
122+
<plugin>
123+
<groupId>com.microsoft.azure</groupId>
124+
<artifactId>azure-webapp-maven-plugin</artifactId>
125+
<version>1.5.3</version>
126+
<configuration>
127+
128+
<!-- Web App information -->
129+
<resourceGroup>${RESOURCEGROUP_NAME}</resourceGroup>
130+
<appServicePlanName>${WEBAPP_PLAN_NAME}-${REGION}</appServicePlanName>
131+
<appName>${WEBAPP_NAME}-${REGION}</appName>
132+
<region>${REGION}</region>
133+
<linuxRuntime>tomcat 9.0-jre8</linuxRuntime>
134+
135+
<appSettings>
136+
<property>
137+
<name>REDIS_CACHE_NAME</name>
138+
<value>${REDIS_CACHE_NAME}</value>
139+
</property>
140+
<property>
141+
<name>REDIS_PORT</name>
142+
<value>${REDIS_PORT}</value>
143+
</property>
144+
<property>
145+
<name>REDIS_PASSWORD</name>
146+
<value>${REDIS_PASSWORD}</value>
147+
</property>
148+
<property>
149+
<name>REDIS_SESSION_KEY_PREFIX</name>
150+
<value>${REDIS_SESSION_KEY_PREFIX}</value>
151+
</property>
152+
<property>
153+
<name>JAVA_OPTS</name>
154+
<value>-Xms2048m -Xmx2048m -DREDIS_CACHE_NAME=${REDIS_CACHE_NAME} -DREDIS_PORT=${REDIS_PORT} -DREDIS_PASSWORD=${REDIS_PASSWORD} -DREDIS_SESSION_KEY_PREFIX=${REDIS_SESSION_KEY_PREFIX}</value>
155+
</property>
156+
157+
</appSettings>
158+
159+
</configuration>
160+
</plugin>
161+
162+
</plugins>
163+
</build>
164+
165+
<profiles>
166+
<profile>
167+
<id>env-azure-1</id>
168+
<activation>
169+
<property>
170+
<name>env</name>
171+
<value>azure-1</value>
172+
</property>
173+
</activation>
174+
<properties>
175+
<deploy.env>azure-1</deploy.env>
176+
<cargo.hostname>${AZURE_VM_1_IP_ADDRESS}</cargo.hostname>
177+
<cargo.servlet.port>8080</cargo.servlet.port>
178+
<cargo.tomcat.manager.url>http://${AZURE_VM_1_IP_ADDRESS}:8080/manager</cargo.tomcat.manager.url>
179+
<cargo.remote.username>${AZURE_VM_1_TOMCAT_ADMIN_USERNAME}</cargo.remote.username>
180+
<cargo.remote.password>${AZURE_VM_1_TOMCAT_ADMIN_PASSWORD}</cargo.remote.password>
181+
</properties>
182+
</profile>
183+
<profile>
184+
<id>env-azure-2</id>
185+
<activation>
186+
<property>
187+
<name>env</name>
188+
<value>azure-2</value>
189+
</property>
190+
</activation>
191+
<properties>
192+
<deploy.env>azure</deploy.env>
193+
<cargo.hostname>${AZURE_VM_2_IP_ADDRESS}</cargo.hostname>
194+
<cargo.servlet.port>8080</cargo.servlet.port>
195+
<cargo.tomcat.manager.url>http://${AZURE_VM_1_IP_ADDRESS}:8080/manager</cargo.tomcat.manager.url>
196+
<cargo.remote.username>${AZURE_VM_2_TOMCAT_ADMIN_USERNAME}</cargo.remote.username>
197+
<cargo.remote.password>${AZURE_VM_2_TOMCAT_ADMIN_PASSWORD}</cargo.remote.password>
198+
</properties>
199+
</profile>
200+
201+
<profile>
202+
<id>env-local</id>
203+
<activation>
204+
<property>
205+
<name>env</name>
206+
<value>local</value>
207+
</property>
208+
</activation>
209+
<properties>
210+
<deploy.env>local</deploy.env>
211+
<cargo.hostname>localhost</cargo.hostname>
212+
<cargo.servlet.port>8080</cargo.servlet.port>
213+
<cargo.tomcat.manager.url>http://localhost:8080/manager</cargo.tomcat.manager.url>
214+
<cargo.remote.username>admin</cargo.remote.username>
215+
<cargo.remote.password>admin</cargo.remote.password>
216+
</properties>
217+
</profile>
218+
</profiles>
219+
220+
</project>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
export TOMCAT_HOME=<your-tomcat-directory>
4+
5+
# Supply - Azure Environment
6+
export SUBSCRIPTION_ID=<your-subscription-id>
7+
export RESOURCEGROUP_NAME=<your-resource-group-name>
8+
export REGION_1=westus
9+
export REGION_2=eastus
10+
11+
# Supply - App Service App Name
12+
export WEBAPP_NAME=<your-webapp-name>
13+
14+
# Composed from Supplied - App Service Plan Name
15+
export WEBAPP_PLAN_NAME=${WEBAPP_NAME}-appservice-plan
16+
17+
# Supply - Redis Info
18+
export REDIS_CACHE_NAME=<your-redis-cache-name>
19+
export REDIS_PASSWORD=<your-redis-cache-password>
20+
export REDIS_SESSION_KEY_PREFIX=tracker-sessions
21+
22+
# Composed from Supplied - Redis Address
23+
export REDIS_HOST=${REDIS_CACHE_NAME}.redis.cache.windows.net
24+
export REDIS_PORT=6379
25+
26+
# Supply - Traffic Manager Info
27+
export TRAFFIC_MANAGER_PROFILE_NAME=<your-traffic-manager-profile-name>
28+
export TRAFFIC_MANAGER_DNS_NAME=<your-traffic-manager-dns-name>
29+
30+
# Composed from Supplied - Traffic Manager Endpoints
31+
export TARGET_RESOURCE_ID_1="/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCEGROUP_NAME}/providers/Microsoft.Web/sites/${WEBAPP_NAME}-${REGION_1}"
32+
export TARGET_RESOURCE_ID_2="/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCEGROUP_NAME}/providers/Microsoft.Web/sites/${WEBAPP_NAME}-${REGION_2}"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Context path="">
3+
<!-- Specify Redis Store -->
4+
<Valve className="com.gopivotal.manager.SessionFlushValve" />
5+
<Manager className="org.apache.catalina.session.PersistentManager">
6+
<Store className="com.gopivotal.manager.redis.RedisStore"
7+
connectionPoolSize="20"
8+
host="${REDIS_CACHE_NAME}.redis.cache.windows.net"
9+
port="${REDIS_PORT}"
10+
password="${REDIS_PASSWORD}"
11+
sessionKeyPrefix="${REDIS_SESSION_KEY_PREFIX}"
12+
timeout="2000"
13+
/>
14+
</Manager>
15+
</Context>
Binary file not shown.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
export TOMCAT_HOME=<your-tomcat-directory>
4+
5+
# Supply - Azure Environment
6+
export SUBSCRIPTION_ID=<your-subscription-id>
7+
export RESOURCEGROUP_NAME=<your-resource-group-name>
8+
export REGION_1=westus
9+
export REGION_2=eastus
10+
11+
# Supply - App Service App Name
12+
export WEBAPP_NAME=<your-webapp-name>
13+
14+
# Composed from Supplied - App Service Plan Name
15+
export WEBAPP_PLAN_NAME=${WEBAPP_NAME}-appservice-plan
16+
17+
# Supply - Redis Info
18+
export REDIS_CACHE_NAME=<your-redis-cache-name>
19+
export REDIS_PASSWORD=<your-redis-cache-password>
20+
export REDIS_SESSION_KEY_PREFIX=tracker-sessions
21+
22+
# Composed from Supplied - Redis Address
23+
export REDIS_HOST=${REDIS_CACHE_NAME}.redis.cache.windows.net
24+
export REDIS_PORT=6379
25+
26+
# Supply - Traffic Manager Info
27+
export TRAFFIC_MANAGER_PROFILE_NAME=<your-traffic-manager-profile-name>
28+
export TRAFFIC_MANAGER_DNS_NAME=<your-traffic-manager-dns-name>
29+
30+
# Composed from Supplied - Traffic Manager Endpoints
31+
export TARGET_RESOURCE_ID_1="/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCEGROUP_NAME}/providers/Microsoft.Web/sites/${WEBAPP_NAME}-${REGION_1}"
32+
export TARGET_RESOURCE_ID_2="/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCEGROUP_NAME}/providers/Microsoft.Web/sites/${WEBAPP_NAME}-${REGION_2}"

0 commit comments

Comments
 (0)