Comments (2)
Some guidance would be helpful, but I've started coding for the Wanderer component. I'm not sure if I'm heading in the right direction.
from agones.
// Wanderer component
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
"time"
)
type Config struct {
// Define configuration struct
}
func main() {
// Define the Agones API endpoint
agonesEndpoint := "http://agones-api.example.com/config"
// Implement logic to trigger configuration changes
for {
// Generate random configuration changes
config := generateRandomConfig()
// Convert configuration to JSON
configJSON, err := json.Marshal(config)
if err != nil {
log.Println("Error marshalling configuration:", err)
continue
}
// Perform configuration change request to Agones API
_, err = http.Post(agonesEndpoint, "application/json", bytes.NewBuffer(configJSON))
if err != nil {
log.Println("Error sending configuration request:", err)
continue
}
log.Println("Configuration change successful:", config)
// Sleep for a defined interval before next configuration change
time.Sleep(30 * time.Minute)
}
}
func generateRandomConfig() Config {
// Implement logic to generate random configuration changes
return Config{}
}
// Producer component
package main
import (
"agones.dev/agones"
"context"
"log"
"time"
)
func main() {
// Initialize Agones SDK client
client, err := agones.NewClient()
if err != nil {
log.Fatal("Error initializing Agones client:", err)
}
// Continuously scale Fleets and allocate GameServers
for {
// Scale Fleets
err := scaleFleets(client)
if err != nil {
log.Println("Error scaling Fleets:", err)
}
// Allocate GameServers
err = allocateGameServers(client)
if err != nil {
log.Println("Error allocating GameServers:", err)
}
// Sleep for a defined interval before next action
time.Sleep(1 * time.Minute)
}
}
func scaleFleets(client *agones.Client) error {
// Implement logic to scale Fleets
return nil
}
func allocateGameServers(client *agones.Client) error {
// Implement logic to allocate GameServers
return nil
}
// Monitor component
package main
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"net/http"
)
func main() {
// Register Prometheus metrics
requestDuration := prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "http_request_duration_seconds",
Help: "HTTP request duration in seconds.",
},
[]string{"handler", "method"},
)
prometheus.MustRegister(requestDuration)
// Define HTTP handler to expose metrics
http.Handle("/metrics", promhttp.Handler())
// Start HTTP server to expose metrics
log.Fatal(http.ListenAndServe(":8080", nil))
}
from agones.
Related Issues (20)
- Kubernetes-Native Service Load Balancer Support for GameServer
- Cron Job to restart the game server in-place
- Release 1.42.0 HOT 1
- Docs: Add Option for Extensions Components to use Host Network and Configure Ports HOT 3
- Update Supported Kubernetes to 1.28, 1.29, 1.30
- Allocator metrics missing in Agones 1.42.0
- Refactor metrics register exporter setup
- Unit test to check if metrics endpoint is scraping metrics
- [Agones Unity SDK] Add instructions to run tests using a Container Image(s) HOT 9
- Move Feature GKEAutopilotExtendedDurationPods to Beta HOT 6
- Migration from pterodactyl to agones | Egg like solution | More real steamserver examples
- Issue with Agones Game Server Connectivity Using Cilium CNI HOT 8
- Fleet autoscaler with "List" policy throws an error if configured with a fleet with no replicas HOT 3
- CORS enabled on ping service
- Upgrade to Golang 1.22.6 HOT 2
- Extend Webhook autoscaler to send fleet metadata with the request HOT 4
- Add chain ID status to fleetautoscaler event logger
- FleetAutoscaler with Counter policy trying to scale Fleet to negative replicas count HOT 2
- Add logging to webhook failure and schedule parsing errors for Schedule/Chain policies
- Game servers are having some delays until getting external IPs from agones SDK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agones.