├── src
└── main
│ ├── java
│ └── .gitkeep
│ ├── resources
│ └── .gitkeep
│ └── webapp
│ └── index.html
├── .sti
└── scripts
│ ├── run.ignore
│ └── assemble.ignore
├── README.md
└── pom.xml
/src/main/java/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.sti/scripts/run.ignore:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | echo hello world
3 | exec /wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Getting Started with OpenShift Sample Application
2 | ====================
3 |
4 | This is a sample application for the book, Getting Started with OpenShift
5 |
--------------------------------------------------------------------------------
/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Welcome to OpenShift
7 |
8 |
9 | Hello, OpenShift builds.
10 |
11 |
12 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | SampleApp
6 | SampleApp
7 | war
8 | 1.0
9 | SampleApp
10 |
11 |
12 | UTF-8
13 | 1.7
14 | 1.7
15 |
16 |
17 |
18 |
19 | javax
20 | javaee-api
21 | 7.0
22 | provided
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | openshift
33 |
34 | SampleApp
35 |
36 |
37 | org.apache.maven.plugins
38 | maven-war-plugin
39 | 2.3
40 |
41 | false
42 | target
43 | ROOT
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/.sti/scripts/assemble.ignore:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # restore maven dependencies downloaded in a previous build,
4 | # so they do not have to be downloaded again.
5 | # /tmp/artifacts will only be present in the incremental build scenario
6 | # in which the target image name is an existing docker image which contains
7 | # dependencies from a prior build execution.
8 | function restore_saved_artifacts() {
9 | if [ -f /tmp/artifacts/maven.tar.gz ]; then
10 | pushd / &> /dev/null
11 | echo -n "Restoring saved artifacts from prior build..."
12 | tar zxf /tmp/artifacts/maven.tar.gz
13 | echo "...done"
14 | popd &> /dev/null
15 | fi
16 | }
17 |
18 | # Source code provided to STI will be bind-mounted at /tmp/src
19 | # and then copied into /opt/wildfly/source for building.
20 | local_source_dir=/opt/wildfly/source
21 | mkdir -p $local_source_dir
22 |
23 | # Resulting WAR files will be deployed to /wildfly/standalone/deployments
24 | deploy_dir=/wildfly/standalone/deployments
25 | mkdir -p $deploy_dir
26 |
27 | # Copy the source from the bind mount in preparation for compilation
28 | cp -ad /tmp/src/* $local_source_dir
29 |
30 | # If a pom.xml is present, this is a normal build scenario
31 | # so run maven.
32 | if [ -f "$local_source_dir/pom.xml" ]; then
33 | # restore any maven dependencies which will be present if this is an
34 | # incremental build
35 | restore_saved_artifacts
36 |
37 | pushd $local_source_dir &> /dev/null
38 | JAVA_HOME=/etc/alternatives/java_sdk_1.7.0
39 | mvn clean package -Popenshift -DskipTests
40 | err=$?
41 | if [ $err -ne 0 ]; then
42 | echo "Aborting due to error code $err from mvn package"
43 | exit $err
44 | fi
45 |
46 | echo "Copying built war files into $deploy_dir for later deployment..."
47 | if [ -d $local_source_dir/target ]; then
48 | cp $local_source_dir/target/*.war $deploy_dir >& /dev/null
49 | fi
50 | if [ -d $local_source_dir/deployments ]; then
51 | cp $local_source_dir/deployments/*.war $deploy_dir >& /dev/null
52 | fi
53 |
54 | if [ -d $local_source_dir/cfg ]; then
55 | echo "Copying config files from project..."
56 | cp cfg/* /wildfly/standalone/configuration
57 | fi
58 |
59 | if [ -d $local_source_dir/modules ]; then
60 | echo "Copying modules from project..."
61 | mkdir /wildfly/provided_modules
62 | cp -r modules/* /wildfly/provided_modules
63 | fi
64 |
65 | echo "...done"
66 |
67 | popd &> /dev/null
68 | else
69 | echo "Copying binaries in source directory into $deploy_dir for later deployment..."
70 | if [ -d $local_source_dir/target ]; then
71 | cp $local_source_dir/target/*.war $deploy_dir >& /dev/null
72 | fi
73 | if [ -d $local_source_dir/deployments ]; then
74 | cp $local_source_dir/deployments/*.war $deploy_dir >& /dev/null
75 | fi
76 | if [ -d $local_source_dir/cfg ]; then
77 | echo "Copying config files from project..."
78 | cp cfg/* /wildfly/standalone/configuration
79 | fi
80 |
81 | if [ -d $local_source_dir/modules ]; then
82 | echo "Copying modules from project..."
83 | mkdir /wildfly/provided_modules
84 | cp -r modules/* /wildfly/provided_modules
85 | fi
86 | echo "...done"
87 | fi
88 |
--------------------------------------------------------------------------------