-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bulk import & start organizing java files from 'triplea/triplea-game'
- Loading branch information
1 parent
64fddbd
commit b1859ac
Showing
360 changed files
with
17,651 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Connect to a locally running database that was started up via docker-compose. | ||
|
||
set -eu | ||
|
||
DB_IP=$(docker inspect \ | ||
--format='{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \ | ||
triplea-database-1) | ||
|
||
export PGPASSWORD=postgres | ||
psql -h "$DB_IP" -U postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
create user lobby_user password 'lobby'; | ||
create database lobby_db owner lobby_user; | ||
|
||
create user error_report_user password 'error_report'; | ||
create database error_report owner error_report_user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
|
||
location / { | ||
proxy_pass http://lobby:8080; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_read_timeout 90; | ||
} | ||
|
||
location /game-connection/ws { | ||
proxy_pass http://lobby:8080; | ||
proxy_http_version 1.1; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
|
||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
} | ||
|
||
location /player-connection/ws { | ||
proxy_pass http://lobby:8080; | ||
proxy_http_version 1.1; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
|
||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
} | ||
|
||
|
||
location /game-support { | ||
proxy_pass http://game-support-server:8080; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_read_timeout 90; | ||
} | ||
|
||
location /maps { | ||
proxy_pass http://maps-server:8080; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_read_timeout 90; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
FROM alpine:latest | ||
|
||
|
||
#FROM openjdk:11-jre-slim-buster | ||
# | ||
#EXPOSE 8080 | ||
#ADD configuration.yml / | ||
#ADD build/libs/triplea-dropwizard-server.jar / | ||
#CMD java -jar triplea-dropwizard-server.jar server /configuration.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# This docker-compose file depends on './gradlew shadowJar' | ||
# | ||
# Launches all of the background servers used by TripleA. | ||
# The main entrypoint to those services is NGINX which | ||
# is listening on localhost:80 | ||
# | ||
version: '3' | ||
services: | ||
database: | ||
image: postgres:10 | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
volumes: | ||
- ./.docker-compose/database/01-init.sql:/docker-entrypoint-initdb.d/01-init.sql | ||
ports: | ||
- "5432:5432" | ||
healthcheck: | ||
test: echo 'select 1' | psql -h localhost -U postgres | grep -q '1 row' | ||
interval: 3s | ||
retries: 10 | ||
timeout: 3s | ||
|
||
lobby: | ||
build: | ||
context: spitfire-server/dropwizard-server/ | ||
dockerfile: Dockerfile | ||
environment: | ||
- DATABASE_USER=lobby_user | ||
- DATABASE_PASSWORD=lobby | ||
- DB_URL=database:5432/lobby_db | ||
ports: | ||
- "8080" | ||
depends_on: | ||
- database | ||
|
||
game-support-server: | ||
build: | ||
context: servers/game-support/server/ | ||
dockerfile: Dockerfile | ||
environment: | ||
- DB_URL=database:5432/lobby_db | ||
ports: | ||
- "8080" | ||
depends_on: | ||
- database | ||
|
||
maps-server: | ||
build: | ||
context: servers/maps/server/ | ||
dockerfile: Dockerfile | ||
environment: | ||
- DB_URL=database:5432/lobby_db | ||
ports: | ||
- "8080" | ||
depends_on: | ||
- database | ||
|
||
nginx: | ||
image: nginx:stable-alpine-perl | ||
volumes: | ||
- ./.docker-compose/nginx/default.conf:/etc/nginx/conf.d/default.conf | ||
ports: | ||
- "80:80" | ||
links: | ||
- game-support-server | ||
- maps-server | ||
- lobby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
plugins { | ||
id "java" | ||
} | ||
|
||
dependencies { | ||
implementation "io.github.openfeign:feign-core:13.2.1" | ||
implementation "io.github.openfeign:feign-gson:13.2.1" | ||
// implementation project(":lib:feign-common") | ||
// implementation project(":lib:java-extras") | ||
testImplementation "ru.lanwen.wiremock:wiremock-junit5:1.3.1" | ||
testImplementation "com.github.tomakehurst:wiremock:1.3.1" | ||
// testImplementation project(":lib:test-common") | ||
} |
42 changes: 42 additions & 0 deletions
42
...lients/github-client/src/main/java/org/triplea/http/client/github/BranchInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.triplea.http.client.github; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import java.time.Instant; | ||
import lombok.AllArgsConstructor; | ||
import lombok.ToString; | ||
|
||
/** | ||
* Represents the data returned by github API for their 'branches' endpoint. This class Presents a | ||
* simplified interface for what is otherwise a JSON response. | ||
*/ | ||
@ToString | ||
@AllArgsConstructor | ||
public class BranchInfoResponse { | ||
@SerializedName("commit") | ||
private final LastCommit lastCommit; | ||
|
||
/** Returns the date of the last commit. */ | ||
public Instant getLastCommitDate() { | ||
return Instant.parse(lastCommit.commit.commitDetails.date); | ||
} | ||
|
||
@ToString | ||
@AllArgsConstructor | ||
private static class LastCommit { | ||
|
||
private final Commit commit; | ||
|
||
@ToString | ||
@AllArgsConstructor | ||
private static class Commit { | ||
@SerializedName("author") | ||
private final CommitDetails commitDetails; | ||
|
||
@ToString | ||
@AllArgsConstructor | ||
private static class CommitDetails { | ||
private final String date; | ||
} | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...lients/github-client/src/main/java/org/triplea/http/client/github/CreateIssueRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.triplea.http.client.github; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
import org.triplea.http.client.HttpClientConstants; | ||
import org.triplea.java.StringUtils; | ||
|
||
/** Represents request data to create a github issue. */ | ||
@ToString | ||
@EqualsAndHashCode | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class CreateIssueRequest { | ||
private String title; | ||
private String body; | ||
private String[] labels; | ||
|
||
public String getTitle() { | ||
return title == null ? null : StringUtils.truncate(title, HttpClientConstants.TITLE_MAX_LENGTH); | ||
} | ||
|
||
public String getBody() { | ||
return body == null | ||
? null | ||
: StringUtils.truncate(body, HttpClientConstants.REPORT_BODY_MAX_LENGTH); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ients/github-client/src/main/java/org/triplea/http/client/github/CreateIssueResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.triplea.http.client.github; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
/** Response JSON object from github after we create a new issue. */ | ||
@ToString | ||
@AllArgsConstructor | ||
@Getter | ||
public class CreateIssueResponse { | ||
@SerializedName("html_url") | ||
private final String htmlUrl; | ||
} |
Oops, something went wrong.