|
| 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. |
0 commit comments