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

Commit cc7f86e

Browse files
sah2edskyhit
authored andcommitted
Merge svn2git changes back into master. (#18)
* tc-platform docker submission (#11) * Fixed formatting and typos. * renaming tc-platform to tc-website and moving httpd to separate container * Use the correct public docker namespace and tag. * Update readme etc * update docker-compose.yml
1 parent 36b7e5f commit cc7f86e

33 files changed

+9090
-0
lines changed

docker/tc-website/README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Topcoder Website Local Deployment Using Docker
2+
3+
## Docker Images for tc-website
4+
The following docker images are defined:
5+
* base - located in base sub-directory, used as the base image forall images below.
6+
* build - located in build sub-directory, used to create the jboss and tc website wars ready for deployment.
7+
* run - located in run sub-directory used to run the jboss created by the build image to run the tc website.
8+
* httpd - located in httpd sub-directory used to create and run apache httpd server
9+
10+
You need to run the following commands to build these images first:
11+
```
12+
# Go to the directory *docker/tc-website* extracting this submission
13+
14+
docker build -t appiriodevops/tc-website:base base
15+
docker build -t appiriodevops/tc-website:build build
16+
docker build -t appiriodevops/tc-website:run run
17+
docker build -t appiriodevops/tc-website:httpd httpd
18+
```
19+
20+
## Prepare tc-website Codebase
21+
Pull following repos into a directory (e.g. tc-platform):
22+
- https://github.com/topcoder-platform/tc-website (with commit hash: f5e9ec2e9e7d99f012e308b530947ab034948ad6 branch: svn2git)
23+
- https://github.com/topcoder-platform/tc-website-external-artifacts (with commit hash: 33100ff8b102ee8a386c4200d571b6c31c33fad1 branch: svn2git)
24+
- https://github.com/topcoder-platform/tc-website-glue (with commit hash: 61849f3601a25efc40390a59eedd8d1dc92eb4ef branch: svn2git)
25+
- https://github.com/topcoder-platform/tc-website-shared (with commit hash: fbbc0e49893bf972e46d7c73192a5592e39dab3b branch: svn2git)
26+
- https://github.com/topcoder-platform/tc-website-static (with commit hash: fc26666a6ee3a323cdd8de9e849a2e576352a656)
27+
- https://github.com/appirio-tech/temp-maven-repo (with commit hash:
28+
ae8fe01f5b2f1aec9baa52dcff6d7bf02c5d93bf)
29+
30+
## Checkout tc-website and all other repo
31+
```
32+
TC_WEBSITE_HOME=/home/tc/tc-platform
33+
mkdir -p $TC_WEBSITE_HOME
34+
cd $TC_WEBSITE_HOME
35+
git clone https://github.com/topcoder-platform/tc-website tc-website
36+
git clone https://github.com/topcoder-platform/tc-website-external-artifacts external-artifacts
37+
git clone https://github.com/topcoder-platform/tc-website-glue glue
38+
git clone https://github.com/topcoder-platform/tc-website-shared shared
39+
git clone https://github.com/topcoder-platform/tc-website-static
40+
git clone https://github.com/appirio-tech/temp-maven-repo
41+
```
42+
43+
## Deployment
44+
Update the configuration values in env.sh file from the submission:
45+
* TC_WEBSITE_HOME - the root directory of the tc-website codebase and all its required repos, point to the $TC_WEBSITE_HOME directory above
46+
* JBOSS_DEPLOYMENT_DIR - the directory to put the jboss and the created wars.
47+
48+
Run `source env.sh` to create the environment variables.
49+
50+
Then run `docker-compose up build-tc-website` to build the code and create jboss and tc-website wars.
51+
52+
Finally run `docker-compose up -d tc-httpd` to run the all required services. To view jboss log run
53+
`docker-compose logs -f run-tc-website`
54+
55+
> NOTE: docker-compose will create custom network with ip network is configurable on *networks* section on ```docker-compose.yml``` file
56+
> If you change this (subnet or gateway), make sure host ```env.topcoder.com``` on service ```run-tc-website``` point to ip address of gateway
57+
58+
## Setup circleci
59+
Grant circleci access to repo tc-website. If there are any specific configuration related to circleci put it under ```.deploy/circleci```. All files under that directory will be copied to tc-website root before testinf being executed.
60+
61+
Any push action will trigger circleci build process.
62+
63+
## Verification
64+
Add the following entry to your hosts file:
65+
`<docker-ip> local.tc.cloud.topcoder.com`
66+
67+
Where `<docker-ip>` is the ip address of your docker box. It should be set to `127.0.0.1` on Linux or `192.168.99.100` on Windows/macOS if you are using Docker Toolbox.
68+
69+
70+
### Authentication
71+
1. Visit https://local.tc.cloud.topcoder.com/tc - accept the self-signed SSL certificate. See http://take.ms/r5A9U
72+
2. Now visit https://local.tc.cloud.topcoder.com/tc?&module=Login - login with `heffan/password`. See http://take.ms/uxt4K
73+
3. You will be redirected to an interstitial page then the main site (https://www.topcoder.com/my-dashboard/). See http://take.ms/O3AaE
74+
4. Now visit https://local.tc.cloud.topcoder.com/tc?module=MyHome - to switch from the main site back to docker.
75+
76+
You can now try the following pages:
77+
TC WAR:
78+
* Open https://local.tc.cloud.topcoder.com/tc?module=MyHome, the page is like: http://take.ms/TYP9F
79+
* Open https://local.tc.cloud.topcoder.com/tc?module=EditTheme, change to use old theme, the page is like: http://take.ms/efKBr
80+
* Open https://local.tc.cloud.topcoder.com/tc?module=ActiveContests&pt=39 (code active contests), the page is like: http://take.ms/RxSWZ
81+
82+
Note that the links like https://local.tc.cloud.topcoder.com/challenges/design/active won't work.
83+
84+
Query WAR:
85+
* Open https://local.tc.cloud.topcoder.com/query/query, the page is like: http://take.ms/UvcrU
86+
87+
Admin WAR:
88+
* Open https://local.tc.cloud.topcoder.com/admin/, the page is like: http://take.ms/nygny
89+
* Open https://local.tc.cloud.topcoder.com/admin/?module=TermsList, the page is like: http://take.ms/P061N
90+
91+
CORP WAR:
92+
* Open https://local.tc.cloud.topcoder.com/corp/, the page is like: http://take.ms/d6tMF
93+
94+
Email WAR:
95+
* Open https://local.tc.cloud.topcoder.com/email/, the page is like: http://take.ms/BNbd5
96+
97+
Reg WAR:
98+
* Open https://local.tc.cloud.topcoder.com/reg/, the page is like: http://take.ms/jkbVm
99+
100+
EP WAR:
101+
* Open https://local.tc.cloud.topcoder.com/ep, the page is like: http://take.ms/Nw1bV
102+
103+
Private Label WAR:
104+
* Open https://local.tc.cloud.topcoder.com/pl/, the page is like: http://take.ms/x3pr5
105+
106+
Note that you may receive HTTPS certificate warnings, just ignore it and proceed.
107+
And you can click around to try the other pages.

docker/tc-website/base/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM centos:6.8
2+
3+
# install tools
4+
RUN yum update -y && 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+
RUN chmod 701 /root
26+
27+
# remove useless files
28+
RUN rm /root/jdk-7u79-linux-x64.rpm
29+
RUN rm /root/apache-ant-1.7.1-bin.zip
30+
RUN rm /root/ant-contrib-1.0b2-bin.tar.gz
31+
RUN rm -rf /root/ant-contrib

docker/tc-website/build/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM appiriodevops/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+
RUN mkdir -p /export/home/web
21+
RUN ln -s /root/tc-platform/tc-website /export/home/web/web
22+
23+
RUN mkdir -p /home/tc
24+
RUN ln -s /root/deployment/jboss-4.0.4.GA /home/tc/jboss-4.0.4.GA
25+
RUN ln -s /root/tc-platform/tc-website /home/tc/web
26+
27+
RUN mkdir -p /mnt/apache
28+
RUN ln -s /root/tc-platform/tc-website-static /mnt/apache/tcdocs
29+
30+
ENV SHARED_DIR /root/tc-platform/shared
31+
32+
ENTRYPOINT ["/root/build.sh"]

docker/tc-website/build/build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -e
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/TC.prod.ldap.keystore $JBOSS_HOME/bin
15+
cp -f /root/files/resources/paymentRanges.xml $JBOSS_HOME/server/all/conf
16+
17+
# init code
18+
cp -f /root/files/resources/ApplicationServer.properties /root/tc-platform/tc-website/resources
19+
cp -f /root/files/distui/jboss-web.xml /root/tc-platform/tc-website/resources/distui
20+
21+
# deploy
22+
cd /root/tc-platform/tc-website
23+
ant -f build_tc.xml clean deploy
24+
ant -f build_distui.xml clean deploy
835 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)