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

Rename tc-platform to tc-website and move httpd into its own image. #14

Merged
merged 4 commits into from
Apr 17, 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
43 changes: 0 additions & 43 deletions docker/tc-platform/docker-compose.yml

This file was deleted.

3 changes: 0 additions & 3 deletions docker/tc-platform/env.sh

This file was deleted.

79 changes: 43 additions & 36 deletions docker/tc-platform/README.md → docker/tc-website/README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,68 @@
# 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.
* 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 extracting this submission
# Go to the directory *docker/tc-website* extracting this submission

docker build -t tc-website:base base
docker build -t tc-website:build build
docker build -t tc-website:run run
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)
- 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 (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
## Checkout tc-website and all other repo
```
mkdir -p /home/tc/tc-platform
cd /home/tc/tc-platform
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 static
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_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.
* 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 run-tc-website` to run the jboss created above and setup apache.
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.

The console is like this: http://take.ms/wPZwi when it's ready to access the tc-website.
Any push action will trigger circleci build process.

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

Expand All @@ -67,34 +74,34 @@ Where `<docker-ip>` is the ip address of your docker box. It should be set to `1
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:
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.
Note that the links like https://local.tc.cloud.topcoder.com/challenges/design/active won't work.

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

Admin WAR:
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:
CORP WAR:
* Open https://local.tc.cloud.topcoder.com/corp/, the page is like: http://take.ms/d6tMF

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

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

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

Private Label WAR:
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.
Note that you may receive HTTPS certificate warnings, just ignore it and proceed.
And you can click around to try the other pages.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM centos:6.8

# install tools
RUN yum install -y unzip wget dos2unix
RUN yum update -y && yum install -y unzip wget dos2unix

WORKDIR /root

Expand All @@ -22,9 +22,10 @@ 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

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tc-website:base
FROM appiriodevops/tc-website:base
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I've corrected the name of the base docker image.


WORKDIR /root

Expand All @@ -17,4 +17,16 @@ RUN chmod +x /root/build.sh

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

ENTRYPOINT ["/root/build.sh"]
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"]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

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

Expand All @@ -11,17 +11,12 @@ cp -f /root/files/jboss/jboss-service.xml $JBOSS_HOME/server/all/deploy/jbossweb
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ FORUMS_SERVER_NAME=forums.dev.topcoder.com
HOST_URL=localhost:1099
FORUMS_HOST_URL=63.118.154.182:1099
CONTEST_HOST_URL=63.118.154.180:10099
BASE_DIR=/root/tc-platform/tc-website
BASE_DIR=/export/home/web/web/
XSL_CACHING=false
SECURITY_PROVIDER_URL=localhost:1099
TCS_APP_SERVER_URL=localhost:1299
SESSION_ID_LENGTH=0
FILE_CONVERSION_PROVIDER_URL=172.16.210.53:1099
WEB_SERVER_ID=1
JMS_HOST_URL=jnp://localhost:1699
DISTRIBUTED_UI_SERVER_NAME = local.tc.cloud.topcoder.com
DISTRIBUTED_UI_SERVER_NAME = local.tc.cloud.topcoder.com:8080
OR_WEBSERVICES_SERVER_NAME = 63.118.154.186:8080
WIKI_SERVER_NAME = local.tc.cloud.topcoder.com/wiki
USER_SERVICES_HOST_URL=jnp://localhost:1099
Expand Down
Loading