Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
50660f2
updated readme for docker
May 7, 2015
36e388a
updated readme for docker
May 7, 2015
b398393
README updates
May 7, 2015
07cf11b
markdown fixes
May 7, 2015
b0d5dfd
readme
May 8, 2015
868ffca
updated instructions; docker images
May 12, 2015
c8b97b3
readme update
May 12, 2015
549887d
readme update
May 12, 2015
85a8d4a
readme update
May 12, 2015
76ade73
updated repos b/c codehaus repo no longer exists
Sep 15, 2015
3bab573
Merge branch 'dev' into james-dev
Nov 10, 2015
8eaae21
fixed compilation; modified runtime docker images for compose
Nov 11, 2015
f881586
push submissions to ASP
Nov 11, 2015
c301226
Update application.xml
Nov 11, 2015
ff732bd
docker changes
Nov 11, 2015
3e82265
added client jar
Nov 11, 2015
a6ee3a2
connect to service; cleanup
Nov 11, 2015
dd4b576
restore scorecard
Nov 12, 2015
6cfa39d
fixed whitespace
Nov 12, 2015
dc698c4
fixed whitespace
Nov 12, 2015
4fe9836
fixed whitespace
Nov 12, 2015
2c4b5bd
updated client jar to remove bundled dependencies
Nov 12, 2015
388276d
fixed depends
Nov 12, 2015
33c814a
aspclient dependencies
Nov 12, 2015
63727b1
dependency jars
Nov 12, 2015
3d6182d
jars
Nov 12, 2015
6d72fdf
removed references to cxf
Nov 12, 2015
4cc9e85
restore scorecard
Nov 12, 2015
2567d6f
fixed references to obsolete service
Nov 12, 2015
a7fa0d4
use lowercase when looking for files
Nov 13, 2015
5167595
fixed user id
Nov 16, 2015
4bc2032
final fixes integration
hohosky Nov 19, 2015
ff7aef9
improved error message
Nov 19, 2015
024c5f6
fixed readme
Nov 19, 2015
6fc641d
fixed cursor
Nov 19, 2015
feef35c
use sequence for copilot_project id
Nov 25, 2015
56215a1
development challenge and code work step type
hohosky Dec 1, 2015
351bfd8
Merge remote-tracking branch 'origin/30052209_asp_work_manager_dev_pa…
Dec 9, 2015
de94ab4
updated jar
Dec 9, 2015
c8c2fcb
added new query_tool query for demand id
Dec 15, 2015
e8c3013
debug
Dec 15, 2015
a49384d
fixed query
Dec 15, 2015
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ target/
token.properties
topcoder_global.properties
stacktrace.log
/bin/
.DS_Store
*/.DS_Store
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,49 @@
direct-app
==========

## building
To build, download the docker build container that has all of the build dependencies. You can then run the container to build your local source code.

1. Clone the github source directory
2. Rename `token.properties.docker` to `token.properties` in the source directory
3. Rename `topcoder_global.properties.docker` to `topcoder_global.properties`
4. Unzip [jboss-4.2.3.zip](http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fjboss%2Ffiles%2FJBoss%2FJBoss-4.2.3.GA%2F) in your root source directory. The build will place jboss deployment files here. It also needs some of its libraries for the build itself.
5. Run the docker container to execute a build. The format of the command is `docker run --rm=true -v <source dir>:/data -t appiriodevops/tc-direct-app-build <ant target(s)>`.

For example, `docker run --rm=true -v /Users/james/dev/topcoder/direct-app:/data -t appiriodevops/tc-direct-app-build clean package-direct deploy-prod`

> NOTE: the source directory should be writeable to Docker so use a directory under `/Users/<username>`

## running locally
In this configuration, we'll run the direct app in a docker container locally but it unfortunately requires many dependencies so we'll need to run several containers and connect to the dev database. To run, follow these steps.

> NOTE: it is assumed you are running with the latest Docker toolbox and Docker compose (1.5+)

