Changes required to run images on CodeEngine

This commit is contained in:
root 2024-07-03 05:58:53 -07:00
parent acfe6a2d42
commit 2e6152d6c8
10 changed files with 46 additions and 36 deletions

View File

@ -34,7 +34,7 @@ export class SocketService {
constructor() {
this.messageBuffer = [];
}
}
get socketOpen(): boolean {
return this.open;

View File

@ -113,7 +113,9 @@ public class GameMetrics {
}
public void decPlayerCount() {
totalCurrentPlayers = getCurrentPlayerCount() - 1;
if (totalCurrentPlayers > 0) {
totalCurrentPlayers = getCurrentPlayerCount() - 1;
}
}
public void incMobilePlayerCount() {

View File

@ -32,11 +32,12 @@ public class Party {
GameMetrics gameMetrics;
public final String id;
private final PartyQueue queue = new PartyQueue(this, gameMetrics);
private PartyQueue queue = null;
private volatile GameRound currentRound;
@PostConstruct
public void postConstruct() {
queue = new PartyQueue(this, gameMetrics);
gameMetrics.incCurrentPartiesCounter();
}

View File

@ -51,10 +51,16 @@ public class GameRoundWebsocket {
@OnOpen
public void onOpen(@PathParam("roundId") String roundId, Session session) {
log(roundId, "Opened a session");
session.setMaxTextMessageBufferSize(1000);
session.setMaxBinaryMessageBufferSize(1000);
session.setMaxIdleTimeout(90 * 1000);
//timerContext = GameMetrics.timerStart(GameMetrics.openWebsocketTimerMetadata);
try {
session.setMaxTextMessageBufferSize(1000);
System.out.println("setMaxTextMessageBufferSize");
session.setMaxBinaryMessageBufferSize(1000);
System.out.println("setMaxBinaryMessageBufferSize");
session.setMaxIdleTimeout(90 * 1000);
System.out.println("setMaxIdleTimeout");
} catch (Exception e) {
System.out.println("ON OPEN: " + e);
}
}
// BUG : org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active contexts for scope type jakarta.enterprise.context.ApplicationScoped

View File

@ -12,7 +12,7 @@ import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient(baseUri = "http://localhost:8081/")
@RegisterRestClient(baseUri = "http://player.1ibd03sq8zc5.svc.cluster.local")
@Path("/")
public interface PlayerService {

View File

@ -14,11 +14,11 @@ datasources:
# <string, required> datasource type. Required
type: prometheus
# <string, required> access mode. direct or proxy. Required
access: direct
access: proxy
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
url: http://localhost:9090
url: http://localhost:9088
# <string> database password, if used
password:
# <string> database user, if used

View File

@ -18,7 +18,7 @@ datasources:
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
url: http://prometheus:9090
url: http://prometheus:9088
# <string> database password, if used
password:
# <string> database user, if used

View File

@ -79,7 +79,7 @@
"tableColumn": "",
"targets": [
{
"expr": "application_num_player_logins_total",
"expr": "totalPlayerNumberGauge",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
@ -160,7 +160,7 @@
"tableColumn": "",
"targets": [
{
"expr": "application_current_num_of_players_current",
"expr": "playerNumberGauge",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
@ -329,7 +329,7 @@
"tableColumn": "",
"targets": [
{
"expr": "application_current_num_of_players_in_queue_current",
"expr": "currentPartiesCounter",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
@ -411,7 +411,7 @@
"tableColumn": "",
"targets": [
{
"expr": "application_total_num_of_rounds_current",
"expr": "currentRoundNumberCounter",
"format": "time_series",
"hide": false,
"instant": true,
@ -473,7 +473,7 @@
"steppedLine": true,
"targets": [
{
"expr": "base_cpu_systemLoadAverage",
"expr": "cpu_systemLoadAverage",
"format": "time_series",
"instant": false,
"interval": "5s",
@ -625,7 +625,7 @@
"steppedLine": true,
"targets": [
{
"expr": "base_memory_usedHeap_bytes",
"expr": "memory_usedHeap_bytes",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{job}}",

View File

@ -9,23 +9,23 @@ scrape_configs:
scrape_interval: 5s
metrics_path: '/metrics/'
static_configs:
- targets: ['game:8080']
scheme: http
- targets: ['game.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud']
scheme: https
tls_config:
insecure_skip_verify: true
- job_name: 'player-service'
scrape_interval: 5s
metrics_path: '/metrics/'
static_configs:
- targets: ['player:8081']
scheme: http
- targets: ['player.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud']
scheme: https
tls_config:
insecure_skip_verify: true
- job_name: 'auth-service'
- job_name: 'demo-failing-service'
scrape_interval: 5s
metrics_path: '/metrics/'
static_configs:
- targets: ['auth:8082']
- targets: ['127.0.0.1:8082']
scheme: http
tls_config:
insecure_skip_verify: true
@ -33,7 +33,7 @@ scrape_configs:
scrape_interval: 5s
metrics_path: '/metrics/'
static_configs:
- targets: ['frontend:12000']
scheme: http
- targets: ['frontend.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud']
scheme: https
tls_config:
insecure_skip_verify: true

View File

@ -8,26 +8,27 @@ mkdir -p $PROM_LOCAL_CONFIG
rm $PROM_LOCAL_CONFIG/prometheus.yml 2> /dev/null
echo "Building local config file prometheus config at: $PROM_LOCAL_CONFIG"
sed \
-e "s/'game:/'$LOCAL_HOST:/g" \
-e "s/'player:/'$LOCAL_HOST:/g" \
-e "s/'auth:/'$LOCAL_HOST:/g" \
-e "s/'frontend:/'$LOCAL_HOST:/g" \
-e 's/'game:/'game.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud/g' \
-e 's/'player:/'player.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud/g' \
-e 's/'auth:/'127.0.0.1:/g' \
-e 's/'frontend:/'frontend.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud/g' \
monitoring/prometheus/prometheus.yml > \
$PROM_LOCAL_CONFIG/prometheus.yml
echo "Starting prometheus"
podman stop lb-prometheus 2> /dev/null
podman run \
docker stop lb-prometheus 2> /dev/null
docker run \
--name lb-prometheus \
--rm \
-d \
-p 9090:9090 \
-p 9088:9088 \
-l PROMETHEUS_EXPORTER_PORT=9088 \
-v $PROM_LOCAL_CONFIG:/etc/prometheus \
prom/prometheus:v2.52.0
prom/prometheus --config.file=/etc/prometheus/prometheus.yml --web.listen-address=:9088
echo "Starting grafana"
podman stop lb-grafana 2> /dev/null
podman run \
docker stop lb-grafana 2> /dev/null
docker run \
--name lb-grafana \
--rm \
-d \