Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
fd36fd7
add: readme.md
dayyeeet Feb 5, 2024
aa3bd64
fix: grpc kotlin stub
FllipEis Feb 6, 2024
f134a72
Merge remote-tracking branch 'origin/develop' into develop
FllipEis Feb 6, 2024
2e0acd6
feat: add controller backend logic for servers and groups
dayyeeet Feb 11, 2024
ffa2ca1
feat: jooq with schema to java generation
dayyeeet Feb 16, 2024
6e10dd6
refactor: remove redundant code
dayyeeet Feb 16, 2024
72bdf60
feat: add sql structure and actually implement jooq generated files i…
dayyeeet Feb 19, 2024
d0002cd
refactor: change package of jooq codegen, readd composite key
dayyeeet Feb 19, 2024
7ac3c60
feat: database implementation, reformat code
dayyeeet Feb 20, 2024
0cc147e
fix: jooq messages, main class detection, truthful database-config.yml
dayyeeet Feb 20, 2024
98aee66
feat: GroupApi CRUD operations, YamlRepository
dayyeeet Feb 22, 2024
433d81c
feat: add attributes to Group.kt and Server.kt
dayyeeet Feb 25, 2024
0489a84
refactor: types for repositories
dayyeeet Feb 25, 2024
952805c
refactor: cleanup ServerHost.kt definition
dayyeeet Feb 25, 2024
2f1f2ad
refactor: cleanup code
dayyeeet Feb 25, 2024
49c04cd
feat: add property management logic
dayyeeet Feb 25, 2024
11a3c60
feat: add Reconciler
dayyeeet Feb 25, 2024
8f98d19
refactor: update readme.md
dayyeeet Feb 26, 2024
1e60b9c
implement: github packages workflow
dayyeeet Feb 26, 2024
83939a8
fix: run jooqCodegen when building
dayyeeet Feb 26, 2024
3d50c65
fix: build order
dayyeeet Feb 26, 2024
0507ab9
fix: typo in workflow file
dayyeeet Feb 26, 2024
5923662
feat: numerical id inclusion for server starts
dayyeeet Feb 27, 2024
3969fcd
refactor: update controller version
dayyeeet Feb 27, 2024
5f3e83a
refactor: update group types
dayyeeet Mar 10, 2024
f787790
refactor: update group types
dayyeeet Mar 10, 2024
f877534
fix: YamlRepository issues, gRPC connection issues
dayyeeet Mar 10, 2024
7eb1dbb
fix: db issues
dayyeeet Mar 13, 2024
309cea7
fix: add support to mutate properties on Server objects
dayyeeet Mar 13, 2024
8d1054f
impl: add ServerHost on the fly registration and server reattaching
dayyeeet Mar 15, 2024
29214d9
refactor: make ServerHost config serializable
dayyeeet Mar 16, 2024
48ea1f5
impl: ServerHost reattaching
dayyeeet Mar 18, 2024
234cd89
update: readme.md
dayyeeet Mar 18, 2024
005217b
refactor: make port generation a controller task
dayyeeet Mar 22, 2024
1c1a1da
refactor: remove gh-packages
dayyeeet Mar 22, 2024
353f8e6
impl: controller args, numerical id fix
dayyeeet Mar 28, 2024
b919aa7
fix: npe in group config
FllipEis Mar 28, 2024
59eb262
refactor: add prepared state to server
dayyeeet Mar 28, 2024
ec42e7c
refactor: improve reconiler and numerical ids
FllipEis Mar 28, 2024
b86b714
Merge remote-tracking branch 'origin/develop' into develop
FllipEis Mar 28, 2024
4826f7a
fix: server starting
FllipEis Mar 28, 2024
2949401
fix: duplicate database entries
FllipEis Mar 28, 2024
4983097
feat: reconciler is now stopping unused servers
FllipEis Mar 29, 2024
e489225
impl: Server update support
dayyeeet Mar 29, 2024
94688f1
fix: ManagedChannel garbage collection error
dayyeeet Mar 30, 2024
1f463be
fix: numerical ids
FllipEis Mar 31, 2024
ac0b48b
add: max-startup-seconds to default conf
dayyeeet Mar 31, 2024
7d64ecb
add: server types and server type queries
dayyeeet Mar 31, 2024
281c52d
fix: broken grpc calls
dayyeeet Apr 1, 2024
2250c07
refactor: improve group repository
FllipEis Apr 1, 2024
1d51c41
fix: only allow .yml files in yaml directory repository
FllipEis Apr 1, 2024
d39b6ce
refactor: improve start arguments
FllipEis Apr 1, 2024
73e96e9
Merge remote-tracking branch 'origin/develop' into develop
FllipEis Apr 1, 2024
27f1e95
fix: server type import
FllipEis Apr 1, 2024
720de91
fix: database path
FllipEis Apr 1, 2024
7a7c3f6
refactor: clean up
FllipEis Apr 1, 2024
c14bd2b
fix: yaml file saving format
FllipEis Apr 2, 2024
7693c86
refactor: optimize imports
FllipEis Apr 2, 2024
6f93495
refactor: clean up gradle files
FllipEis Apr 2, 2024
e0ae584
feat: codestyles
FllipEis Apr 2, 2024
7daba05
refactor: reformat code
FllipEis Apr 2, 2024
8810f0d
fix: gradle libs version naming
FllipEis Apr 2, 2024
7f289e6
refactor: cleanup annoying log
dayyeeet Apr 2, 2024
57d9384
Merge remote-tracking branch 'origin/develop' into develop
dayyeeet Apr 2, 2024
fed43b9
refactor: cleanup annoying log
dayyeeet Apr 2, 2024
1dd6163
fix: array exceptions
dayyeeet Apr 2, 2024
dd4eaa4
refactor: add cleanup for numerical ids
FllipEis Apr 2, 2024
6e86d3c
Merge remote-tracking branch 'origin/develop' into develop
FllipEis Apr 2, 2024
2c4f528
fix: only log numerical id cleanup if there are unused ids
FllipEis Apr 2, 2024
3c04db3
fix: garbage collection error
dayyeeet Apr 2, 2024
388d1fe
refactor: move proto files to buf
FllipEis Apr 6, 2024
ddf7524
Merge remote-tracking branch 'origin/develop' into develop
FllipEis Apr 6, 2024
9917ad4
refactor: update version to 1.0.20
FllipEis Apr 6, 2024
2b8070e
refactor: move jooq codegen to runtime
FllipEis Apr 6, 2024
4521cd6
feat: grpc config in start arguments and env
FllipEis Apr 6, 2024
cd3c3eb
refactor: some logger improvements
FllipEis Apr 17, 2024
45f881f
impl: velocity secret file, group api crud, cleanup definitions
dayyeeet Apr 18, 2024
d334c25
refactor: improve forwarding secret
FllipEis Apr 20, 2024
c616727
refactor: remove unused resources
dayyeeet Apr 20, 2024
55d345f
refactor: remove arraylist inheritance from repositories
dayyeeet Apr 21, 2024
8029d33
impl: new api methods in buf bump
dayyeeet Apr 21, 2024
5fe6d25
feat: authentication & improve forwarding secret
FllipEis Apr 22, 2024
b95a124
fix: authentication
FllipEis Apr 22, 2024
0408da4
feat: authentication in controller api
FllipEis Apr 22, 2024
13ef965
impl: all grpc methods in controller api
dayyeeet Apr 22, 2024
137eb0d
refactor: reconciler
frederickbaier Apr 22, 2024
e8c2dac
Merge branch 'develop' of https://github.com/theSimpleCloud/simpleclo…
frederickbaier Apr 22, 2024
03d12e1
fix: merge conflicts
frederickbaier Apr 22, 2024
b7f4280
fix: ServerService#getAllServers has not completed the responseObserver
FllipEis Apr 27, 2024
cbbdbab
refactor: improve controller api
FllipEis Apr 28, 2024
57787eb
refactor: resolve requested changes
dayyeeet May 1, 2024
4c5b24b
refactor: add javadoc to group and server api getters
dayyeeet May 1, 2024
8015a52
refactor: remove author comment
dayyeeet May 2, 2024
dda8744
feat: maven central publish
FllipEis May 2, 2024
1fde0a5
refactor: improve ServerHostRepository#find
FllipEis May 2, 2024
9a8dcca
refactor: change return type of LoadableRepository#load to list of el…
FllipEis May 2, 2024
39f669a
fix: make error handling way better
dayyeeet May 2, 2024
52ee5b2
refactor: update javadocs and readme
dayyeeet May 3, 2024
4de9772
update: proto specs
FllipEis May 4, 2024
b1f28cf
Merge remote-tracking branch 'origin/develop' into develop
FllipEis May 4, 2024
13c74b8
feat: adjust reconciler to start new servers based on player ratio
frederickbaier May 4, 2024
2f7a6b2
feat: make new server player ratio optional
frederickbaier May 4, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ bin/
.vscode/