1. Add this entry to your local /etc/hosts file: `<docker ip> docker.topcoder-dev.com`. This is needed for auth integration that requires the same top level domain. You can get the docker ip with the command `docker-machine ip default`
2. Set the following environment variables:
* TC_DEV_NAT_DIR : Local directory containing the pem file for accessing the dev NAT instance (used to create a tunnel to the dev informix instances)
* TC_DIRECT_SRC_HOME : Local directory for the root direct-app directory
* ASP_API_URL : Base URL for the ASP API (e.g., https://api.topcoder-dev.com)
3. Run `docker-compose up` from the `docker` subdirectory containing the `docker-compose.yml` file


This will start the app with an endpoint available on port 443. You can now go to https://docker.topcoder-dev.com/direct/enterpriseDashboard/activeContests.action

> NOTE: the SSL certificate is self-signed as will generate a warning/error when you access the site for the first time. Just accept it and continue.

---


## **old** instructions

Setup on VM:
* Once you get your VM, login into the VM with your private key and account 'direct'
* Back up token.properties and topcoder_global.properties in /home/direct/direct somewhere
* Delete the whole directory /home/direct/direct
* Git Clone the direct-app repo into folder /home/direct/direct.
* Copy the back up *.properties files back to /home/direct/direct
* Among the *.properties, update topcoder_global.properties, add line 'direct_service_libdir=${libdir}/tcs/ejb' after tcs_libdir property
* Make sure JDK7 is used: run
* Make sure JDK7 is used: run
* + export JAVA_HOME=/opt/jdk1.7.0_17
* + export PATH=/opt/jdk1.7.0_17/bin:$PATH

Expand Down
11 changes: 11 additions & 0 deletions build-dependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,13 @@
<property name="jai_codec-1.1.3.jar" value="${ext_libdir}/jai/jai_codec-1.1.3.jar"/>
<property name="jai_core-1.1.3.jar" value="${ext_libdir}/jai/jai_core-1.1.3.jar"/>

<!--
<property name="cxf.jar" value="${ext_libdir}/cxf/cxf-2.6.4.jar"/>
<property name="aopalliance-1.0.jar" value="${ext_libdir}/cxf/aopalliance-1.0.jar"/>
<property name="geronimo-jaxws_2.2_spec-1.1.jar" value="${ext_libdir}/cxf/geronimo-jaxws_2.2_spec-1.1.jar"/>
<property name="geronimo-annotation_1.0_spec-1.1.1.jar" value="${ext_libdir}/cxf/geronimo-annotation_1.0_spec-1.1.1.jar"/>
<property name="neethi-3.0.1.jar" value="${ext_libdir}/cxf/neethi-3.0.1.jar"/>
-->

<!-- Struts 2 libs -->
<property name="struts2_libdir" value="${ext_libdir}/struts"/>
Expand Down Expand Up @@ -472,6 +474,8 @@
<!-- slf4j -->
<property name="slf4j.jar" value="${ext_libdir}/mime-util/slf4j-api-1.5.11.jar"/>

<property name="asp-client.jar" value="${ext_libdir}/aspclient/asp-client.jar"/>


<!-- EJB/Persistence libraries -->
<path id="ejb.libs">
Expand Down Expand Up @@ -622,6 +626,10 @@
<pathelement location="${scorecard_management.jar}"/>
</path>

<path id="aspclient.libs">
<fileset dir="${ext_libdir}/aspclient" includes="*.jar"/>
</path>

<path id="component.3rdParty-dependencies">
<path refid="struts.libs"/>
<path refid="spring.libs"/>
Expand All @@ -648,9 +656,12 @@
<pathelement location="${jackson-core-2.3.2.jar}"/>
<pathelement location="${jackson-databind-2.3.2.jar}"/>
<pathelement location="${scribe.jar}"/>
<!--
<pathelement location="${jsr311.jar}"/>
<pathelement location="${cxf.jar}"/>
-->
<pathelement location="${java-jwt-1.0.0.jar}"/>
<pathelement location="${asp-client.jar}"/>
</path>

</project>
8 changes: 8 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,20 @@
<copy file="${log4j.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
<copy file="${slf4j.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
<copy file="${scribe.jar}" todir="${ear_shared_libdir}" overwrite="true" />
<!--
<copy file="${jsr311.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
<copy file="${cxf.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
-->
<copy file="${asp-client.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
<copy todir="${ear_shared_libdir}" overwrite="true">
<fileset dir="${ext_libdir}/aspclient" includes="*.jar"/>
</copy>
<!--
<copy file="${aopalliance-1.0.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
<copy file="${geronimo-jaxws_2.2_spec-1.1.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
<copy file="${geronimo-annotation_1.0_spec-1.1.1.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
<copy file="${neethi-3.0.1.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
-->
<copy todir="${ear_shared_libdir}" overwrite="true">
<fileset dir="${httpclient_libdir}">
<include name="commons-codec-1.6.jar"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@

<class name="CopilotProject" table="copilot_project">
<id name="id" column="copilot_project_id" type="long">
<!-- use a sequence b/c rows are inserted by other processes too
<generator class="increment"/>
-->
<generator class="sequence">
<param name="sequence">copilot_project_sequence</param>
</generator>
</id>
<property name="createDate" column="create_date" type="timestamp" update="false"/>
<property name="createUser" column="create_user" type="string" update="false"/>
Expand Down
10 changes: 5 additions & 5 deletions conf/ear/META-INF/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@
<java>conf</java>
</module>

<module>
<web>
<web-uri>scorecard.war</web-uri>
<context-root>/direct/scorecard</context-root>
</web>
<module>
<web>
<web-uri>scorecard.war</web-uri>
<context-root>/direct/scorecard</context-root>
</web>
</module>
<module>
<web>
Expand Down
17 changes: 17 additions & 0 deletions conf/web/WEB-INF/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@
<property name="permissionServiceFacade" ref="permissionServiceFacade"/>
</bean>

<bean id="projectWorkManagementAction"
class="com.topcoder.direct.services.view.action.project.ProjectWorkManagementAction" scope="prototype" parent="baseDirectStrutsAction">
<property name="studioSubmissionBase" value="@studio.submission.base@"/>
<property name="softwareSubmissionBase" value="@file_storage_location@"/>
<property name="mimeTypeRetriever" ref="mimeTypeRetriever"/>
</bean>

<bean id="getProjectVMInstancesAction"
class="com.topcoder.direct.services.view.action.project.GetProjectVMInstancesAction" scope="prototype">
<property name="cloudVMService" ref="cloudVMService"/>
Expand Down Expand Up @@ -492,14 +499,18 @@
parent="contestAction" scope="prototype">
<property name="type" value="CONTEST" />
<property name="timelineInterval" value="1"/>
<!--
<property name="marathonMatchAnalyticsService" ref="marathonMatchAnalyticsService"/>
-->
</bean>

<bean id="contestDetailJSONAction" class="com.topcoder.direct.services.view.action.contest.launch.GetContestAction"
parent="contestAction" scope="prototype">
<property name="type" value="CONTEST_JSON" />
<property name="timelineInterval" value="1"/>
<!--
<property name="marathonMatchAnalyticsService" ref="marathonMatchAnalyticsService"/>
-->
</bean>

<!-- we need this type to avoid to store session value -->
Expand Down Expand Up @@ -1528,7 +1539,9 @@
<bean id="marathonMatchViewAction"
class="com.topcoder.direct.services.view.action.analytics.longcontest.MarathonMatchViewAction"
scope="prototype">
<!--
<property name="marathonMatchAnalyticsService" ref="marathonMatchAnalyticsService"/>
-->
<property name="contestServiceFacade" ref="contestServiceFacade"/>
<property name="timelineInterval" value="1"/>
<property name="submissionHistoryInterval" value="20"/>
Expand All @@ -1537,13 +1550,16 @@
<bean id="marathonMatchResultsViewAction"
class="com.topcoder.direct.services.view.action.analytics.longcontest.MarathonMatchResultsViewAction"
scope="prototype">
<!--
<property name="marathonMatchAnalyticsService" ref="marathonMatchAnalyticsService"/>
-->
<property name="contestServiceFacade" ref="contestServiceFacade"/>
<property name="timelineInterval" value="1"/>
</bean>

<bean id="marathonMatchRoundIdAction" class="com.topcoder.direct.services.view.action.analytics.longcontest.MarathonMatchRoundIdAction" scope="prototype"/>

<!--
<bean id="marathonMatchAnalyticsService"
class="com.topcoder.direct.services.view.action.analytics.longcontest.services.impl.MarathonMatchAnalyticsServiceImpl"
init-method="checkInit">
Expand All @@ -1559,6 +1575,7 @@
<property name="clientSecret" value="@clientSecret@"/>
<property name="apiKey" value="@apiKey@"/>
</bean>
-->

<bean id="needFinalFixAction"
class="com.topcoder.direct.services.view.action.contest.studio.NeedFinalFixAction"
Expand Down
35 changes: 35 additions & 0 deletions conf/web/WEB-INF/struts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,41 @@
<result name="success">/WEB-INF/project-vm-management.jsp</result>
</action>

<action name="projectWorkManager" class="projectWorkManagementAction">
<interceptor-ref name="securedProjectPreProcessorStack"/>
<result name="success">/WEB-INF/project-work-management.jsp</result>
</action>

<action name="getProjectWorkSteps" method="getDirectProjectWorkSteps" class="projectWorkManagementAction">
<interceptor-ref name="securedProjectPreProcessorStack"/>
<result name="success" type="json"/>
<result name="error" type="json"/>
</action>

<action name="getWorkStepChallenges" method="getChallengesForWorkStepAndProject" class="projectWorkManagementAction">
<interceptor-ref name="securedProjectPreProcessorStack"/>
<result name="success" type="json"/>
<result name="error" type="json"/>
</action>

<action name="getContestPhasesForWorkStep" method="getContestPhasesForWorkStep" class="projectWorkManagementAction">
<interceptor-ref name="securedProjectPreProcessorStack"/>
<result name="success" type="json"/>
<result name="error" type="json"/>
</action>

<action name="getSubmissionDataForPhase" method="getSubmissionDataForPhase" class="projectWorkManagementAction">
<interceptor-ref name="securedProjectPreProcessorStack"/>
<result name="success" type="json"/>
<result name="error" type="json"/>
</action>

<action name="pushSubmissions" method="pushSubmissions" class="projectWorkManagementAction">
<interceptor-ref name="securedProjectPreProcessorStack"/>
<result name="success" type="json"/>
<result name="error" type="json"/>
</action>

<action name="getProjectVMInstances" class="getProjectVMInstancesAction">
<interceptor-ref name="authnInterceptor"/>
<result name="success" type="json"/>
Expand Down
12 changes: 12 additions & 0 deletions conf/web/WEB-INF/tld/tcdirect-functions.tld
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@
<function-class>com.topcoder.direct.services.view.util.JSPHelper</function-class>
<function-signature>boolean hasWriteProjectPermission(long)</function-signature>
</function>

<function>
<name>hasPermissionToAccessWorkManager</name>
<function-class>com.topcoder.direct.services.view.util.JSPHelper</function-class>
<function-signature>boolean hasPermissionToAccessWorkManager(long)</function-signature>
</function>

<function>
<name>getDemandWorkId</name>
<function-class>com.topcoder.direct.services.view.util.JSPHelper</function-class>
<function-signature>java.lang.String getDirectProjectDemandWorkId(long)</function-signature>
</function>

<function>
<name>maxLong</name>
Expand Down
28 changes: 28 additions & 0 deletions docker/direct-app-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM centos:6

RUN yum install -y \
java-1.6.0-openjdk-devel.x86_64 \
unzip \
tar

COPY grails-1.3.7.zip /root/
COPY apache-ant-1.7.1-bin.tar.gz /root/
COPY ant-libs.tgz /root/

RUN unzip -d /root /root/grails-1.3.7.zip && tar --directory=/root -xzf /root/apache-ant-1.7.1-bin.tar.gz && tar --directory=/root/apache-ant-1.7.1/lib -xzvf /root/ant-libs.tgz

# need to copy because dynamic download from repo fails
COPY json-rest-api-1.0.8.zip /root/grails-1.3.7/plugins/grails-json-rest-api-1.0.8.zip

ENV JAVA_HOME /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.35.x86_64
ENV GRAILS_HOME /root/grails-1.3.7
ENV ANT_HOME /root/apache-ant-1.7.1
ENV PATH $JAVA_HOME/bin:$GRAILS_HOME/bin:$ANT_HOME/bin:$PATH

VOLUME /data

WORKDIR /data

# ant dist-backend
ENTRYPOINT ["/root/apache-ant-1.7.1/bin/ant"]

Binary file added docker/direct-app-build/ant-contrib-1.0b3-bin.zip
Binary file not shown.
Binary file added docker/direct-app-build/ant-libs.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added docker/direct-app-build/grails-1.3.7.zip
Binary file not shown.
Binary file added docker/direct-app-build/json-rest-api-1.0.8.zip
Binary file not shown.
30 changes: 30 additions & 0 deletions docker/direct-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM centos:6

RUN yum install -y \
java-1.7.0-openjdk-devel.x86_64 \
unzip \
tar \
wget

#RUN mkdir /data

WORKDIR /data

RUN ["wget", "-O", "/data/jboss-4.2.3.zip", "http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fjboss%2Ffiles%2FJBoss%2FJBoss-4.2.3.GA"]

RUN ["unzip", "/data/jboss-4.2.3.zip"]

ENV JAVA_HOME /usr/lib/jvm/jre-1.7.0-openjdk.x86_64
ENV JBOSS_HOME /data/jboss-4.2.3.GA

COPY start-jboss.sh /data/jboss-4.2.3.GA/bin/
COPY TC.prod.ldap.keystore /data/jboss-4.2.3.GA/bin/

#VOLUME /data/jboss-4.2.3.GA/server/direct

RUN mkdir /data/temp_files
RUN rm /data/jboss-4.2.3.zip

CMD ["/data/jboss-4.2.3.GA/bin/start-jboss.sh"]

#EXPOSE 8080
Binary file added docker/direct-app/TC.prod.ldap.keystore
Binary file not shown.
5 changes: 5 additions & 0 deletions docker/direct-app/start-jboss.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo "ASP API=${ASP_API_URL}"

$JAVA_HOME/bin/java -Dasp.api-base-url=${ASP_API_URL} -server -Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000 -Djavax.net.ssl.trustStore=/data/jboss-4.2.3.GA/bin/TC.prod.ldap.keystore -XX:+UseParallelGC -XX:ParallelGCThreads=8 -Djboss.remoting.pre_2_0_compatible=true -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Dlog4j.debug -Djava.net.preferIPv4Stack=true -Djboss.remoting.pre_2_0_compatible=true -Djava.endorsed.dirs=$JBOSS_HOME/lib/endorsed -classpath $JBOSS_HOME/bin/run.jar:$JAVA_HOME/lib/tools.jar org.jboss.Main -c direct -b 0.0.0.0
12 changes: 12 additions & 0 deletions docker/direct-web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM nginx

COPY direct-web-nginx.conf /etc/nginx/conf.d/
COPY ssl /etc/nginx/ssl/

RUN mkdir -p /cache/nginx

#VOLUME /data

#CMD ["/usr/sbin/nginx"]

#EXPOSE 8080
Loading