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 1 commit
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: 0 additions & 100 deletions docker/tc-platform/README.md

This file was deleted.

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

This file was deleted.

73 changes: 73 additions & 0 deletions docker/tc-website/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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 tc-website:base base
docker build -t tc-website:build build
docker build -t tc-website:run run
docker build -t 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
```
mkdir -p $HOME/tc-platform
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please refactor this line mkdir -p $HOME/tc-platform to this:

TC_WEBSITE_HOME=/home/tc/tc-platform
mkdir -p $TC_WEBSITE_HOME

cd $HOME/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
git clone https://github.com/appirio-tech/temp-maven-repo
```

## Applying Patch
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • The Applying Patch section is specifically for reviewers of the challenge and should not be in the README.md.
  • The challenge explicitly requested for markdown formatted verification using screen shots instead you provided a PDF. PDF is a binary format and obviously doesn't play nice with git so please restore the former text in the Verification section below.

```
cd to tc-website
git apply <submission>/tc-website/tc-website.diff

cd to glue
git apply <submission>/glue/glue.diff

cd to temp-maven-repo
git apply <submission>/temp-maven-repo/temp-maven-repo.diff
```

## 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

TC_PLATFORM_SRC_ROOT contains not only tc-website. I think it's better use TC_PLATFORM_HOME

Copy link
Collaborator

Choose a reason for hiding this comment

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

For consistency, TC_WEBSITE_HOME is better since:

  • the external-artifacts, glue and shared repos use the tc-website-* prefix.
  • the Dockerfiles have been renamed to now use tc-website instead of tc-platform.

Besides, tc-platform is obscure since there is no Topcoder system that uses such a name ;-).
Many members know which systems direct-app and online-review refers to.

* 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`


## 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
see ```Verification.pdf```
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 deedee/tc:base

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,19 +11,15 @@ 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

@deedee,

I don't see a corresponding update in the list of files updated in the pull request for tc-website ?
Shouldn't jboss-web.xml be updated?

Thanks.

Copy link
Author

Choose a reason for hiding this comment

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

jboss-web.xml will be copied to jboss directory after deploying success. See last line of build.sh

So no need to change on tc-website

Copy link
Collaborator

@sah2ed sah2ed Apr 13, 2017

Choose a reason for hiding this comment

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

Oh, no wonder I didn't see it. The previous approach of overwriting the file before executing the build is better.
The ant build targets should be the last build-related command in the Dockerfile since it is also used to verify continuous deployment of the tc-website on CircleCI.

Copy link
Author

Choose a reason for hiding this comment

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

So you want to merge it to tc-website?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Overwriting it with /root/files/distui/jboss-web.xml like was done before is fine. No need to merge it with tc-website.

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

cp -f /root/files/distui/jboss-web.xml $JBOSS_HOME/server/all/deploy/distui.war/WEB-INF
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