|
| 1 | +# Topcoder Website Local Deployment Using Docker |
| 2 | + |
| 3 | +## Build LDAP Image |
| 4 | +Use an existing docker file on [GitHub](https://github.com/appirio-tech/tc-common-tutorials/tree/master/docker) (use commit hash cfc5b80ead7f83a7d592e406ef3bd160889683c1). |
| 5 | +The README contains instructions on how to build the docker image. |
| 6 | + |
| 7 | +The image is referenced in the provided docker-compose.yml file. |
| 8 | + |
| 9 | +## Docker Images for tc-website |
| 10 | +The following docker images are defined: |
| 11 | +* base - located in base sub-directory, used as the base image for build and run images below. |
| 12 | +* build - located in build sub-directory, used to create the jboss and tc website wars ready for deployment. |
| 13 | +* run - located in run sub-directory used to run the jboss created by the build image to run the tc website. |
| 14 | + |
| 15 | +You need to run the following commands to build these images first: |
| 16 | +``` |
| 17 | +# Go to the directory extracting this submission |
| 18 | +
|
| 19 | +docker build -t tc-website:base base |
| 20 | +docker build -t tc-website:build build |
| 21 | +docker build -t tc-website:run run |
| 22 | +``` |
| 23 | + |
| 24 | +## Prepare tc-website Codebase |
| 25 | +Pull following repos into a directory (e.g. tc-platform): |
| 26 | +- https://github.com/topcoder-platform/tc-website (with commit hash: f5e9ec2e9e7d99f012e308b530947ab034948ad6) |
| 27 | +- https://github.com/topcoder-platform/tc-website-external-artifacts (with commit hash: 33100ff8b102ee8a386c4200d571b6c31c33fad1) |
| 28 | +- https://github.com/topcoder-platform/tc-website-glue (with commit hash: 61849f3601a25efc40390a59eedd8d1dc92eb4ef) |
| 29 | +- https://github.com/topcoder-platform/tc-website-shared (with commit hash: fbbc0e49893bf972e46d7c73192a5592e39dab3b) |
| 30 | +- https://github.com/topcoder-platform/tc-website-static (with commit hash: fc26666a6ee3a323cdd8de9e849a2e576352a656) |
| 31 | + |
| 32 | +## Checkout tc-website |
| 33 | +``` |
| 34 | +mkdir -p /home/tc/tc-platform |
| 35 | +cd /home/tc/tc-platform |
| 36 | +git clone https://github.com/topcoder-platform/tc-website tc-website |
| 37 | +git clone https://github.com/topcoder-platform/tc-website-external-artifacts external-artifacts |
| 38 | +git clone https://github.com/topcoder-platform/tc-website-glue glue |
| 39 | +git clone https://github.com/topcoder-platform/tc-website-shared shared |
| 40 | +git clone https://github.com/topcoder-platform/tc-website-static static |
| 41 | +``` |
| 42 | + |
| 43 | +## Deployment |
| 44 | +Update the configuration values in env.sh file from the submission: |
| 45 | +* TC_PLATFORM_SRC_ROOT - the root directory of the tc-platform codebase, point to the tc-platform directory above |
| 46 | +* 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 run-tc-website` to run the jboss created above and setup apache. |
| 53 | + |
| 54 | +The console is like this: http://take.ms/wPZwi when it's ready to access the tc-website. |
| 55 | + |
| 56 | +## Verification |
| 57 | +Add the following entry to your hosts file: |
| 58 | +`<docker-ip> local.tc.cloud.topcoder.com` |
| 59 | + |
| 60 | +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. |
| 61 | + |
| 62 | + |
| 63 | +### Authentication |
| 64 | +1. Visit https://local.tc.cloud.topcoder.com/tc - accept the self-signed SSL certificate. See http://take.ms/r5A9U |
| 65 | +2. Now visit https://local.tc.cloud.topcoder.com/tc?&module=Login - login with `heffan/password`. See http://take.ms/uxt4K |
| 66 | +3. You will be redirected to an interstitial page then the main site (https://www.topcoder.com/my-dashboard/). See http://take.ms/O3AaE |
| 67 | +4. Now visit https://local.tc.cloud.topcoder.com/tc?module=MyHome - to switch from the main site back to docker. |
| 68 | + |
| 69 | +You can now try the following pages: |
| 70 | +TC WAR: |
| 71 | +* Open https://local.tc.cloud.topcoder.com/tc?module=MyHome, the page is like: http://take.ms/TYP9F |
| 72 | +* Open https://local.tc.cloud.topcoder.com/tc?module=EditTheme, change to use old theme, the page is like: http://take.ms/efKBr |
| 73 | +* Open https://local.tc.cloud.topcoder.com/tc?module=ActiveContests&pt=39 (code active contests), the page is like: http://take.ms/RxSWZ |
| 74 | + |
| 75 | +Note that the links like https://local.tc.cloud.topcoder.com/challenges/design/active won't work. |
| 76 | + |
| 77 | +Query WAR: |
| 78 | +* Open https://local.tc.cloud.topcoder.com/query/query, the page is like: http://take.ms/UvcrU |
| 79 | + |
| 80 | +Admin WAR: |
| 81 | +* Open https://local.tc.cloud.topcoder.com/admin/, the page is like: http://take.ms/nygny |
| 82 | +* Open https://local.tc.cloud.topcoder.com/admin/?module=TermsList, the page is like: http://take.ms/P061N |
| 83 | + |
| 84 | +CORP WAR: |
| 85 | +* Open https://local.tc.cloud.topcoder.com/corp/, the page is like: http://take.ms/d6tMF |
| 86 | + |
| 87 | +Email WAR: |
| 88 | +* Open https://local.tc.cloud.topcoder.com/email/, the page is like: http://take.ms/BNbd5 |
| 89 | + |
| 90 | +Reg WAR: |
| 91 | +* Open https://local.tc.cloud.topcoder.com/reg/, the page is like: http://take.ms/jkbVm |
| 92 | + |
| 93 | +EP WAR: |
| 94 | +* Open https://local.tc.cloud.topcoder.com/ep, the page is like: http://take.ms/Nw1bV |
| 95 | + |
| 96 | +Private Label WAR: |
| 97 | +* Open https://local.tc.cloud.topcoder.com/pl/, the page is like: http://take.ms/x3pr5 |
| 98 | + |
| 99 | +Note that you may receive HTTPS certificate warnings, just ignore it and proceed. |
| 100 | +And you can click around to try the other pages. |
0 commit comments