Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 0f8c6b5

Browse files
standloveskyhit
standlove
authored andcommitted
tc-platform docker submission (#11)
1 parent c93d068 commit 0f8c6b5

26 files changed

+6574
-0
lines changed

docker/tc-platform/README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
## Build LDAP Image
2+
Use an existing docker file on [GitHub](https://github.com/appirio-tech/tc-common-tutorials/tree/master/docker) (use commit hash cfc5b80ead7f83a7d592e406ef3bd160889683c1).
3+
The README contains instructions on how to build the docker image.
4+
5+
The image is referenced in the provided docker-compose.yml file.
6+
7+
## Docker Images for tc-website
8+
The following docker images are defined:
9+
* base - located in base sub-directory, used as the base image for build and run images below.
10+
* build - located in build sub-directory, used to create the jboss and tc website wars ready for deployment.
11+
* run - located in run sub-directory used to run the jboss created by the build image to run the tc website.
12+
13+
You need to run the following commands to build these images first:
14+
```
15+
# Go to the directory extracting this submission
16+
17+
docker build -t tc-website:base base
18+
docker build -t tc-website:build build
19+
docker build -t tc-website:run run
20+
```
21+
22+
## Prepare tc-website Codebase
23+
Pull following repos into a directory (e.g. tc-platform):
24+
https://github.com/topcoder-platform/tc-website (with commit hash: f5e9ec2e9e7d99f012e308b530947ab034948ad6)
25+
https://github.com/topcoder-platform/tc-website-external-artifacts (with commit hash: 33100ff8b102ee8a386c4200d571b6c31c33fad1)
26+
https://github.com/topcoder-platform/tc-website-glue (with commit hash: 61849f3601a25efc40390a59eedd8d1dc92eb4ef)
27+
https://github.com/topcoder-platform/tc-website-shared (with commit hash: fbbc0e49893bf972e46d7c73192a5592e39dab3b)
28+
https://github.com/topcoder-platform/tc-website-static (with commit hash: fc26666a6ee3a323cdd8de9e849a2e576352a656)
29+
30+
Then rename the folders in tc-platform as below:
31+
tc-platform
32+
- tc-website - corresponding to tc-website repo (no renaming needed)
33+
- external-artifacts - corresponding to tc-website-external-artifacts repo
34+
- glue - corresponding to tc-website-glue repo
35+
- shared - corresponding to tc-website-shared repo
36+
- static - corresponding to tc-website-static repo
37+
38+
## Deployment
39+
Update the configuration values in env.sh file from the submission:
40+
* TC_PLATFORM_SRC_ROOT - the root directory of the tc-platform codebase, point to the tc-platform directory above
41+
* DEPLOYMENT_DIR - the directory to put the jboss and the created wars.
42+
43+
Run `source env.sh` to create the environment variables.
44+
45+
Then run `docker-compose up build-tc-website` to build the code and create jboss and tc-website wars.
46+
Finally run `docker-compose up run-tc-website` to run the jboss created above and setup apache.
47+
48+
The console is like this: http://take.ms/wPZwi when it's ready to access the tc-website.
49+
50+
## Verification
51+
Add the following entries to your hosts file:
52+
docker-ip local.tc.cloud.topcoder.com
53+
54+
Where docker-ip is the ip address of your docker box. It should be 127.0.0.1 on Linux.
55+
56+
Open: https://local.tc.cloud.topcoder.com/tc, the page is like: http://take.ms/r5A9U
57+
Open: https://local.tc.cloud.topcoder.com/tc?module=Login, the page is like http://take.ms/uxt4K
58+
59+
Login with: heffan/password, and after logged-in successfully, it will redirect user to page like: http://take.ms/O3AaE
60+
and finally to the official topcoder.com page.
61+
62+
You can now try the following pages:
63+
TC WAR:
64+
* Open https://local.tc.cloud.topcoder.com/tc?module=MyHome, the page is like: http://take.ms/TYP9F
65+
* Open https://local.tc.cloud.topcoder.com/tc?module=EditTheme, change to use old theme, the page is like: http://take.ms/efKBr
66+
* Open https://local.tc.cloud.topcoder.com/tc?module=ActiveContests&pt=39 (code active contests), the page is like: http://take.ms/RxSWZ
67+
68+
Note that the links like https://local.tc.cloud.topcoder.com/challenges/design/active won't work.
69+
70+
Query WAR:
71+
* Open https://local.tc.cloud.topcoder.com/query/query, the page is like: http://take.ms/UvcrU
72+
73+
Admin WAR:
74+
* Open https://local.tc.cloud.topcoder.com/admin/, the page is like: http://take.ms/nygny
75+
* Open https://local.tc.cloud.topcoder.com/admin/?module=TermsList, the page is like: http://take.ms/P061N
76+
77+
CORP WAR:
78+
* Open https://local.tc.cloud.topcoder.com/corp/, the page is like: http://take.ms/d6tMF
79+
80+
Email WAR:
81+
* Open https://local.tc.cloud.topcoder.com/email/, the page is like: http://take.ms/BNbd5
82+
83+
Reg WAR:
84+
* Open https://local.tc.cloud.topcoder.com/reg/, the page is like: http://take.ms/jkbVm
85+
86+
EP WAR:
87+
* Open https://local.tc.cloud.topcoder.com/ep, the page is like: http://take.ms/Nw1bV
88+
89+
Private Label WAR:
90+
* Open https://local.tc.cloud.topcoder.com/pl/, the page is like: http://take.ms/x3pr5
91+
92+
Note that you may receive HTTPS certificate warnings, just ignore it and proceed.
93+
And you can click around to try the other pages.

docker/tc-platform/base/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM centos:6.8
2+
3+
# install tools
4+
RUN yum install -y unzip wget dos2unix
5+
6+
WORKDIR /root
7+
8+
# install jdk7
9+
RUN wget -O /root/jdk-7u79-linux-x64.rpm --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm"
10+
RUN rpm -ivh jdk-7u79-linux-x64.rpm
11+
12+
# install apache-ant
13+
RUN wget -O /root/apache-ant-1.7.1-bin.zip http://archive.apache.org/dist/ant/binaries/apache-ant-1.7.1-bin.zip
14+
RUN unzip /root/apache-ant-1.7.1-bin.zip
15+
16+
RUN wget https://nchc.dl.sourceforge.net/project/ant-contrib/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.tar.gz
17+
RUN tar xzf ant-contrib-1.0b2-bin.tar.gz
18+
RUN cp ant-contrib/lib/ant-contrib.jar /root/apache-ant-1.7.1/lib/
19+
20+
# set env variables
21+
ENV JAVA_HOME /usr/java/jdk1.7.0_79
22+
ENV ANT_HOME /root/apache-ant-1.7.1
23+
ENV PATH $JAVA_HOME/bin:$GRAILS_HOME/bin:$ANT_HOME/bin:$PATH
24+
25+
# remove useless files
26+
RUN rm /root/jdk-7u79-linux-x64.rpm
27+
RUN rm /root/apache-ant-1.7.1-bin.zip
28+
RUN rm /root/ant-contrib-1.0b2-bin.tar.gz
29+
RUN rm -rf /root/ant-contrib
30+

docker/tc-platform/build/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM tc-website:base
2+
3+
WORKDIR /root
4+
5+
# download jboss 4.0.4
6+
RUN wget -O /root/jboss-4.0.4.GA.zip https://downloads.sourceforge.net/project/jboss/JBoss/JBoss-4.0.4.GA/jboss-4.0.4.GA.zip?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fjboss%2Ffiles%2FJBoss%2FJBoss-4.0.4.GA
7+
8+
# copy files
9+
COPY files /root/files
10+
11+
# copy build script
12+
COPY build.sh /root
13+
14+
# make it executable
15+
RUN dos2unix /root/build.sh
16+
RUN chmod +x /root/build.sh
17+
18+
ENV JBOSS_HOME /root/deployment/jboss-4.0.4.GA
19+
20+
ENTRYPOINT ["/root/build.sh"]

docker/tc-platform/build/build.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# remove old jboss
4+
rm -rf /root/deployment/jboss-4.0.4.GA
5+
6+
# unzip a clean jboss
7+
unzip /root/jboss-4.0.4.GA.zip -d /root/deployment
8+
9+
# init jboss
10+
cp -f /root/files/jboss/jboss-service.xml $JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/META-INF
11+
cp -f /root/files/jboss/web.xml $JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/conf
12+
13+
cp -f /root/files/tc_informix-ds.xml $JBOSS_HOME/server/all/deploy
14+
cp -f /root/files/lib/ldap_sdk_interface.jar $JBOSS_HOME/server/all/lib
15+
cp -f /root/files/TC.prod.ldap.keystore $JBOSS_HOME/bin
16+
cp -f /root/files/resources/paymentRanges.xml $JBOSS_HOME/server/all/conf
17+
18+
# init code
19+
cp -f /root/files/resources/ApplicationServer.properties /root/tc-platform/tc-website/resources
20+
cp -f /root/files/resources/cache.properties /root/tc-platform/tc-website/resources
21+
cp -f /root/files/resources/LDAP.properties /root/tc-platform/tc-website/resources
22+
cp -f /root/files/distui/jboss-web.xml /root/tc-platform/tc-website/resources/distui
23+
cp -f /root/files/build_distui.xml /root/tc-platform/tc-website
24+
cp -f /root/files/build_tc.xml /root/tc-platform/tc-website
25+
26+
# deploy
27+
cd /root/tc-platform/tc-website
28+
ant -f build_tc.xml clean deploy
29+
ant -f build_distui.xml clean deploy
Binary file not shown.

0 commit comments

Comments
 (0)