Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Api/api-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,6 @@
</executions>
</plugin>
</plugins>
<finalName>opex-accountant</finalName>
<finalName>opex-api</finalName>
</build>
</project>
14 changes: 0 additions & 14 deletions Api/api-app/src/main/kotlin/co/nilin/opex/app/ApiApp.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
package co.nilin.opex.app

import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.security.core.annotation.AuthenticationPrincipal
import springfox.documentation.builders.*
import springfox.documentation.builders.PathSelectors.regex
import springfox.documentation.service.*
import springfox.documentation.spi.DocumentationType
import springfox.documentation.spi.service.contexts.SecurityContext
import springfox.documentation.spring.web.plugins.Docket
import springfox.documentation.swagger.web.SecurityConfiguration
import springfox.documentation.swagger.web.SecurityConfigurationBuilder
import springfox.documentation.swagger2.annotations.EnableSwagger2
import java.security.Principal
import java.util.Collections.singletonList


@SpringBootApplication
@ComponentScan("co.nilin.opex")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class SecurityConfig(private val webClient: WebClient) {
.pathMatchers("/v3/ticker/**").permitAll()
.pathMatchers("/v3/exchangeInfo").permitAll()
.pathMatchers("/v3/klines").permitAll()
.pathMatchers("/socket").permitAll()
.pathMatchers("/**").hasAuthority("SCOPE_trust")
.anyExchange().authenticated()
.and()
Expand Down
48 changes: 36 additions & 12 deletions Deployment/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,21 +306,30 @@ services:
deploy:
restart_policy:
condition: on-failure
nginx:
image: jboesl/docker-nginx-headers-more
container_name: opex_nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- $DATA/www:/data/www
websocket:
container_name: websocket
build:
context: ../Websocket/websocket-app
dockerfile: Dockerfile
ports:
- 80:80
depends_on:
- wallet
- auth
- matching-gateway
- api
- 127.0.0.1:8097:8097
- 127.0.0.1:1054:1044
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044
- SPRING_PROFILES_DEFAULT=docker
- KAFKA_IP_PORT=kafka:9092
- CONSUL_HOST=consul
- DB_IP_PORT=postgres-api
networks:
- opex
depends_on:
- zookeeper
- kafka
- consul
- postgres-api
deploy:
restart_policy:
condition: on-failure
bc-gateway:
container_name: bc-gateway
build:
Expand Down Expand Up @@ -366,6 +375,21 @@ services:
deploy:
restart_policy:
condition: on-failure
nginx:
image: jboesl/docker-nginx-headers-more
container_name: opex_nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- $DATA/www:/data/www
ports:
- 80:80
depends_on:
- wallet
- auth
- matching-gateway
- api
networks:
- opex
networks:
opex:
driver: bridge
9 changes: 9 additions & 0 deletions Deployment/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ http {
server storage:8096;
}

upstream docker-websocket {
server storage:8097;
}

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down Expand Up @@ -70,6 +74,11 @@ http {
rewrite ^/storage/(.*)$ /$1 break;
}

location /stream {
proxy_pass http://docker-websocket;
rewrite ^/stream/(.*)$ /$1 break;
}

location /api {
proxy_pass http://docker-api;
rewrite ^/api(.*)$ $1 break;
Expand Down
4 changes: 4 additions & 0 deletions Jenkins/Jenkinsfile.deploy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ pipeline {
dir("Storage") {
sh 'mvn -B clean install'
}

dir("Websocket") {
sh 'mvn -B clean install'
}
}

}
Expand Down
18 changes: 18 additions & 0 deletions Websocket/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>co.nilin.opex</groupId>
<artifactId>websocket-root</artifactId>
<version>1.0-SNAPSHOT</version>
<name>websocket-root</name>
<packaging>pom</packaging>
<description>Websocket root module</description>
<modules>
<module>websocket-app</module>
<module>websocket-core</module>
<module>websocket-ports/websocket-eventlistener-kafka</module>
<module>websocket-ports/websocket-persister-postgres</module>
</modules>
</project>
33 changes: 33 additions & 0 deletions Websocket/websocket-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
5 changes: 5 additions & 0 deletions Websocket/websocket-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar /app.jar"]
Loading