mirror of
https://github.com/OpenLiberty/liberty-bikes.git
synced 2024-11-27 01:20:01 +08:00
Changes required to run images on CodeEngine
This commit is contained in:
parent
acfe6a2d42
commit
2e6152d6c8
@ -113,8 +113,10 @@ public class GameMetrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void decPlayerCount() {
|
public void decPlayerCount() {
|
||||||
|
if (totalCurrentPlayers > 0) {
|
||||||
totalCurrentPlayers = getCurrentPlayerCount() - 1;
|
totalCurrentPlayers = getCurrentPlayerCount() - 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void incMobilePlayerCount() {
|
public void incMobilePlayerCount() {
|
||||||
totalCurrentMobilePlayers = getMobilePlayerCount() + 1;
|
totalCurrentMobilePlayers = getMobilePlayerCount() + 1;
|
||||||
|
@ -32,11 +32,12 @@ public class Party {
|
|||||||
GameMetrics gameMetrics;
|
GameMetrics gameMetrics;
|
||||||
|
|
||||||
public final String id;
|
public final String id;
|
||||||
private final PartyQueue queue = new PartyQueue(this, gameMetrics);
|
private PartyQueue queue = null;
|
||||||
private volatile GameRound currentRound;
|
private volatile GameRound currentRound;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void postConstruct() {
|
public void postConstruct() {
|
||||||
|
queue = new PartyQueue(this, gameMetrics);
|
||||||
gameMetrics.incCurrentPartiesCounter();
|
gameMetrics.incCurrentPartiesCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,10 +51,16 @@ public class GameRoundWebsocket {
|
|||||||
@OnOpen
|
@OnOpen
|
||||||
public void onOpen(@PathParam("roundId") String roundId, Session session) {
|
public void onOpen(@PathParam("roundId") String roundId, Session session) {
|
||||||
log(roundId, "Opened a session");
|
log(roundId, "Opened a session");
|
||||||
|
try {
|
||||||
session.setMaxTextMessageBufferSize(1000);
|
session.setMaxTextMessageBufferSize(1000);
|
||||||
|
System.out.println("setMaxTextMessageBufferSize");
|
||||||
session.setMaxBinaryMessageBufferSize(1000);
|
session.setMaxBinaryMessageBufferSize(1000);
|
||||||
|
System.out.println("setMaxBinaryMessageBufferSize");
|
||||||
session.setMaxIdleTimeout(90 * 1000);
|
session.setMaxIdleTimeout(90 * 1000);
|
||||||
//timerContext = GameMetrics.timerStart(GameMetrics.openWebsocketTimerMetadata);
|
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
|
// BUG : org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active contexts for scope type jakarta.enterprise.context.ApplicationScoped
|
||||||
|
@ -12,7 +12,7 @@ import jakarta.ws.rs.core.MediaType;
|
|||||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||||
|
|
||||||
@RegisterRestClient(baseUri = "http://localhost:8081/")
|
@RegisterRestClient(baseUri = "http://player.1ibd03sq8zc5.svc.cluster.local")
|
||||||
@Path("/")
|
@Path("/")
|
||||||
public interface PlayerService {
|
public interface PlayerService {
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@ datasources:
|
|||||||
# <string, required> datasource type. Required
|
# <string, required> datasource type. Required
|
||||||
type: prometheus
|
type: prometheus
|
||||||
# <string, required> access mode. direct or proxy. Required
|
# <string, required> access mode. direct or proxy. Required
|
||||||
access: direct
|
access: proxy
|
||||||
# <int> org id. will default to orgId 1 if not specified
|
# <int> org id. will default to orgId 1 if not specified
|
||||||
orgId: 1
|
orgId: 1
|
||||||
# <string> url
|
# <string> url
|
||||||
url: http://localhost:9090
|
url: http://localhost:9088
|
||||||
# <string> database password, if used
|
# <string> database password, if used
|
||||||
password:
|
password:
|
||||||
# <string> database user, if used
|
# <string> database user, if used
|
||||||
|
@ -18,7 +18,7 @@ datasources:
|
|||||||
# <int> org id. will default to orgId 1 if not specified
|
# <int> org id. will default to orgId 1 if not specified
|
||||||
orgId: 1
|
orgId: 1
|
||||||
# <string> url
|
# <string> url
|
||||||
url: http://prometheus:9090
|
url: http://prometheus:9088
|
||||||
# <string> database password, if used
|
# <string> database password, if used
|
||||||
password:
|
password:
|
||||||
# <string> database user, if used
|
# <string> database user, if used
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
"tableColumn": "",
|
"tableColumn": "",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "application_num_player_logins_total",
|
"expr": "totalPlayerNumberGauge",
|
||||||
"format": "time_series",
|
"format": "time_series",
|
||||||
"instant": true,
|
"instant": true,
|
||||||
"intervalFactor": 1,
|
"intervalFactor": 1,
|
||||||
@ -160,7 +160,7 @@
|
|||||||
"tableColumn": "",
|
"tableColumn": "",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "application_current_num_of_players_current",
|
"expr": "playerNumberGauge",
|
||||||
"format": "time_series",
|
"format": "time_series",
|
||||||
"instant": true,
|
"instant": true,
|
||||||
"intervalFactor": 1,
|
"intervalFactor": 1,
|
||||||
@ -329,7 +329,7 @@
|
|||||||
"tableColumn": "",
|
"tableColumn": "",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "application_current_num_of_players_in_queue_current",
|
"expr": "currentPartiesCounter",
|
||||||
"format": "time_series",
|
"format": "time_series",
|
||||||
"instant": true,
|
"instant": true,
|
||||||
"intervalFactor": 1,
|
"intervalFactor": 1,
|
||||||
@ -411,7 +411,7 @@
|
|||||||
"tableColumn": "",
|
"tableColumn": "",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "application_total_num_of_rounds_current",
|
"expr": "currentRoundNumberCounter",
|
||||||
"format": "time_series",
|
"format": "time_series",
|
||||||
"hide": false,
|
"hide": false,
|
||||||
"instant": true,
|
"instant": true,
|
||||||
@ -473,7 +473,7 @@
|
|||||||
"steppedLine": true,
|
"steppedLine": true,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "base_cpu_systemLoadAverage",
|
"expr": "cpu_systemLoadAverage",
|
||||||
"format": "time_series",
|
"format": "time_series",
|
||||||
"instant": false,
|
"instant": false,
|
||||||
"interval": "5s",
|
"interval": "5s",
|
||||||
@ -625,7 +625,7 @@
|
|||||||
"steppedLine": true,
|
"steppedLine": true,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "base_memory_usedHeap_bytes",
|
"expr": "memory_usedHeap_bytes",
|
||||||
"format": "time_series",
|
"format": "time_series",
|
||||||
"intervalFactor": 1,
|
"intervalFactor": 1,
|
||||||
"legendFormat": "{{job}}",
|
"legendFormat": "{{job}}",
|
||||||
|
@ -9,23 +9,23 @@ scrape_configs:
|
|||||||
scrape_interval: 5s
|
scrape_interval: 5s
|
||||||
metrics_path: '/metrics/'
|
metrics_path: '/metrics/'
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['game:8080']
|
- targets: ['game.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud']
|
||||||
scheme: http
|
scheme: https
|
||||||
tls_config:
|
tls_config:
|
||||||
insecure_skip_verify: true
|
insecure_skip_verify: true
|
||||||
- job_name: 'player-service'
|
- job_name: 'player-service'
|
||||||
scrape_interval: 5s
|
scrape_interval: 5s
|
||||||
metrics_path: '/metrics/'
|
metrics_path: '/metrics/'
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['player:8081']
|
- targets: ['player.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud']
|
||||||
scheme: http
|
scheme: https
|
||||||
tls_config:
|
tls_config:
|
||||||
insecure_skip_verify: true
|
insecure_skip_verify: true
|
||||||
- job_name: 'auth-service'
|
- job_name: 'demo-failing-service'
|
||||||
scrape_interval: 5s
|
scrape_interval: 5s
|
||||||
metrics_path: '/metrics/'
|
metrics_path: '/metrics/'
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['auth:8082']
|
- targets: ['127.0.0.1:8082']
|
||||||
scheme: http
|
scheme: http
|
||||||
tls_config:
|
tls_config:
|
||||||
insecure_skip_verify: true
|
insecure_skip_verify: true
|
||||||
@ -33,7 +33,7 @@ scrape_configs:
|
|||||||
scrape_interval: 5s
|
scrape_interval: 5s
|
||||||
metrics_path: '/metrics/'
|
metrics_path: '/metrics/'
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['frontend:12000']
|
- targets: ['frontend.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud']
|
||||||
scheme: http
|
scheme: https
|
||||||
tls_config:
|
tls_config:
|
||||||
insecure_skip_verify: true
|
insecure_skip_verify: true
|
@ -8,26 +8,27 @@ mkdir -p $PROM_LOCAL_CONFIG
|
|||||||
rm $PROM_LOCAL_CONFIG/prometheus.yml 2> /dev/null
|
rm $PROM_LOCAL_CONFIG/prometheus.yml 2> /dev/null
|
||||||
echo "Building local config file prometheus config at: $PROM_LOCAL_CONFIG"
|
echo "Building local config file prometheus config at: $PROM_LOCAL_CONFIG"
|
||||||
sed \
|
sed \
|
||||||
-e "s/'game:/'$LOCAL_HOST:/g" \
|
-e 's/'game:/'game.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud/g' \
|
||||||
-e "s/'player:/'$LOCAL_HOST:/g" \
|
-e 's/'player:/'player.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud/g' \
|
||||||
-e "s/'auth:/'$LOCAL_HOST:/g" \
|
-e 's/'auth:/'127.0.0.1:/g' \
|
||||||
-e "s/'frontend:/'$LOCAL_HOST:/g" \
|
-e 's/'frontend:/'frontend.1ibd03sq8zc5.eu-gb.codeengine.appdomain.cloud/g' \
|
||||||
monitoring/prometheus/prometheus.yml > \
|
monitoring/prometheus/prometheus.yml > \
|
||||||
$PROM_LOCAL_CONFIG/prometheus.yml
|
$PROM_LOCAL_CONFIG/prometheus.yml
|
||||||
|
|
||||||
echo "Starting prometheus"
|
echo "Starting prometheus"
|
||||||
podman stop lb-prometheus 2> /dev/null
|
docker stop lb-prometheus 2> /dev/null
|
||||||
podman run \
|
docker run \
|
||||||
--name lb-prometheus \
|
--name lb-prometheus \
|
||||||
--rm \
|
|
||||||
-d \
|
-d \
|
||||||
-p 9090:9090 \
|
-p 9088:9088 \
|
||||||
|
-l PROMETHEUS_EXPORTER_PORT=9088 \
|
||||||
-v $PROM_LOCAL_CONFIG:/etc/prometheus \
|
-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"
|
echo "Starting grafana"
|
||||||
podman stop lb-grafana 2> /dev/null
|
docker stop lb-grafana 2> /dev/null
|
||||||
podman run \
|
docker run \
|
||||||
--name lb-grafana \
|
--name lb-grafana \
|
||||||
--rm \
|
--rm \
|
||||||
-d \
|
-d \
|
||||||
|
Loading…
Reference in New Issue
Block a user