### Mac OS ###
.DS_Store
.DS_Store

run/
10 changes: 10 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 57 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,43 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.shadow)
alias(libs.plugins.sonatypeCentralPortalPublisher)
`maven-publish`
}

allprojects {

group = "app.simplecloud.controller"
version = "1.0-SNAPSHOT"
version = "0.0.27-EXPERIMENTAL"

repositories {
mavenCentral()
maven("https://buf.build/gen/maven")
}
}

subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "net.thebugmc.gradle.sonatype-central-portal-publisher")
apply(plugin = "maven-publish")

dependencies {
testImplementation(rootProject.libs.kotlinTest)
implementation(rootProject.libs.kotlinJvm)
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}

kotlin {
jvmToolchain(17)
}
Expand All @@ -41,4 +57,43 @@ subprojects {
tasks.test {
useJUnitPlatform()
}

centralPortal {
name = project.name

username = project.findProperty("sonatypeUsername") as String
password = project.findProperty("sonatypePassword") as String

pom {
name.set("SimpleCloud controller")
description.set("The heart of SimpleCloud v3")
url.set("https://github.com/theSimpleCloud/simplecloud-controller")

developers {
developer {
id.set("fllipeis")
email.set("p.eistrach@gmail.com")
}
developer {
id.set("dayyeeet")
email.set("david@cappell.net")
}
}
licenses {
license {
name.set("Apache-2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/theSimpleCloud/simplecloud-controller.git")
connection.set("git:git@github.com:theSimpleCloud/simplecloud-controller.git")
}
}
}

signing {
sign(publishing.publications)
useGpgCmd()
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
package app.simplecloud.controller.api

import app.simplecloud.controller.shared.group.Group
import java.util.concurrent.CompletableFuture
import app.simplecloud.controller.api.impl.ControllerApiImpl

interface ControllerApi {

/**
* NOTE: This may be moved to a separate api file.
* @param name the name of the group.
* @returns a [CompletableFuture] with the [Group].
* @return the Controller [GroupApi]
*/
fun getGroupByName(name: String): CompletableFuture<Group>
fun getGroups(): GroupApi

/**
* @return the Controller [ServerApi]
*/
fun getServers(): ServerApi

companion object {

/**
* Creates a new [ControllerApi] instance
* @return the created [ControllerApi]
*/
@JvmStatic
fun create(): ControllerApi {
val authSecret = System.getenv("CONTROLLER_SECRET")
return create(authSecret)
}

/**
* Creates a new [ControllerApi] instance
* @param authSecret the authentication key used by the Controller
* @return the created [ControllerApi]
*/
@JvmStatic
fun create(authSecret: String): ControllerApi {
return ControllerApiImpl(authSecret)
}

}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package app.simplecloud.controller.api

import app.simplecloud.controller.shared.group.Group
import build.buf.gen.simplecloud.controller.v1.ServerType
import java.util.concurrent.CompletableFuture

interface GroupApi {

/**
* @param name the name of the group.
* @return a [CompletableFuture] with the [Group].
*/
fun getGroupByName(name: String): CompletableFuture<Group>

/**
* @param name the name of the group.
* @return the deleted [Group].
*/
fun deleteGroup(name: String): CompletableFuture<Group>

/**
* @param group the [Group] to create.
* @return the created [Group].
*/
fun createGroup(group: Group): CompletableFuture<Group>

/**
* @param group the [Group] to update.
* @return the updated [Group].
*/
fun updateGroup(group: Group): CompletableFuture<Group>
/**
* @return a [CompletableFuture] with a list of all groups.
*/
fun getAllGroups(): CompletableFuture<List<Group>>

/**
* @param type the [ServerType] of the group
* @return a [CompletableFuture] with a list of all groups matching this type.
*/
fun getGroupsByType(type: ServerType): CompletableFuture<List<Group>>

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package app.simplecloud.controller.api

import app.simplecloud.controller.shared.group.Group
import build.buf.gen.simplecloud.controller.v1.ServerType
import app.simplecloud.controller.shared.server.Server
import build.buf.gen.simplecloud.controller.v1.ServerState
import java.util.concurrent.CompletableFuture

interface ServerApi {

/**
* @return a [CompletableFuture] with a [List] of all [Server]s
*/
fun getAllServers(): CompletableFuture<List<Server>>

/**
* @param id the id of the server.
* @return a [CompletableFuture] with the [Server].
*/
fun getServerById(id: String): CompletableFuture<Server>

/**
* @param groupName the name of the server group.
* @return a [CompletableFuture] with a [List] of [Server]s of that group.
*/
fun getServersByGroup(groupName: String): CompletableFuture<List<Server>>

/**
* @param group The server group.
* @return a [CompletableFuture] with a [List] of [Server]s of that group.
*/
fun getServersByGroup(group: Group): CompletableFuture<List<Server>>

/**
* @param type The servers type
* @return a [CompletableFuture] with a [List] of all [Server]s with this type
*/
fun getServersByType(type: ServerType): CompletableFuture<List<Server>>

/**
* @param groupName the group name of the group the new server should be of.
* @return a [CompletableFuture] with a [Server] or null.
*/
fun startServer(groupName: String): CompletableFuture<Server?>

/**
* @param groupName the group name of the servers group.
* @param numericalId the numerical id of the server.
* @return a [CompletableFuture] with the stopped [Server].
*/
fun stopServer(groupName: String, numericalId: Long): CompletableFuture<Server>

/**
* @param id the id of the server.
* @return a [CompletableFuture] with the stopped [Server].
*/
fun stopServer(id: String): CompletableFuture<Server>

/**
* @param id the id of the server.
* @param state the new state of the server.
* @return a [CompletableFuture] with the updated [Server].
*/
fun updateServerState(id: String, state: ServerState): CompletableFuture<Server>

/**
* @param id the id of the server.
* @param key the server property key
* @param value the new property value
* @return a [CompletableFuture] with the updated [Server].
*/
fun updateServerProperty(id: String, key: String, value: Any): CompletableFuture<Server>

}
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
package app.simplecloud.controller.api.impl

import app.simplecloud.controller.api.ControllerApi
import app.simplecloud.controller.shared.future.toCompletable
import app.simplecloud.controller.shared.group.Group
import app.simplecloud.controller.shared.proto.ControllerGroupServiceGrpc
import app.simplecloud.controller.shared.proto.GetGroupByNameRequest
import app.simplecloud.controller.api.GroupApi
import app.simplecloud.controller.api.ServerApi
import app.simplecloud.controller.shared.auth.AuthCallCredentials
import io.grpc.ManagedChannel
import io.grpc.ManagedChannelBuilder
import java.util.concurrent.CompletableFuture

class ControllerApiImpl : ControllerApi {
class ControllerApiImpl(
authSecret: String
): ControllerApi {

private val authCallCredentials = AuthCallCredentials(authSecret)

private val managedChannel = createManagedChannelFromEnv()
private val groups: GroupApi = GroupApiImpl(managedChannel, authCallCredentials)
private val servers: ServerApi = ServerApiImpl(managedChannel, authCallCredentials)

/**
* @return The controllers [GroupApi]
*/
override fun getGroups(): GroupApi {
return groups
}

protected val groupServiceStub: ControllerGroupServiceGrpc.ControllerGroupServiceFutureStub =
ControllerGroupServiceGrpc.newFutureStub(managedChannel)

override fun getGroupByName(name: String): CompletableFuture<Group> {
return groupServiceStub.getGroupByName(
GetGroupByNameRequest.newBuilder()
.setName(name)
.build()
).toCompletable()
.thenApply {
Group.fromDefinition(it.group)
}
/**
* @return The controllers [ServerApi]
*/
override fun getServers(): ServerApi {
return servers
}

private fun createManagedChannelFromEnv(): ManagedChannel {
Expand Down
Loading