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

tc-website Dockerfiles #13

Merged
merged 4 commits into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions docker/tc-platform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Topcoder Website Local Deployment Using Docker

## Build LDAP Image
Use an existing docker file on [GitHub](https://github.com/appirio-tech/tc-common-tutorials/tree/master/docker) (use commit hash cfc5b80ead7f83a7d592e406ef3bd160889683c1).
The README contains instructions on how to build the docker image.

The image is referenced in the provided docker-compose.yml file.

## Docker Images for tc-website
The following docker images are defined:
* base - located in base sub-directory, used as the base image for build and run images below.
* build - located in build sub-directory, used to create the jboss and tc website wars ready for deployment.
* run - located in run sub-directory used to run the jboss created by the build image to run the tc website.

You need to run the following commands to build these images first:
```
# Go to the directory extracting this submission

docker build -t tc-website:base base
docker build -t tc-website:build build
docker build -t tc-website:run run
```

## Prepare tc-website Codebase
Pull following repos into a directory (e.g. tc-platform):
- https://github.com/topcoder-platform/tc-website (with commit hash: f5e9ec2e9e7d99f012e308b530947ab034948ad6)
- https://github.com/topcoder-platform/tc-website-external-artifacts (with commit hash: 33100ff8b102ee8a386c4200d571b6c31c33fad1)
- https://github.com/topcoder-platform/tc-website-glue (with commit hash: 61849f3601a25efc40390a59eedd8d1dc92eb4ef)
- https://github.com/topcoder-platform/tc-website-shared (with commit hash: fbbc0e49893bf972e46d7c73192a5592e39dab3b)
- https://github.com/topcoder-platform/tc-website-static (with commit hash: fc26666a6ee3a323cdd8de9e849a2e576352a656)

## Checkout tc-website
```
mkdir -p /home/tc/tc-platform
cd /home/tc/tc-platform
git clone https://github.com/topcoder-platform/tc-website tc-website
git clone https://github.com/topcoder-platform/tc-website-external-artifacts external-artifacts
git clone https://github.com/topcoder-platform/tc-website-glue glue
git clone https://github.com/topcoder-platform/tc-website-shared shared
git clone https://github.com/topcoder-platform/tc-website-static static
```

## Deployment
Update the configuration values in env.sh file from the submission:
* TC_PLATFORM_SRC_ROOT - the root directory of the tc-platform codebase, point to the tc-platform directory above
* DEPLOYMENT_DIR - the directory to put the jboss and the created wars.

Run `source env.sh` to create the environment variables.

Then run `docker-compose up build-tc-website` to build the code and create jboss and tc-website wars.

Finally run `docker-compose up run-tc-website` to run the jboss created above and setup apache.

The console is like this: http://take.ms/wPZwi when it's ready to access the tc-website.

## Verification
Add the following entry to your hosts file:
`<docker-ip> local.tc.cloud.topcoder.com`

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.


### Authentication
1. Visit https://local.tc.cloud.topcoder.com/tc - accept the self-signed SSL certificate. See http://take.ms/r5A9U
2. Now visit https://local.tc.cloud.topcoder.com/tc?&module=Login - login with `heffan/password`. See http://take.ms/uxt4K
3. You will be redirected to an interstitial page then the main site (https://www.topcoder.com/my-dashboard/). See http://take.ms/O3AaE
4. Now visit https://local.tc.cloud.topcoder.com/tc?module=MyHome - to switch from the main site back to docker.

You can now try the following pages:
TC WAR:
* Open https://local.tc.cloud.topcoder.com/tc?module=MyHome, the page is like: http://take.ms/TYP9F
* Open https://local.tc.cloud.topcoder.com/tc?module=EditTheme, change to use old theme, the page is like: http://take.ms/efKBr
* Open https://local.tc.cloud.topcoder.com/tc?module=ActiveContests&pt=39 (code active contests), the page is like: http://take.ms/RxSWZ

Note that the links like https://local.tc.cloud.topcoder.com/challenges/design/active won't work.

Query WAR:
* Open https://local.tc.cloud.topcoder.com/query/query, the page is like: http://take.ms/UvcrU

Admin WAR:
* Open https://local.tc.cloud.topcoder.com/admin/, the page is like: http://take.ms/nygny
* Open https://local.tc.cloud.topcoder.com/admin/?module=TermsList, the page is like: http://take.ms/P061N

CORP WAR:
* Open https://local.tc.cloud.topcoder.com/corp/, the page is like: http://take.ms/d6tMF

Email WAR:
* Open https://local.tc.cloud.topcoder.com/email/, the page is like: http://take.ms/BNbd5

Reg WAR:
* Open https://local.tc.cloud.topcoder.com/reg/, the page is like: http://take.ms/jkbVm

EP WAR:
* Open https://local.tc.cloud.topcoder.com/ep, the page is like: http://take.ms/Nw1bV

Private Label WAR:
* Open https://local.tc.cloud.topcoder.com/pl/, the page is like: http://take.ms/x3pr5

Note that you may receive HTTPS certificate warnings, just ignore it and proceed.
And you can click around to try the other pages.
30 changes: 30 additions & 0 deletions docker/tc-platform/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM centos:6.8

# install tools
RUN yum install -y unzip wget dos2unix

WORKDIR /root

# install jdk7
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"
RUN rpm -ivh jdk-7u79-linux-x64.rpm

# install apache-ant
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
RUN unzip /root/apache-ant-1.7.1-bin.zip

RUN wget https://nchc.dl.sourceforge.net/project/ant-contrib/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.tar.gz
RUN tar xzf ant-contrib-1.0b2-bin.tar.gz
RUN cp ant-contrib/lib/ant-contrib.jar /root/apache-ant-1.7.1/lib/

# set env variables
ENV JAVA_HOME /usr/java/jdk1.7.0_79
ENV ANT_HOME /root/apache-ant-1.7.1
ENV PATH $JAVA_HOME/bin:$GRAILS_HOME/bin:$ANT_HOME/bin:$PATH

# remove useless files
RUN rm /root/jdk-7u79-linux-x64.rpm
RUN rm /root/apache-ant-1.7.1-bin.zip
RUN rm /root/ant-contrib-1.0b2-bin.tar.gz
RUN rm -rf /root/ant-contrib

20 changes: 20 additions & 0 deletions docker/tc-platform/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM tc-website:base

WORKDIR /root

# download jboss 4.0.4
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

# copy files
COPY files /root/files

# copy build script
COPY build.sh /root

# make it executable
RUN dos2unix /root/build.sh
RUN chmod +x /root/build.sh

ENV JBOSS_HOME /root/deployment/jboss-4.0.4.GA

ENTRYPOINT ["/root/build.sh"]
29 changes: 29 additions & 0 deletions docker/tc-platform/build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# remove old jboss
rm -rf /root/deployment/jboss-4.0.4.GA

# unzip a clean jboss
unzip /root/jboss-4.0.4.GA.zip -d /root/deployment

# init jboss
cp -f /root/files/jboss/jboss-service.xml $JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/META-INF
cp -f /root/files/jboss/web.xml $JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/conf

cp -f /root/files/tc_informix-ds.xml $JBOSS_HOME/server/all/deploy
cp -f /root/files/lib/ldap_sdk_interface.jar $JBOSS_HOME/server/all/lib
cp -f /root/files/TC.prod.ldap.keystore $JBOSS_HOME/bin
cp -f /root/files/resources/paymentRanges.xml $JBOSS_HOME/server/all/conf

# init code
cp -f /root/files/resources/ApplicationServer.properties /root/tc-platform/tc-website/resources
cp -f /root/files/resources/cache.properties /root/tc-platform/tc-website/resources
cp -f /root/files/resources/LDAP.properties /root/tc-platform/tc-website/resources
cp -f /root/files/distui/jboss-web.xml /root/tc-platform/tc-website/resources/distui
cp -f /root/files/build_distui.xml /root/tc-platform/tc-website
cp -f /root/files/build_tc.xml /root/tc-platform/tc-website

# deploy
cd /root/tc-platform/tc-website
ant -f build_tc.xml clean deploy
ant -f build_distui.xml clean deploy
Binary file added docker/tc-platform/build/files/TC.prod.ldap.keystore
Binary file not shown.
Loading