Commit 8f02b998 authored by aray's avatar aray

initial commit

parent 743ebb0f
Pipeline #2888 failed
FROM openjdk:8-jre-alpine
ADD /target/demo-0.0.1-SNAPSHOT.jar //
ENTRYPOINT ["java", "-jar", "/demo-0.0.1-SNAPSHOT.jar"]
FROM openjdk:8-alpine
ADD /target/playground-assessment-demo-0.0.1-SNAPSHOT.jar //
ENTRYPOINT ["java", "-jar", "/playground-assessment-demo-0.0.1-SNAPSHOT.jar"]
version: '3.3'
services:
PlaygroundAssessmentDemo:
image: playground-assessment-demo
container_name: playground-assessment-demo
build: .
ports:
- "1099:1099"
\ No newline at end of file
......@@ -9,23 +9,30 @@
<version>2.0.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.altimetrik</groupId>
<artifactId>demo</artifactId>
<artifactId>playground-assessment-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>articles</name>
<description>Demo project for Spring Boot</description>
<name>PlaygroundAssessmentDemo</name>
<description>PlaygroundAssessmentDemo</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
......@@ -41,10 +48,7 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Swagger based Dependencies -->
<dependency>
<groupId>io.swagger</groupId>
......
package com.altimetrik.ee.demo.controller;
public class Default {
}
package com.altimetrik;
package com.altimetrik.playground.candidate.assessment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication
@EnableAsync
public class Application {
@Slf4j
public class PlaygroundAssessmentDemoApplication {
public static void main(String[] args) {
System.out.println("App started...miami demo - day 2 Welcome to Articles Publishing Service.");
SpringApplication.run(Application.class, args);
SpringApplication.run(PlaygroundAssessmentDemoApplication.class, args);
log.info("PlaygroundCandidateDemo app has been started successfully ...");
}
}
package com.altimetrik.ee.demo.config;
package com.altimetrik.playground.candidate.assessment.config;
import static springfox.documentation.builders.PathSelectors.regex;
import java.util.Collections;
......@@ -14,30 +13,26 @@ import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
*
* @author MMelavanki
*
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
// Production closes swagger
private boolean enableSwagger=true;
@Bean
public Docket productApi() {
private boolean enableSwagger=true;
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.altimetrik.controllers")).paths(regex("/.*")).build()
.enable(enableSwagger).apiInfo(metaData());
}
return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.altimetrik.controllers")).paths(regex("/.*")).build()
.enable(enableSwagger).apiInfo(metaData());
}
private ApiInfo metaData() {
private ApiInfo metaData() {
return new ApiInfo("Playground Application", "Playground API Services", "2.0",
"https://www.altimetrik.com/privacy-policy/", new Contact("Playground", "https://playground.altimetrik.com", "pg-mgr1@altimetrik.com"),
"Apache License Version 2.0", "https://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList());
}
return new ApiInfo("Playground Candidate Assessment Demo", "Playground API Services", "2.0",
"https://www.altimetrik.com/privacy-policy/", new Contact("Playground", "https://playground.altimetrik.com", "pg-mgr1@altimetrik.com"),
"Apache License Version 2.0", "https://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList());
}
}
package com.altimetrik.playground.candidate.assessment.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/")
@CrossOrigin
public class AdminDbConsoleController {
@Value("${k8s.db.env}")
private String deploymentEnv;
@GetMapping(value = "/", produces = {"text/html"}, consumes = MediaType.ALL_VALUE)
public ResponseEntity<String> getUserDetailByGitlabEmailId() {
String data = "Welcome to Playground Engineering Environment";
if (deploymentEnv != null && !deploymentEnv.isEmpty()) {
data = "<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "<title>Playground Engineering Environment</title>\n"
+ "<style>\n" + "body {\n" + " background-color: white;\n" + " text-align: center;\n"
+ " color: black;\n" + "}\n" + "table {\n" + " align: center;\n"
+ " border-collapse: collapse;\n" + " width: 65%;\n" + "}\n" + "td, th {\n"
+ " border: 1px solid #dddddd;\n" + " padding: 8px;\n" + "}\n" + "tr:nth-child(even) {\n"
+ " background-color: #dddddd;\n" + "}\n" + "</style>\n" + "</head>\n" + "<body>\n"
+ "<img src='https://playground.altimetrik.com/assets/img/playground-logo2.svg' alt='Avatar' style='width:200px'>\n"
+ "<h2>Welcome to Playground Engineering Environment</h2>\n" + "<h3>Database access details</h3>\n"
+ "<table align=center>\n" + " <tr>\n" + " <th>DB Admin Console</th>\n" + " <th>JDBC URL</th>\n"
+ " <th>User Name</th>\n" + " <th>Password</th>\n" + " </tr>\n" + " <tr>\n"
+ " <td><a target='_blank' href='https://pgsandbox.altimetrik.com/project1457/project1457/'>https://pgsandbox.altimetrik.com/project1457/project1457/</a></td>\n"
+ " <td>jdbc:h2:file:./src/main/resources/project1457</td>\n" + " <td>playground</td>\n"
+ " <td>password</td>\n" + " </tr>\n" + "</table>\n" + "</body>\n" + "</html>\n";
}
return new ResponseEntity<>(data, HttpStatus.OK);
}
}
spring.h2.console.enabled=true
spring.h2.console.settings.web-allow-others=true
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=playground
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
# temporary data storage
spring.datasource.url = jdbc:h2:file:./src/main/resources/test
k8s.db.env=
server.servlet.contextPath=/
server.port=1099
\ No newline at end of file
# Spring properties
spring:
application:
name: PlaygroundCandidateDemo # Service registers under this name
name: PlaygroundAssessmentDemo
freemarker:
enabled: false # Ignore Eureka dashboard FreeMarker templates
enabled: false
# HTTP Server
server:
port: 1099 # HTTP (Tomcat) port
servlet.contextPath: /
undertow:
accesslog:
undertow:
accesslog:
enabled: true
# Logging configurations
......@@ -24,5 +22,7 @@ logging:
org.springframework.security: INFO
org.hibernate.SQL: WARN
article:
fileName : validator.json
\ No newline at end of file
jasypt:
encryptor:
password: playground
[
{
"id": 1,
"title": "SAMPLE APPLICATION",
"description": "It is a Sample Demo Application",
"tags": [
"JAVA",
"SPRING"
],
"vote": 1,
"createdBy": "ssa3410@altimetrik.com",
"createdDate": "01-12-2018",
"updatedBy": null,
"updatedDate": null
},
{
"id": 2,
"title": "secod APPLICATION",
"description": "It is a Sample Demo Application",
"tags": [
"JAVA",
"SPRING"
],
"vote": 2,
"createdDate": "01-12-2018",
"createdBy": "ssa3410@altimetrik.com",
"updatedDate": null,
"updatedBy": null
},
{
"id": 3,
"title": "secod APPLICATION",
"description": "It is a Sample Demo Application",
"tags": [
"JAVA",
"SPRING"
],
"vote": 0,
"createdDate": "01-12-2018",
"createdBy": "ssa3410@altimetrik.com",
"updatedDate": null,
"updatedBy": null
}
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment