diff --git a/service/build/Dockerfile.template b/service/build/Dockerfile.template new file mode 100644 index 0000000..323f307 --- /dev/null +++ b/service/build/Dockerfile.template @@ -0,0 +1,19 @@ +FROM appiriodevops/ap-microservice-base:0.0.1 + +MAINTAINER mdesiderio@appirio.com + +WORKDIR /data + +COPY review-microservice.jar /data/review-microservice.jar + +COPY review-service.yaml /data/review-service.yaml + +COPY newrelic.yml /usr/local/share/newrelic/newrelic.yml + +COPY sumo-sources.json /data/sumo-sources.json + +COPY sumo.conf /etc/sumo.conf + +CMD /bin/bash /usr/local/share/sumocollector/collector start && java @ENV_JAVA_PARAMS@ -Ddw.authDomain="$AUTH_DOMAIN" -Ddw.databases[0].password="$OLTP_PW" -Ddw.databases[0].url="$OLTP_URL" -Ddw.databases[1].password="$DW_PW" -Ddw.databases[1].url="$DW_URL" -jar /data/review-microservice.jar server /data/review-service.yaml + +EXPOSE 8080 8081 2181 9092 diff --git a/service/build/Dockerrun.aws.json.template b/service/build/Dockerrun.aws.json.template new file mode 100644 index 0000000..12023ab --- /dev/null +++ b/service/build/Dockerrun.aws.json.template @@ -0,0 +1,19 @@ +{ + "AWSEBDockerrunVersion": "1", + "Authentication": { + "Bucket": "appirio-platform-dev", + "Key": "services/common/dockercfg" + }, + "Image": { + "Name": "appiriodevops/@IMAGE@", + "Update": "true" + }, + "Ports": [ + { + "ContainerPort": "8080" + } + ], + "Volumes": [ + ], + "Logging": "" +} diff --git a/service/build/deploy.sh b/service/build/deploy.sh new file mode 100755 index 0000000..1dc8864 --- /dev/null +++ b/service/build/deploy.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# Define script variables +WORKSPACE=$1 +DEPLOY_DIR=$2 +SERVICE=$3 +ENV=$4 + +DOCKER_REPO=appiriodevops +VER=`date "+%Y%m%d%H%M"` +IMAGE="$SERVICE-microservice:$ENV.$VER" +DOCKERRUN_TEMPLATE=$DEPLOY_DIR/Dockerrun.aws.json.template +DOCKERRUN=$DEPLOY_DIR/Dockerrun.aws.json +AWS_S3_BUCKET=appirio-platform-dev +AWS_PROFILE="tc-$ENV" +AWS_S3_KEY="services/docker/$IMAGE" +ENV_JAVA_PARAMS=" " + +# Elastic Beanstalk Application name +# dev +APPNAME="Development" +if [ "$ENV" = "qa" ]; then + APPNAME="QA" +fi +if [ "$ENV" = "prod" ]; then + APPNAME="Production" + AWS_S3_BUCKET=appirio-platform-prod + ENV_JAVA_PARAMS='-Xmx3g -Dnewrelic.environment=production -javaagent:$NEWRELIC_JAR' +fi + +cd $DEPLOY_DIR + +echo "Generating Dockerfile" +cat Dockerfile.template | sed -e "s/@ENV_JAVA_PARAMS@/$ENV_JAVA_PARAMS/g" > Dockerfile + +echo "Generate sumo config files" +cat sumo.conf.template | sed -e "s/@env@/${ENV}/g" > sumo.conf +cat sumo-sources.json.template | sed -e "s/@env@/${ENV}/g" > sumo-sources.json + +echo "Copying deployment files to build folder" +cp $WORKSPACE/service/target/review-microservice*.jar review-microservice.jar +cp $WORKSPACE/service/src/main/resources/review-service.yaml review-service.yaml + +echo "Building docker image $DOCKER_REPO/$IMAGE" +sudo docker build -t $DOCKER_REPO/$IMAGE $DEPLOY_DIR + +echo "Pushing image to docker $DOCKER_REPO/$IMAGE" +sudo docker push $DOCKER_REPO/$IMAGE + +echo "Generating dockerrun file" +cat $DOCKERRUN_TEMPLATE | sed -e "s/@IMAGE@/${IMAGE}/g" > $DOCKERRUN + +echo "Uploading dockerrun file to aws" + +echo "Pushing Dockerrun.aws.json to S3: ${AWS_S3_BUCKET}/${AWS_S3_KEY}" +aws s3api put-object --profile $AWS_PROFILE --bucket "${AWS_S3_BUCKET}" --key "${AWS_S3_KEY}" --body $DOCKERRUN + +echo "Creating new application version $IMAGE in $APPNAME from s3:${AWS_S3_BUCKET}/${AWS_S3_KEY}" +aws elasticbeanstalk create-application-version --profile $AWS_PROFILE --application-name $APPNAME --version-label $IMAGE --source-bundle S3Bucket="$AWS_S3_BUCKET",S3Key="$AWS_S3_KEY" + +echo "updating elastic beanstalk environment ${AWS_EB_ENV} with the version $IMAGE." +# assumes beanstalk app for this service has already been created and configured +aws elasticbeanstalk --profile $AWS_PROFILE update-environment --environment-name $SERVICE-$ENV --version-label $IMAGE diff --git a/service/run-config/qa/build/newrelic.yml b/service/build/newrelic.yml similarity index 99% rename from service/run-config/qa/build/newrelic.yml rename to service/build/newrelic.yml index 60e0274..795bac4 100644 --- a/service/run-config/qa/build/newrelic.yml +++ b/service/build/newrelic.yml @@ -282,4 +282,4 @@ test: app_name: ap-review (Test) production: - <<: *default_settings \ No newline at end of file + <<: *default_settings diff --git a/service/run-config/prod/build/sumo-sources.json b/service/build/sumo-sources.json.template similarity index 78% rename from service/run-config/prod/build/sumo-sources.json rename to service/build/sumo-sources.json.template index 74a8e0b..02b1c7f 100644 --- a/service/run-config/prod/build/sumo-sources.json +++ b/service/build/sumo-sources.json.template @@ -2,11 +2,11 @@ "api.version": "v1", "sources": [ { - "name": "ap-review-prod", + "name": "ap-review-@env@", "sourceType": "LocalFile", "multilineProcessingEnabled": false, "pathExpression": "/var/log/ap-review.log", - "category": "prod", + "category": "@env@", "hostName": "ap-review" } ] diff --git a/service/run-config/prod/build/sumo.conf b/service/build/sumo.conf.template similarity index 87% rename from service/run-config/prod/build/sumo.conf rename to service/build/sumo.conf.template index 6e2f71d..353fe86 100644 --- a/service/run-config/prod/build/sumo.conf +++ b/service/build/sumo.conf.template @@ -1,4 +1,4 @@ -name=ap-review-prod +name=ap-review-@env@ accessid=suMochTM9jsUmo accesskey=i9Jo6vJ8TiGH4NLJ6JOrhR2Z34eKZQcDNCiGz5ePkujZWwzzZhcAZNufty6viT63 clobber=true diff --git a/service/run-config/dev/build/Dockerfile b/service/run-config/dev/build/Dockerfile deleted file mode 100644 index 27eabd4..0000000 --- a/service/run-config/dev/build/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM appiriodevops/ap-microservice-base:0.0.1 - -MAINTAINER mdesiderio@appirio.com - -WORKDIR /data - -COPY supply-server.jar /data/supply-server.jar - -COPY supply-server.yaml /data/supply-server.yaml - -COPY newrelic.yml /usr/local/share/newrelic/newrelic.yml - -COPY sumo-sources.json /data/sumo-sources.json - -COPY sumo.conf /etc/sumo.conf - -CMD /bin/bash /usr/local/share/sumocollector/collector start && java -Ddw.databases[0].password="$OLTP_PW" -Ddw.databases[1].password="$DW_PW" -jar /data/supply-server.jar server /data/supply-server.yaml - -EXPOSE 8080 8081 \ No newline at end of file diff --git a/service/run-config/dev/build/newrelic.yml b/service/run-config/dev/build/newrelic.yml deleted file mode 100644 index 60e0274..0000000 --- a/service/run-config/dev/build/newrelic.yml +++ /dev/null @@ -1,285 +0,0 @@ -# This file configures the New Relic Agent. New Relic monitors -# Java applications with deep visibility and low overhead. For more details and additional -# configuration options visit https://docs.newrelic.com/docs/java/java-agent-configuration. -# -# This configuration file is custom generated for Topcoder Inc. - Pro -# -# This section is for settings common to all environments. -# Do not add anything above this next line. -common: &default_settings - - # ============================== LICENSE KEY =============================== - # You must specify the license key associated with your New Relic - # account. For example, if your license key is 12345 use this: - # license_key: '12345' - # The key binds your Agent's data to your account in the New Relic service. - license_key: '12c8fadc3bfc2c3c67d08b397f020e512f0ba3fc' - - # Agent Enabled - # Use this setting to disable the agent instead of removing it from the startup command. - # Default is true. - agent_enabled: true - - # Set the name of your application as you'd like it show up in New Relic. - # If enable_auto_app_naming is false, the agent reports all data to this application. - # Otherwise, the agent reports only background tasks (transactions for non-web applications) - # to this application. To report data to more than one application - # (useful for rollup reporting), separate the application names with ";". - # For example, to report data to "My Application" and "My Application 2" use this: - # app_name: My Application;My Application 2 - # This setting is required. Up to 3 different application names can be specified. - # The first application name must be unique. - app_name: ap-review - - # To enable high security, set this property to true. When in high - # security mode, the agent will use SSL and obfuscated SQL. Additionally, - # request parameters and message parameters will not be sent to New Relic. - high_security: false - - # Set to true to enable support for auto app naming. - # The name of each web app is detected automatically - # and the agent reports data separately for each one. - # This provides a finer-grained performance breakdown for - # web apps in New Relic. - # Default is false. - enable_auto_app_naming: false - - # Set to true to enable component-based transaction naming. - # Set to false to use the URI of a web request as the name of the transaction. - # Default is true. - enable_auto_transaction_naming: true - - # The agent uses its own log file to keep its logging - # separate from that of your application. Specify the log level here. - # This setting is dynamic, so changes do not require restarting your application. - # The levels in increasing order of verboseness are: - # off, severe, warning, info, fine, finer, finest - # Default is info. - log_level: info - - # Log all data sent to and from New Relic in plain text. - # This setting is dynamic, so changes do not require restarting your application. - # Default is false. - audit_mode: false - - # The number of backup log files to save. - # Default is 1. - log_file_count: 1 - - # The maximum number of kbytes to write to any one log file. - # The log_file_count must be set greater than 1. - # Default is 0 (no limit). - log_limit_in_kbytes: 0 - - # Override other log rolling configuration and roll the logs daily. - # Default is false. - log_daily: false - - # The name of the log file. - # Default is newrelic_agent.log. - log_file_name: newrelic_agent.log - - # The log file directory. - # Default is the logs directory in the newrelic.jar parent directory. - #log_file_path: - - # The agent communicates with New Relic via https by - # default. If you want to communicate with newrelic via http, - # then turn off SSL by setting this value to false. - # This work is done asynchronously to the threads that process your - # application code, so response times will not be directly affected - # by this change. - # Default is true. - ssl: true - - # Proxy settings for connecting to the New Relic server: - # If a proxy is used, the host setting is required. Other settings - # are optional. Default port is 8080. The username and password - # settings will be used to authenticate to Basic Auth challenges - # from a proxy server. - #proxy_host: hostname - #proxy_port: 8080 - #proxy_user: username - #proxy_password: password - - # Limits the number of lines to capture for each stack trace. - # Default is 30 - max_stack_trace_lines: 30 - - # Provides the ability to configure the attributes sent to New Relic. These - # attributes can be found in transaction traces, traced errors, Insight's - # transaction events, and Insight's page views. - attributes: - - # When true, attributes will be sent to New Relic. The default is true. - enabled: true - - #A comma separated list of attribute keys whose values should - # be sent to New Relic. - #include: - - # A comma separated list of attribute keys whose values should - # not be sent to New Relic. - #exclude: - - - # Transaction tracer captures deep information about slow - # transactions and sends this to the New Relic service once a - # minute. Included in the transaction is the exact call sequence of - # the transactions including any SQL statements issued. - transaction_tracer: - - # Transaction tracer is enabled by default. Set this to false to turn it off. - # This feature is not available to Lite accounts and is automatically disabled. - # Default is true. - enabled: true - - # Threshold in seconds for when to collect a transaction - # trace. When the response time of a controller action exceeds - # this threshold, a transaction trace will be recorded and sent to - # New Relic. Valid values are any float value, or (default) "apdex_f", - # which will use the threshold for the "Frustrated" Apdex level - # (greater than four times the apdex_t value). - # Default is apdex_f. - transaction_threshold: apdex_f - - # When transaction tracer is on, SQL statements can optionally be - # recorded. The recorder has three modes, "off" which sends no - # SQL, "raw" which sends the SQL statement in its original form, - # and "obfuscated", which strips out numeric and string literals. - # Default is obfuscated. - record_sql: obfuscated - - # Set this to true to log SQL statements instead of recording them. - # SQL is logged using the record_sql mode. - # Default is false. - log_sql: false - - # Threshold in seconds for when to collect stack trace for a SQL - # call. In other words, when SQL statements exceed this threshold, - # then capture and send to New Relic the current stack trace. This is - # helpful for pinpointing where long SQL calls originate from. - # Default is 0.5 seconds. - stack_trace_threshold: 0.5 - - # Determines whether the agent will capture query plans for slow - # SQL queries. Only supported for MySQL and PostgreSQL. - # Default is true. - explain_enabled: true - - # Threshold for query execution time below which query plans will not - # not be captured. Relevant only when `explain_enabled` is true. - # Default is 0.5 seconds. - explain_threshold: 0.5 - - # Use this setting to control the variety of transaction traces. - # The higher the setting, the greater the variety. - # Set this to 0 to always report the slowest transaction trace. - # Default is 20. - top_n: 20 - - # Error collector captures information about uncaught exceptions and - # sends them to New Relic for viewing. - error_collector: - - # This property enables the collection of errors. If the property is not - # set or the property is set to false, then errors will not be collected. - # Default is true. - enabled: true - - # Use this property to exclude specific exceptions from being reported as errors - # by providing a comma separated list of full class names. - # The default is to exclude akka.actor.ActorKilledException. If you want to override - # this, you must provide any new value as an empty list is ignored. - ignore_errors: akka.actor.ActorKilledException - - # Use this property to exclude specific http status codes from being reported as errors - # by providing a comma separated list of status codes. - # The default is to exclude 404s. If you want to override - # this, you must provide any new value as an empty list is ignored. - ignore_status_codes: 404 - - # Transaction Events are used for Histograms and Percentiles. Unaggregated data is collected - # for each web transaction and sent to the server on harvest. - transaction_events: - - # Set to false to disable transaction events. - # Default is true. - enabled: true - - # Events are collected up to the configured amount. Afterwards, events are sampled to - # maintain an even distribution across the harvest cycle. - # Default is 2000. Setting to 0 will disable. - max_samples_stored: 2000 - - # Cross Application Tracing adds request and response headers to - # external calls using supported HTTP libraries to provide better - # performance data when calling applications monitored by other New Relic Agents. - cross_application_tracer: - - # Set to false to disable cross application tracing. - # Default is true. - enabled: true - - # Thread profiler measures wall clock time, CPU time, and method call counts - # in your application's threads as they run. - # This feature is not available to Lite accounts and is automatically disabled. - thread_profiler: - - # Set to false to disable the thread profiler. - # Default is true. - enabled: true - - # New Relic Real User Monitoring gives you insight into the performance real users are - # experiencing with your website. This is accomplished by measuring the time it takes for - # your users' browsers to download and render your web pages by injecting a small amount - # of JavaScript code into the header and footer of each page. - browser_monitoring: - - # By default the agent automatically inserts API calls in compiled JSPs to - # inject the monitoring JavaScript into web pages. Not all rendering engines are supported. - # See https://docs.newrelic.com/docs/java/real-user-monitoring-in-java#manual_instrumentation - # for instructions to add these manually to your pages. - # Set this attribute to false to turn off this behavior. - auto_instrument: true - - class_transformer: - # This instrumentation reports the name of the user principal returned from - # HttpServletRequest.getUserPrincipal() when servlets and filters are invoked. - com.newrelic.instrumentation.servlet-user: - enabled: false - - com.newrelic.instrumentation.spring-aop-2: - enabled: false - - # User-configurable custom labels for this agent. Labels are name-value pairs. - # There is a maximum of 64 labels per agent. Names and values are limited to 255 characters. - # Names and values may not contain colons (:) or semicolons (;). - labels: - - # An example label - #label_name: label_value - - -# Application Environments -# ------------------------------------------ -# Environment specific settings are in this section. -# You can use the environment to override the default settings. -# For example, to change the app_name setting. -# Use -Dnewrelic.environment= on the Java startup command line -# to set the environment. -# The default environment is production. - -# NOTE if your application has other named environments, you should -# provide configuration settings for these environments here. - -development: - <<: *default_settings - app_name: ap-review (Development) - -test: - <<: *default_settings - app_name: ap-review (Test) - -production: - <<: *default_settings \ No newline at end of file diff --git a/service/run-config/dev/build/sumo-sources.json b/service/run-config/dev/build/sumo-sources.json deleted file mode 100644 index 6d81a18..0000000 --- a/service/run-config/dev/build/sumo-sources.json +++ /dev/null @@ -1,13 +0,0 @@ - { - "api.version": "v1", - "sources": [ - { - "name": "ap-review-dev", - "sourceType": "LocalFile", - "multilineProcessingEnabled": false, - "pathExpression": "/var/log/ap-review.log", - "category": "dev", - "hostName": "ap-review" - } - ] -} \ No newline at end of file diff --git a/service/run-config/dev/build/sumo.conf b/service/run-config/dev/build/sumo.conf deleted file mode 100644 index e4489cb..0000000 --- a/service/run-config/dev/build/sumo.conf +++ /dev/null @@ -1,5 +0,0 @@ -name=ap-review-dev -accessid=suMochTM9jsUmo -accesskey=i9Jo6vJ8TiGH4NLJ6JOrhR2Z34eKZQcDNCiGz5ePkujZWwzzZhcAZNufty6viT63 -clobber=true -sources=/data/sumo-sources.json \ No newline at end of file diff --git a/service/run-config/dev/pom.xml b/service/run-config/dev/pom.xml deleted file mode 100644 index f661f32..0000000 --- a/service/run-config/dev/pom.xml +++ /dev/null @@ -1,306 +0,0 @@ - - 4.0.0 - appirio.platform - supply-server - 1.0.1-SNAPSHOT - supply-server - - - 0.7.1 - 3.20.0 - [2.5.1,) - - - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - xml - html - - - - **/*Test*.class - - - - - - - package - - cobertura - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.2 - - 1.8 - 1.8 - - - - maven-surefire-plugin - 2.18.1 - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - true - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - package - - shade - - - - - - com.appirio.service.supply.SupplyServerApplication - - - - - - - - org.apache.maven.plugins - maven-scm-publish-plugin - 1.0-beta-2 - - ${project.build.directory}/scmpublish - Publishing javadoc for - ${project.artifactId}:${project.version} - ${project.reporting.outputDirectory}/apidocs - true - scm:git:git@github.com:appirio-tech/suppy-server-javadocs.git - gh-pages - - - - - - - de.spinscale - dropwizard-jobs-core - 1.0.1 - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${jackson-version} - - - com.fasterxml.jackson.module - jackson-module-afterburner - ${jackson-version} - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - ${jackson-version} - - - appirio.platform - supply-library - 1.0.7-SNAPSHOT - - - appirio.platform - review-microservice - 1.0.2-SNAPSHOT - - - org.projectlombok - lombok - 1.16.2 - provided - - - junit - junit - 4.11 - compile - - - io.dropwizard - dropwizard-core - ${dropwizard.version} - - - io.dropwizard - dropwizard-auth - ${dropwizard.version} - - - org.easytesting - fest-assert-core - 2.0M10 - - - io.dropwizard - dropwizard-testing - ${dropwizard.version} - - - mysql - mysql-connector-java - 5.1.34 - - - io.dropwizard - dropwizard-jdbi - ${dropwizard.version} - - - com.appirio.tech.core.api - tech.core.api - API-3.0.0.8-SNAPSHOT - - - com.informix.jdbc - com.springsource.com.informix.jdbc - 3.0.0.JC3 - - - io.dropwizard.modules - dropwizard-elasticsearch - 0.8.0-1 - - - com.newrelic.agent.java - newrelic-java - ${newrelic.version} - provided - zip - - - com.newrelic.agent.java - newrelic-agent - ${newrelic.version} - - - com.newrelic.agent.java - newrelic-api - ${newrelic.version} - - - - - - appirio-repo - Appirio Maven Repository - file:///mnt/maven/repository - - - appirio-repo - Appirio Maven Repository - file:///mnt/maven/repository - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.18.1 - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.8 - - false - - - - - org.apache.maven.plugins - maven-pmd-plugin - 3.4 - - false - UTF-8 - 1.8 - - com/appirio/service/*.java - - - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.0 - - com.appirio.service.- - Max - true - - - - - - - - com.springsource.repository.bundles.release - SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases - http://repository.springsource.com/maven/bundles/release - - - - com.springsource.repository.bundles.external - SpringSource Enterprise Bundle Repository - External Bundle Releases - http://repository.springsource.com/maven/bundles/external - - - Appirio Technology Maven Repository - http://maven.appirio.net:8080/ - - always - - - always - - - - \ No newline at end of file diff --git a/service/run-config/prod/build/Dockerfile b/service/run-config/prod/build/Dockerfile deleted file mode 100644 index 8072769..0000000 --- a/service/run-config/prod/build/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM appiriodevops/ap-microservice-base:0.0.1 - -MAINTAINER mdesiderio@appirio.com - -WORKDIR /data - -COPY supply-server.jar /data/supply-server.jar - -COPY supply-server.yaml /data/supply-server.yaml - -COPY newrelic.yml /usr/local/share/newrelic/newrelic.yml - -COPY sumo-sources.json /data/sumo-sources.json - -COPY sumo.conf /etc/sumo.conf - -CMD /bin/bash /usr/local/share/sumocollector/collector start && java -Dnewrelic.environment=production -javaagent:$NEWRELIC_JAR -Ddw.databases[0].password="$OLTP_PW" -Ddw.databases[1].password="$DW_PW" -jar /data/supply-server.jar server /data/supply-server.yaml - -EXPOSE 8080 8081 \ No newline at end of file diff --git a/service/run-config/prod/build/newrelic.yml b/service/run-config/prod/build/newrelic.yml deleted file mode 100644 index 60e0274..0000000 --- a/service/run-config/prod/build/newrelic.yml +++ /dev/null @@ -1,285 +0,0 @@ -# This file configures the New Relic Agent. New Relic monitors -# Java applications with deep visibility and low overhead. For more details and additional -# configuration options visit https://docs.newrelic.com/docs/java/java-agent-configuration. -# -# This configuration file is custom generated for Topcoder Inc. - Pro -# -# This section is for settings common to all environments. -# Do not add anything above this next line. -common: &default_settings - - # ============================== LICENSE KEY =============================== - # You must specify the license key associated with your New Relic - # account. For example, if your license key is 12345 use this: - # license_key: '12345' - # The key binds your Agent's data to your account in the New Relic service. - license_key: '12c8fadc3bfc2c3c67d08b397f020e512f0ba3fc' - - # Agent Enabled - # Use this setting to disable the agent instead of removing it from the startup command. - # Default is true. - agent_enabled: true - - # Set the name of your application as you'd like it show up in New Relic. - # If enable_auto_app_naming is false, the agent reports all data to this application. - # Otherwise, the agent reports only background tasks (transactions for non-web applications) - # to this application. To report data to more than one application - # (useful for rollup reporting), separate the application names with ";". - # For example, to report data to "My Application" and "My Application 2" use this: - # app_name: My Application;My Application 2 - # This setting is required. Up to 3 different application names can be specified. - # The first application name must be unique. - app_name: ap-review - - # To enable high security, set this property to true. When in high - # security mode, the agent will use SSL and obfuscated SQL. Additionally, - # request parameters and message parameters will not be sent to New Relic. - high_security: false - - # Set to true to enable support for auto app naming. - # The name of each web app is detected automatically - # and the agent reports data separately for each one. - # This provides a finer-grained performance breakdown for - # web apps in New Relic. - # Default is false. - enable_auto_app_naming: false - - # Set to true to enable component-based transaction naming. - # Set to false to use the URI of a web request as the name of the transaction. - # Default is true. - enable_auto_transaction_naming: true - - # The agent uses its own log file to keep its logging - # separate from that of your application. Specify the log level here. - # This setting is dynamic, so changes do not require restarting your application. - # The levels in increasing order of verboseness are: - # off, severe, warning, info, fine, finer, finest - # Default is info. - log_level: info - - # Log all data sent to and from New Relic in plain text. - # This setting is dynamic, so changes do not require restarting your application. - # Default is false. - audit_mode: false - - # The number of backup log files to save. - # Default is 1. - log_file_count: 1 - - # The maximum number of kbytes to write to any one log file. - # The log_file_count must be set greater than 1. - # Default is 0 (no limit). - log_limit_in_kbytes: 0 - - # Override other log rolling configuration and roll the logs daily. - # Default is false. - log_daily: false - - # The name of the log file. - # Default is newrelic_agent.log. - log_file_name: newrelic_agent.log - - # The log file directory. - # Default is the logs directory in the newrelic.jar parent directory. - #log_file_path: - - # The agent communicates with New Relic via https by - # default. If you want to communicate with newrelic via http, - # then turn off SSL by setting this value to false. - # This work is done asynchronously to the threads that process your - # application code, so response times will not be directly affected - # by this change. - # Default is true. - ssl: true - - # Proxy settings for connecting to the New Relic server: - # If a proxy is used, the host setting is required. Other settings - # are optional. Default port is 8080. The username and password - # settings will be used to authenticate to Basic Auth challenges - # from a proxy server. - #proxy_host: hostname - #proxy_port: 8080 - #proxy_user: username - #proxy_password: password - - # Limits the number of lines to capture for each stack trace. - # Default is 30 - max_stack_trace_lines: 30 - - # Provides the ability to configure the attributes sent to New Relic. These - # attributes can be found in transaction traces, traced errors, Insight's - # transaction events, and Insight's page views. - attributes: - - # When true, attributes will be sent to New Relic. The default is true. - enabled: true - - #A comma separated list of attribute keys whose values should - # be sent to New Relic. - #include: - - # A comma separated list of attribute keys whose values should - # not be sent to New Relic. - #exclude: - - - # Transaction tracer captures deep information about slow - # transactions and sends this to the New Relic service once a - # minute. Included in the transaction is the exact call sequence of - # the transactions including any SQL statements issued. - transaction_tracer: - - # Transaction tracer is enabled by default. Set this to false to turn it off. - # This feature is not available to Lite accounts and is automatically disabled. - # Default is true. - enabled: true - - # Threshold in seconds for when to collect a transaction - # trace. When the response time of a controller action exceeds - # this threshold, a transaction trace will be recorded and sent to - # New Relic. Valid values are any float value, or (default) "apdex_f", - # which will use the threshold for the "Frustrated" Apdex level - # (greater than four times the apdex_t value). - # Default is apdex_f. - transaction_threshold: apdex_f - - # When transaction tracer is on, SQL statements can optionally be - # recorded. The recorder has three modes, "off" which sends no - # SQL, "raw" which sends the SQL statement in its original form, - # and "obfuscated", which strips out numeric and string literals. - # Default is obfuscated. - record_sql: obfuscated - - # Set this to true to log SQL statements instead of recording them. - # SQL is logged using the record_sql mode. - # Default is false. - log_sql: false - - # Threshold in seconds for when to collect stack trace for a SQL - # call. In other words, when SQL statements exceed this threshold, - # then capture and send to New Relic the current stack trace. This is - # helpful for pinpointing where long SQL calls originate from. - # Default is 0.5 seconds. - stack_trace_threshold: 0.5 - - # Determines whether the agent will capture query plans for slow - # SQL queries. Only supported for MySQL and PostgreSQL. - # Default is true. - explain_enabled: true - - # Threshold for query execution time below which query plans will not - # not be captured. Relevant only when `explain_enabled` is true. - # Default is 0.5 seconds. - explain_threshold: 0.5 - - # Use this setting to control the variety of transaction traces. - # The higher the setting, the greater the variety. - # Set this to 0 to always report the slowest transaction trace. - # Default is 20. - top_n: 20 - - # Error collector captures information about uncaught exceptions and - # sends them to New Relic for viewing. - error_collector: - - # This property enables the collection of errors. If the property is not - # set or the property is set to false, then errors will not be collected. - # Default is true. - enabled: true - - # Use this property to exclude specific exceptions from being reported as errors - # by providing a comma separated list of full class names. - # The default is to exclude akka.actor.ActorKilledException. If you want to override - # this, you must provide any new value as an empty list is ignored. - ignore_errors: akka.actor.ActorKilledException - - # Use this property to exclude specific http status codes from being reported as errors - # by providing a comma separated list of status codes. - # The default is to exclude 404s. If you want to override - # this, you must provide any new value as an empty list is ignored. - ignore_status_codes: 404 - - # Transaction Events are used for Histograms and Percentiles. Unaggregated data is collected - # for each web transaction and sent to the server on harvest. - transaction_events: - - # Set to false to disable transaction events. - # Default is true. - enabled: true - - # Events are collected up to the configured amount. Afterwards, events are sampled to - # maintain an even distribution across the harvest cycle. - # Default is 2000. Setting to 0 will disable. - max_samples_stored: 2000 - - # Cross Application Tracing adds request and response headers to - # external calls using supported HTTP libraries to provide better - # performance data when calling applications monitored by other New Relic Agents. - cross_application_tracer: - - # Set to false to disable cross application tracing. - # Default is true. - enabled: true - - # Thread profiler measures wall clock time, CPU time, and method call counts - # in your application's threads as they run. - # This feature is not available to Lite accounts and is automatically disabled. - thread_profiler: - - # Set to false to disable the thread profiler. - # Default is true. - enabled: true - - # New Relic Real User Monitoring gives you insight into the performance real users are - # experiencing with your website. This is accomplished by measuring the time it takes for - # your users' browsers to download and render your web pages by injecting a small amount - # of JavaScript code into the header and footer of each page. - browser_monitoring: - - # By default the agent automatically inserts API calls in compiled JSPs to - # inject the monitoring JavaScript into web pages. Not all rendering engines are supported. - # See https://docs.newrelic.com/docs/java/real-user-monitoring-in-java#manual_instrumentation - # for instructions to add these manually to your pages. - # Set this attribute to false to turn off this behavior. - auto_instrument: true - - class_transformer: - # This instrumentation reports the name of the user principal returned from - # HttpServletRequest.getUserPrincipal() when servlets and filters are invoked. - com.newrelic.instrumentation.servlet-user: - enabled: false - - com.newrelic.instrumentation.spring-aop-2: - enabled: false - - # User-configurable custom labels for this agent. Labels are name-value pairs. - # There is a maximum of 64 labels per agent. Names and values are limited to 255 characters. - # Names and values may not contain colons (:) or semicolons (;). - labels: - - # An example label - #label_name: label_value - - -# Application Environments -# ------------------------------------------ -# Environment specific settings are in this section. -# You can use the environment to override the default settings. -# For example, to change the app_name setting. -# Use -Dnewrelic.environment= on the Java startup command line -# to set the environment. -# The default environment is production. - -# NOTE if your application has other named environments, you should -# provide configuration settings for these environments here. - -development: - <<: *default_settings - app_name: ap-review (Development) - -test: - <<: *default_settings - app_name: ap-review (Test) - -production: - <<: *default_settings \ No newline at end of file diff --git a/service/run-config/prod/pom.xml b/service/run-config/prod/pom.xml deleted file mode 100644 index 33b9ed2..0000000 --- a/service/run-config/prod/pom.xml +++ /dev/null @@ -1,306 +0,0 @@ - - 4.0.0 - appirio.platform - supply-server - 1.0.1 - supply-server - - - 0.7.1 - 3.20.0 - [2.5.1,) - - - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - xml - html - - - - **/*Test*.class - - - - - - - package - - cobertura - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.2 - - 1.8 - 1.8 - - - - maven-surefire-plugin - 2.18.1 - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - true - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - package - - shade - - - - - - com.appirio.service.supply.SupplyServerApplication - - - - - - - - org.apache.maven.plugins - maven-scm-publish-plugin - 1.0-beta-2 - - ${project.build.directory}/scmpublish - Publishing javadoc for - ${project.artifactId}:${project.version} - ${project.reporting.outputDirectory}/apidocs - true - scm:git:git@github.com:appirio-tech/suppy-server-javadocs.git - gh-pages - - - - - - - de.spinscale - dropwizard-jobs-core - 1.0.1 - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${jackson-version} - - - com.fasterxml.jackson.module - jackson-module-afterburner - ${jackson-version} - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - ${jackson-version} - - - appirio.platform - supply-library - 1.0.7-SNAPSHOT - - - appirio.platform - review-microservice - 1.0.2 - - - org.projectlombok - lombok - 1.16.2 - provided - - - junit - junit - 4.11 - compile - - - io.dropwizard - dropwizard-core - ${dropwizard.version} - - - io.dropwizard - dropwizard-auth - ${dropwizard.version} - - - org.easytesting - fest-assert-core - 2.0M10 - - - io.dropwizard - dropwizard-testing - ${dropwizard.version} - - - mysql - mysql-connector-java - 5.1.34 - - - io.dropwizard - dropwizard-jdbi - ${dropwizard.version} - - - com.appirio.tech.core.api - tech.core.api - API-3.0.0.8-SNAPSHOT - - - com.informix.jdbc - com.springsource.com.informix.jdbc - 3.0.0.JC3 - - - io.dropwizard.modules - dropwizard-elasticsearch - 0.8.0-1 - - - com.newrelic.agent.java - newrelic-java - ${newrelic.version} - provided - zip - - - com.newrelic.agent.java - newrelic-agent - ${newrelic.version} - - - com.newrelic.agent.java - newrelic-api - ${newrelic.version} - - - - - - appirio-repo - Appirio Maven Repository - file:///mnt/maven/repository - - - appirio-repo - Appirio Maven Repository - file:///mnt/maven/repository - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.18.1 - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.8 - - false - - - - - org.apache.maven.plugins - maven-pmd-plugin - 3.4 - - false - UTF-8 - 1.8 - - com/appirio/service/*.java - - - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.0 - - com.appirio.service.- - Max - true - - - - - - - - com.springsource.repository.bundles.release - SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases - http://repository.springsource.com/maven/bundles/release - - - - com.springsource.repository.bundles.external - SpringSource Enterprise Bundle Repository - External Bundle Releases - http://repository.springsource.com/maven/bundles/external - - - Appirio Technology Maven Repository - http://maven.appirio.net:8080/ - - always - - - always - - - - \ No newline at end of file diff --git a/service/run-config/prod/src/main/resources/supply-server.yaml b/service/run-config/prod/src/main/resources/supply-server.yaml deleted file mode 100644 index 622cd8b..0000000 --- a/service/run-config/prod/src/main/resources/supply-server.yaml +++ /dev/null @@ -1,154 +0,0 @@ -authRealm: tcjwt -authDomain: topcoder.com - -memberProgramEventId: 18 - -# Resources -resources: - - com.appirio.service.resourcefactory.AggregateScoresFactory - - com.appirio.service.resourcefactory.PeerReviewFactory - - com.appirio.service.resourcefactory.ReviewFactory - - com.appirio.service.resourcefactory.CopilotFeedbackFactory - - com.appirio.service.resourcefactory.ReviewItemFactory - - com.appirio.service.resourcefactory.ScorecardFactory - - com.appirio.service.resourcefactory.ScorecardQuestionFactory - -eventStrategies: - VERIFY_USER_EMAIL: com.appirio.service.notifications.strategy.VerifyUserEmailStrategy - -# Database settings. - -databases: - - - datasourceName: oltp - - # the name of your JDBC driver - driverClass: com.informix.jdbc.IfxDriver - - # the username - user: coder - - # the password - # NOTE: password is set as a java system property: i.e., -Ddw.database.password= - - validationQuery: select 1 from systables - - # the JDBC URL - url: jdbc:informix-sqli://10.25.94.50:2020/tcs_catalog:INFORMIXSERVER=informixoltp_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1; - - # the minimum number of connections to keep open - minSize: 2 - - # the maximum number of connections to keep open - maxSize: 10 - - # the minimum amount of time an connection must sit idle in the pool before it is eligible for eviction - minIdleTime: 5 minutes - - - datasourceName: dw - - # the name of your JDBC driver - driverClass: com.informix.jdbc.IfxDriver - - # the username - user: coder - - # the password - # NOTE: password is set as a java system property: i.e., -Ddw.database.password= - - validationQuery: select 1 from systables - - # the JDBC URL - url: jdbc:informix-sqli://10.25.94.51:2020/topcoder_dw:INFORMIXSERVER=datawarehouse_shm;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1; - - # the minimum number of connections to keep open - minSize: 2 - - # the maximum number of connections to keep open - maxSize: 10 - - # the minimum amount of time an connection must sit idle in the pool before it is eligible for eviction - minIdleTime: 5 minutes - -# use the simple server factory if you only want to run on a single port -#server: -# type: simple -# connector: -# type: http -# port: 8080 - -server: -# softNofileLimit: 1000 -# hardNofileLimit: 1000 - applicationConnectors: - - type: http - port: 8080 -# - type: https -# port: 8443 -# keyStorePath: example.keystore -# keyStorePassword: example -# validateCerts: false -# this requires the alpn-boot library on the JVM's boot classpath -# - type: spdy3 -# port: 8445 -# keyStorePath: example.keystore -# keyStorePassword: example -# validateCerts: false - adminConnectors: - - type: http - port: 8081 -# - type: https -# port: 8444 -# keyStorePath: example.keystore -# keyStorePassword: example -# validateCerts: false - -# ElasticSearch settings. -esConfiguration: - - servers: - - localhost:11300 - - clusterName: topcoder - - nodeClient: false - - settings: - node.name: elasticsearch01 - -# Logging settings. -logging: - - # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL. - level: INFO - - # Logger-specific levels. - loggers: - - # Sets the level for 'com.example.app' to DEBUG. - com.appirio: DEBUG - - org.hibernate.SQL: ALL - - appenders: - - type: console - target: stdout - threshold: ALL - timeZone: UTC - - - type: file - currentLogFilename: /var/log/ap-review.log - threshold: ALL - archive: true - archivedLogFilenamePattern: /var/log/ap-review-%d.log - archivedFileCount: 5 - timeZone: UTC - logFormat: "%-5level [%d{yyyy-dd-mm HH:mm:ss.SSS}] [%thread] %logger - %msg%n" - -authScheme: v3 - -# File service domain -fileServiceDomain: api.topcoder.com - -# Api version -apiVersion: v3 \ No newline at end of file diff --git a/service/run-config/qa/build/Dockerfile b/service/run-config/qa/build/Dockerfile deleted file mode 100644 index 27eabd4..0000000 --- a/service/run-config/qa/build/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM appiriodevops/ap-microservice-base:0.0.1 - -MAINTAINER mdesiderio@appirio.com - -WORKDIR /data - -COPY supply-server.jar /data/supply-server.jar - -COPY supply-server.yaml /data/supply-server.yaml - -COPY newrelic.yml /usr/local/share/newrelic/newrelic.yml - -COPY sumo-sources.json /data/sumo-sources.json - -COPY sumo.conf /etc/sumo.conf - -CMD /bin/bash /usr/local/share/sumocollector/collector start && java -Ddw.databases[0].password="$OLTP_PW" -Ddw.databases[1].password="$DW_PW" -jar /data/supply-server.jar server /data/supply-server.yaml - -EXPOSE 8080 8081 \ No newline at end of file diff --git a/service/run-config/qa/build/sumo-sources.json b/service/run-config/qa/build/sumo-sources.json deleted file mode 100644 index 7ad9935..0000000 --- a/service/run-config/qa/build/sumo-sources.json +++ /dev/null @@ -1,13 +0,0 @@ - { - "api.version": "v1", - "sources": [ - { - "name": "ap-review-qa", - "sourceType": "LocalFile", - "multilineProcessingEnabled": false, - "pathExpression": "/var/log/ap-review.log", - "category": "qa", - "hostName": "ap-review" - } - ] -} \ No newline at end of file diff --git a/service/run-config/qa/build/sumo.conf b/service/run-config/qa/build/sumo.conf deleted file mode 100644 index d327eef..0000000 --- a/service/run-config/qa/build/sumo.conf +++ /dev/null @@ -1,5 +0,0 @@ -name=ap-review-qa -accessid=suMochTM9jsUmo -accesskey=i9Jo6vJ8TiGH4NLJ6JOrhR2Z34eKZQcDNCiGz5ePkujZWwzzZhcAZNufty6viT63 -clobber=true -sources=/data/sumo-sources.json \ No newline at end of file diff --git a/service/run-config/qa/pom.xml b/service/run-config/qa/pom.xml deleted file mode 100644 index 73d08b2..0000000 --- a/service/run-config/qa/pom.xml +++ /dev/null @@ -1,306 +0,0 @@ - - 4.0.0 - appirio.platform - supply-server - 1.0.1 - supply-server - - - 0.7.1 - 3.20.0 - [2.5.1,) - - - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - xml - html - - - - **/*Test*.class - - - - - - - package - - cobertura - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.2 - - 1.8 - 1.8 - - - - maven-surefire-plugin - 2.18.1 - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - true - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - package - - shade - - - - - - com.appirio.service.supply.SupplyServerApplication - - - - - - - - org.apache.maven.plugins - maven-scm-publish-plugin - 1.0-beta-2 - - ${project.build.directory}/scmpublish - Publishing javadoc for - ${project.artifactId}:${project.version} - ${project.reporting.outputDirectory}/apidocs - true - scm:git:git@github.com:appirio-tech/suppy-server-javadocs.git - gh-pages - - - - - - - de.spinscale - dropwizard-jobs-core - 1.0.1 - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${jackson-version} - - - com.fasterxml.jackson.module - jackson-module-afterburner - ${jackson-version} - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - ${jackson-version} - - - appirio.platform - supply-library - 1.0.7-SNAPSHOT - - - appirio.platform - review-microservice - 1.0.2 - - - org.projectlombok - lombok - 1.16.2 - provided - - - junit - junit - 4.11 - compile - - - io.dropwizard - dropwizard-core - ${dropwizard.version} - - - io.dropwizard - dropwizard-auth - ${dropwizard.version} - - - org.easytesting - fest-assert-core - 2.0M10 - - - io.dropwizard - dropwizard-testing - ${dropwizard.version} - - - mysql - mysql-connector-java - 5.1.34 - - - io.dropwizard - dropwizard-jdbi - ${dropwizard.version} - - - com.appirio.tech.core.api - tech.core.api - API-3.0.0.8-SNAPSHOT - - - com.informix.jdbc - com.springsource.com.informix.jdbc - 3.0.0.JC3 - - - io.dropwizard.modules - dropwizard-elasticsearch - 0.8.0-1 - - - com.newrelic.agent.java - newrelic-java - ${newrelic.version} - provided - zip - - - com.newrelic.agent.java - newrelic-agent - ${newrelic.version} - - - com.newrelic.agent.java - newrelic-api - ${newrelic.version} - - - - - - appirio-repo - Appirio Maven Repository - file:///mnt/maven/repository - - - appirio-repo - Appirio Maven Repository - file:///mnt/maven/repository - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.18.1 - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.8 - - false - - - - - org.apache.maven.plugins - maven-pmd-plugin - 3.4 - - false - UTF-8 - 1.8 - - com/appirio/service/*.java - - - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.0 - - com.appirio.service.- - Max - true - - - - - - - - com.springsource.repository.bundles.release - SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases - http://repository.springsource.com/maven/bundles/release - - - - com.springsource.repository.bundles.external - SpringSource Enterprise Bundle Repository - External Bundle Releases - http://repository.springsource.com/maven/bundles/external - - - Appirio Technology Maven Repository - http://maven.appirio.net:8080/ - - always - - - always - - - - \ No newline at end of file diff --git a/service/run-config/qa/src/main/resources/supply-server.yaml b/service/run-config/qa/src/main/resources/supply-server.yaml deleted file mode 100644 index 0fb2bbe..0000000 --- a/service/run-config/qa/src/main/resources/supply-server.yaml +++ /dev/null @@ -1,154 +0,0 @@ -authRealm: tcjwt -authDomain: topcoder-qa.com - -memberProgramEventId: 18 - -# Resources -resources: - - com.appirio.service.resourcefactory.AggregateScoresFactory - - com.appirio.service.resourcefactory.PeerReviewFactory - - com.appirio.service.resourcefactory.ReviewFactory - - com.appirio.service.resourcefactory.CopilotFeedbackFactory - - com.appirio.service.resourcefactory.ReviewItemFactory - - com.appirio.service.resourcefactory.ScorecardFactory - - com.appirio.service.resourcefactory.ScorecardQuestionFactory - -eventStrategies: - VERIFY_USER_EMAIL: com.appirio.service.notifications.strategy.VerifyUserEmailStrategy - -# Database settings. - -databases: - - - datasourceName: oltp - - # the name of your JDBC driver - driverClass: com.informix.jdbc.IfxDriver - - # the username - user: coder - - # the password - # NOTE: password is set as a java system property: i.e., -Ddw.database.password= - - validationQuery: select 1 from systables - - # the JDBC URL - url: jdbc:informix-sqli://10.20.94.50:2020/tcs_catalog:INFORMIXSERVER=informixoltp_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1; - - # the minimum number of connections to keep open - minSize: 2 - - # the maximum number of connections to keep open - maxSize: 10 - - # the minimum amount of time an connection must sit idle in the pool before it is eligible for eviction - minIdleTime: 5 minutes - - - datasourceName: dw - - # the name of your JDBC driver - driverClass: com.informix.jdbc.IfxDriver - - # the username - user: coder - - # the password - # NOTE: password is set as a java system property: i.e., -Ddw.database.password= - - validationQuery: select 1 from systables - - # the JDBC URL - url: jdbc:informix-sqli://10.20.94.51:2020/topcoder_dw:INFORMIXSERVER=datawarehouse_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1; - - # the minimum number of connections to keep open - minSize: 2 - - # the maximum number of connections to keep open - maxSize: 10 - - # the minimum amount of time an connection must sit idle in the pool before it is eligible for eviction - minIdleTime: 5 minutes - -# use the simple server factory if you only want to run on a single port -#server: -# type: simple -# connector: -# type: http -# port: 8080 - -server: -# softNofileLimit: 1000 -# hardNofileLimit: 1000 - applicationConnectors: - - type: http - port: 8080 -# - type: https -# port: 8443 -# keyStorePath: example.keystore -# keyStorePassword: example -# validateCerts: false -# this requires the alpn-boot library on the JVM's boot classpath -# - type: spdy3 -# port: 8445 -# keyStorePath: example.keystore -# keyStorePassword: example -# validateCerts: false - adminConnectors: - - type: http - port: 8081 -# - type: https -# port: 8444 -# keyStorePath: example.keystore -# keyStorePassword: example -# validateCerts: false - -# ElasticSearch settings. -esConfiguration: - - servers: - - localhost:11300 - - clusterName: topcoder - - nodeClient: false - - settings: - node.name: elasticsearch01 - -# Logging settings. -logging: - - # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL. - level: INFO - - # Logger-specific levels. - loggers: - - # Sets the level for 'com.example.app' to DEBUG. - com.appirio: DEBUG - - org.hibernate.SQL: ALL - - appenders: - - type: console - target: stdout - threshold: ALL - timeZone: UTC - - - type: file - currentLogFilename: /var/log/ap-review.log - threshold: ALL - archive: true - archivedLogFilenamePattern: /var/log/ap-review-%d.log - archivedFileCount: 5 - timeZone: UTC - logFormat: "%-5level [%d{yyyy-dd-mm HH:mm:ss.SSS}] [%thread] %logger - %msg%n" - -authScheme: v3 - -# File service domain -fileServiceDomain: api.topcoder-qa.com - -# Api version -apiVersion: v3 \ No newline at end of file diff --git a/service/src/main/java/com/appirio/service/resourcefactory/AggregateScoresFactory.java b/service/src/main/java/com/appirio/service/resourcefactory/AggregateScoresFactory.java index a844389..d48be65 100644 --- a/service/src/main/java/com/appirio/service/resourcefactory/AggregateScoresFactory.java +++ b/service/src/main/java/com/appirio/service/resourcefactory/AggregateScoresFactory.java @@ -2,10 +2,10 @@ import io.dropwizard.setup.Environment; +import com.appirio.service.review.ReviewServiceConfiguration; import com.appirio.service.review.manager.ScoreManager; import com.appirio.service.review.resources.AggregateScoresResource; import com.appirio.service.supply.resources.ResourceFactory; -import com.appirio.service.supply.resources.SupplyServerConfiguration; import com.appirio.supply.SupplyException; /** @@ -16,9 +16,9 @@ public class AggregateScoresFactory implements ResourceFactory { /** - * Supply server configuration + * Review service configuration */ - private SupplyServerConfiguration config; + private ReviewServiceConfiguration config; /** * Dropwizard environment @@ -26,11 +26,11 @@ public class AggregateScoresFactory implements ResourceFactory { /** - * Supply server configuration + * Review service configuration */ - private SupplyServerConfiguration config; + private ReviewServiceConfiguration config; /** * Dropwizard environment @@ -25,11 +25,11 @@ public class CopilotFeedbackFactory implements ResourceFactory { /** - * Supply server configuration + * Review service configuration */ - private SupplyServerConfiguration config; + private ReviewServiceConfiguration config; /** * Dropwizard environment @@ -26,11 +26,11 @@ public class PeerReviewFactory implements ResourceFactory { private Environment env; /** - * Simple constructor to initialize Supply server configuration and environment - * @param config configuration for the supply + * Simple constructor to initialize Review service configuration and environment + * @param config configuration for the review service * @param env environment for dropwizard */ - public PeerReviewFactory(SupplyServerConfiguration config, Environment env) { + public PeerReviewFactory(ReviewServiceConfiguration config, Environment env) { this.config = config; this.env = env; } diff --git a/service/src/main/java/com/appirio/service/resourcefactory/ReviewFactory.java b/service/src/main/java/com/appirio/service/resourcefactory/ReviewFactory.java index 674e881..9abab88 100644 --- a/service/src/main/java/com/appirio/service/resourcefactory/ReviewFactory.java +++ b/service/src/main/java/com/appirio/service/resourcefactory/ReviewFactory.java @@ -2,10 +2,10 @@ import io.dropwizard.setup.Environment; +import com.appirio.service.review.ReviewServiceConfiguration; import com.appirio.service.review.manager.ReviewManager; import com.appirio.service.review.resources.ReviewResource; import com.appirio.service.supply.resources.ResourceFactory; -import com.appirio.service.supply.resources.SupplyServerConfiguration; import com.appirio.supply.SupplyException; /** @@ -16,9 +16,9 @@ public class ReviewFactory implements ResourceFactory { /** - * Supply server configuration + * Review service configuration */ - private SupplyServerConfiguration config; + private ReviewServiceConfiguration config; /** * Dropwizard environment @@ -26,11 +26,11 @@ public class ReviewFactory implements ResourceFactory { private Environment env; /** - * Simple constructor to initialize Supply server configuration and environment - * @param config configuration for the supply + * Simple constructor to initialize Review service configuration and environment + * @param config configuration for the review service * @param env environment for dropwizard */ - public ReviewFactory(SupplyServerConfiguration config, Environment env) { + public ReviewFactory(ReviewServiceConfiguration config, Environment env) { this.config = config; this.env = env; } diff --git a/service/src/main/java/com/appirio/service/resourcefactory/ReviewItemFactory.java b/service/src/main/java/com/appirio/service/resourcefactory/ReviewItemFactory.java index 3c7f2aa..e1cc6ec 100644 --- a/service/src/main/java/com/appirio/service/resourcefactory/ReviewItemFactory.java +++ b/service/src/main/java/com/appirio/service/resourcefactory/ReviewItemFactory.java @@ -2,11 +2,11 @@ import io.dropwizard.setup.Environment; +import com.appirio.service.review.ReviewServiceConfiguration; import com.appirio.service.review.manager.ReviewItemManager; import com.appirio.service.review.manager.ScoreManager; import com.appirio.service.review.resources.ReviewItemResource; import com.appirio.service.supply.resources.ResourceFactory; -import com.appirio.service.supply.resources.SupplyServerConfiguration; import com.appirio.supply.SupplyException; /** @@ -17,9 +17,9 @@ public class ReviewItemFactory implements ResourceFactory { /** - * Supply server configuration + * Review service configuration */ - private SupplyServerConfiguration config; + private ReviewServiceConfiguration config; /** * Dropwizard environment @@ -27,11 +27,11 @@ public class ReviewItemFactory implements ResourceFactory { private Environment env; /** - * Simple constructor to initialize Supply server configuration and environment - * @param config configuration for the supply + * Simple constructor to initialize Review service configuration and environment + * @param config configuration for the review service * @param env enivronment for dropwizard */ - public ReviewItemFactory(SupplyServerConfiguration config, Environment env) { + public ReviewItemFactory(ReviewServiceConfiguration config, Environment env) { this.config = config; this.env = env; } diff --git a/service/src/main/java/com/appirio/service/resourcefactory/ScorecardFactory.java b/service/src/main/java/com/appirio/service/resourcefactory/ScorecardFactory.java index 1317f81..ab4c961 100644 --- a/service/src/main/java/com/appirio/service/resourcefactory/ScorecardFactory.java +++ b/service/src/main/java/com/appirio/service/resourcefactory/ScorecardFactory.java @@ -2,10 +2,10 @@ import io.dropwizard.setup.Environment; +import com.appirio.service.review.ReviewServiceConfiguration; import com.appirio.service.review.manager.ScorecardManager; import com.appirio.service.review.resources.ScorecardResource; import com.appirio.service.supply.resources.ResourceFactory; -import com.appirio.service.supply.resources.SupplyServerConfiguration; import com.appirio.supply.SupplyException; /** @@ -16,9 +16,9 @@ public class ScorecardFactory implements ResourceFactory { /** - * Supply server configuration + * Review service configuration */ - private SupplyServerConfiguration config; + private ReviewServiceConfiguration config; /** * Dropwizard environment @@ -26,11 +26,11 @@ public class ScorecardFactory implements ResourceFactory { private Environment env; /** - * Simple constructor to initialize Supply server configuration and environment - * @param config configuration for the supply server + * Simple constructor to initialize Review service configuration and environment + * @param config configuration for the review service * @param env environment for dropwizard */ - public ScorecardFactory(SupplyServerConfiguration config, Environment env) { + public ScorecardFactory(ReviewServiceConfiguration config, Environment env) { this.config = config; this.env = env; } diff --git a/service/src/main/java/com/appirio/service/resourcefactory/ScorecardQuestionFactory.java b/service/src/main/java/com/appirio/service/resourcefactory/ScorecardQuestionFactory.java index 1ceb9eb..d238847 100644 --- a/service/src/main/java/com/appirio/service/resourcefactory/ScorecardQuestionFactory.java +++ b/service/src/main/java/com/appirio/service/resourcefactory/ScorecardQuestionFactory.java @@ -2,10 +2,10 @@ import io.dropwizard.setup.Environment; +import com.appirio.service.review.ReviewServiceConfiguration; import com.appirio.service.review.manager.ScorecardQuestionManager; import com.appirio.service.review.resources.ScorecardQuestionResource; import com.appirio.service.supply.resources.ResourceFactory; -import com.appirio.service.supply.resources.SupplyServerConfiguration; import com.appirio.supply.SupplyException; /** @@ -16,9 +16,9 @@ public class ScorecardQuestionFactory implements ResourceFactory { /** - * Supply server configuration + * Review service configuration */ - private SupplyServerConfiguration config; + private ReviewServiceConfiguration config; /** * Dropwizard environment @@ -26,11 +26,11 @@ public class ScorecardQuestionFactory implements ResourceFactory { + + /** + * @see APIApplication + */ + @Override + public String getName() { + return "Review"; + } + + /** + * @see BaseApplication + * @param config ReviewServiceConfiguration + * @param env Environment + */ + @Override + protected void prepare(ReviewServiceConfiguration config, Environment env) throws Exception { + configDatabases(config, config.getDatabases(), env); + } + + /** + * @see BaseApplication + * @param config ReviewServiceConfiguration + */ + @Override + protected void logServiceSpecificConfigs(ReviewServiceConfiguration config) { + for(SupplyDatasourceFactory dbConfig : config.getDatabases()) { + logger.info("\tJDBI configuration "); + logger.info("\t\tDatabase config name : " + dbConfig.getDatasourceName()); + logger.info("\t\tOLTP driver class : " + dbConfig.getDriverClass()); + logger.info("\t\tOLTP connection URL : " + dbConfig.getUrl()); + logger.info("\t\tOLTP Authentication user : " + dbConfig.getUser()); + } + + logger.info("\r\n"); + } + + /** + * @see BaseApplication + * @param config ReviewServiceConfiguration + * @param env Environment + */ + @Override + protected void registerResources(ReviewServiceConfiguration config, Environment env) throws Exception { + // Register resources here + env.jersey().register(new AggregateScoresFactory(config, env).getResourceInstance()); + env.jersey().register(new CopilotFeedbackFactory(config, env).getResourceInstance()); + env.jersey().register(new PeerReviewFactory(config, env).getResourceInstance()); + env.jersey().register(new ReviewFactory(config, env).getResourceInstance()); + env.jersey().register(new ReviewItemFactory(config, env).getResourceInstance()); + env.jersey().register(new ScorecardFactory(config, env).getResourceInstance()); + env.jersey().register(new ScorecardQuestionFactory(config, env).getResourceInstance()); + } + + /** + * Application entrypoint. See dropwizard and jetty documentation for more details + * + * @param args arguments to main + * @throws Exception Generic exception + */ + public static void main(String[] args) throws Exception { + new ReviewServiceApplication().run(args); + } + +} diff --git a/service/src/main/java/com/appirio/service/review/ReviewServiceConfiguration.java b/service/src/main/java/com/appirio/service/review/ReviewServiceConfiguration.java new file mode 100644 index 0000000..6d1e7aa --- /dev/null +++ b/service/src/main/java/com/appirio/service/review/ReviewServiceConfiguration.java @@ -0,0 +1,37 @@ +package com.appirio.service.review; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import com.appirio.service.BaseAppConfiguration; +import com.appirio.service.supply.resources.SupplyDatasourceFactory; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Configuration for the review service + * + * @author TCDEVELOPER + * + */ +public class ReviewServiceConfiguration extends BaseAppConfiguration { + + /** + * Datasources + */ + @Valid + @NotNull + @JsonProperty + private List databases = new ArrayList(); + + /** + * Get the data source factory + * + * @return Data source factory + */ + public List getDatabases() { + return databases; + } + +} diff --git a/service/src/main/resources/new-relic-url-patterns b/service/src/main/resources/new-relic-url-patterns new file mode 100644 index 0000000..5711892 --- /dev/null +++ b/service/src/main/resources/new-relic-url-patterns @@ -0,0 +1,11 @@ +PUT reviews\/.*\/aggregateScores\/ +GET feedbacks\/copilots\/.*\/ +PUT reviews\/.*\/assignNextReview\/ +GET reviews\/ +GET reviews\/.*\/ +PUT reviews\/.*\/ +GET reviewItems\/ +POST reviewItems\/ +PUT reviewItems\/ +GET scorecards\/ +GET scorecardQuestions\/ \ No newline at end of file diff --git a/service/run-config/dev/src/main/resources/supply-server.yaml b/service/src/main/resources/review-service.yaml similarity index 71% rename from service/run-config/dev/src/main/resources/supply-server.yaml rename to service/src/main/resources/review-service.yaml index 9339089..9a56bb6 100644 --- a/service/run-config/dev/src/main/resources/supply-server.yaml +++ b/service/src/main/resources/review-service.yaml @@ -1,21 +1,6 @@ authRealm: tcjwt authDomain: topcoder-dev.com -memberProgramEventId: 18 - -# Resources -resources: - - com.appirio.service.resourcefactory.AggregateScoresFactory - - com.appirio.service.resourcefactory.PeerReviewFactory - - com.appirio.service.resourcefactory.ReviewFactory - - com.appirio.service.resourcefactory.CopilotFeedbackFactory - - com.appirio.service.resourcefactory.ReviewItemFactory - - com.appirio.service.resourcefactory.ScorecardFactory - - com.appirio.service.resourcefactory.ScorecardQuestionFactory - -eventStrategies: - VERIFY_USER_EMAIL: com.appirio.service.notifications.strategy.VerifyUserEmailStrategy - # Database settings. databases: @@ -34,7 +19,7 @@ databases: validationQuery: select 1 from systables # the JDBC URL - url: jdbc:informix-sqli://10.15.94.50:2020/tcs_catalog:INFORMIXSERVER=informixoltp_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1; + url: jdbc:informix-sqli://localhost:2021/tcs_catalog:INFORMIXSERVER=informixoltp_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1; # the minimum number of connections to keep open minSize: 2 @@ -59,7 +44,7 @@ databases: validationQuery: select 1 from systables # the JDBC URL - url: jdbc:informix-sqli://10.15.94.51:2020/topcoder_dw:INFORMIXSERVER=datawarehouse_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1; + url: jdbc:informix-sqli://localhost:2021/topcoder_dw:INFORMIXSERVER=informixoltp_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1; # the minimum number of connections to keep open minSize: 2 @@ -104,19 +89,6 @@ server: # keyStorePassword: example # validateCerts: false -# ElasticSearch settings. -esConfiguration: - - servers: - - localhost:11300 - - clusterName: topcoder - - nodeClient: false - - settings: - node.name: elasticsearch01 - # Logging settings. logging: @@ -148,8 +120,5 @@ logging: authScheme: v3 -# File service domain -fileServiceDomain: api.topcoder-dev.com - # Api version apiVersion: v3