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

Merge svn2git changes back into master. #18

Merged
merged 10 commits into from
May 27, 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
107 changes: 107 additions & 0 deletions docker/tc-website/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Topcoder Website Local Deployment Using Docker

## Docker Images for tc-website
The following docker images are defined:
* base - located in base sub-directory, used as the base image forall 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.
* httpd - located in httpd sub-directory used to create and run apache httpd server

You need to run the following commands to build these images first:
```
# Go to the directory *docker/tc-website* extracting this submission

docker build -t appiriodevops/tc-website:base base
docker build -t appiriodevops/tc-website:build build
docker build -t appiriodevops/tc-website:run run
docker build -t appiriodevops/tc-website:httpd httpd
```

## 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 branch: svn2git)
- https://github.com/topcoder-platform/tc-website-external-artifacts (with commit hash: 33100ff8b102ee8a386c4200d571b6c31c33fad1 branch: svn2git)
- https://github.com/topcoder-platform/tc-website-glue (with commit hash: 61849f3601a25efc40390a59eedd8d1dc92eb4ef branch: svn2git)
- https://github.com/topcoder-platform/tc-website-shared (with commit hash: fbbc0e49893bf972e46d7c73192a5592e39dab3b branch: svn2git)
- https://github.com/topcoder-platform/tc-website-static (with commit hash: fc26666a6ee3a323cdd8de9e849a2e576352a656)
- https://github.com/appirio-tech/temp-maven-repo (with commit hash:
ae8fe01f5b2f1aec9baa52dcff6d7bf02c5d93bf)

## Checkout tc-website and all other repo
```
TC_WEBSITE_HOME=/home/tc/tc-platform
mkdir -p $TC_WEBSITE_HOME
cd $TC_WEBSITE_HOME
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
git clone https://github.com/appirio-tech/temp-maven-repo
```

## Deployment
Update the configuration values in env.sh file from the submission:
* TC_WEBSITE_HOME - the root directory of the tc-website codebase and all its required repos, point to the $TC_WEBSITE_HOME directory above
* JBOSS_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 -d tc-httpd` to run the all required services. To view jboss log run
`docker-compose logs -f run-tc-website`

> NOTE: docker-compose will create custom network with ip network is configurable on *networks* section on ```docker-compose.yml``` file
> If you change this (subnet or gateway), make sure host ```env.topcoder.com``` on service ```run-tc-website``` point to ip address of gateway

## Setup circleci
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.

Any push action will trigger circleci build process.

## 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.
31 changes: 31 additions & 0 deletions docker/tc-website/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM centos:6.8

# install tools
RUN yum update -y && 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

RUN chmod 701 /root

# 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
32 changes: 32 additions & 0 deletions docker/tc-website/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM appiriodevops/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

RUN mkdir -p /export/home/web
RUN ln -s /root/tc-platform/tc-website /export/home/web/web

RUN mkdir -p /home/tc
RUN ln -s /root/deployment/jboss-4.0.4.GA /home/tc/jboss-4.0.4.GA
RUN ln -s /root/tc-platform/tc-website /home/tc/web

RUN mkdir -p /mnt/apache
RUN ln -s /root/tc-platform/tc-website-static /mnt/apache/tcdocs

ENV SHARED_DIR /root/tc-platform/shared

ENTRYPOINT ["/root/build.sh"]
24 changes: 24 additions & 0 deletions docker/tc-website/build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e
# 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/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/distui/jboss-web.xml /root/tc-platform/tc-website/resources/distui

# 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-website/build/files/TC.prod.ldap.keystore
Binary file not shown.
Loading