From cfbe3ed320843f490e75460dd64895551bfee52b Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Fri, 2 Jun 2023 15:34:07 -0500 Subject: [PATCH 1/9] Add Carbon Support Initial Add: Carbon Support for Rust Server. --- Dockerfile | 1 + start_rust.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/Dockerfile b/Dockerfile index 8172f97..46335d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -110,6 +110,7 @@ ENV RUST_UPDATE_BRANCH "public" ENV RUST_START_MODE "0" ENV RUST_OXIDE_ENABLED "0" ENV RUST_OXIDE_UPDATE_ON_BOOT "1" +ENV RUST_CARBON_ENABLED = "0" ENV RUST_RCON_SECURE_WEBSOCKET "0" ENV RUST_SERVER_WORLDSIZE "3500" ENV RUST_SERVER_MAXPLAYERS "500" diff --git a/start_rust.sh b/start_rust.sh index ca757e6..a636af2 100755 --- a/start_rust.sh +++ b/start_rust.sh @@ -117,6 +117,41 @@ if [ "$RUST_OXIDE_ENABLED" = "1" ]; then fi fi +if [ "$RUST_CARBON_ENABLED" = "1" ]; then + CARBON_BASE_URL="https://github.com/CarbonCommunity/Carbon.Core/releases/download/" + INSTALL_CARBON="0" + if [ ! -f "/steamcmd/rust/carbon/managed/Carbon.dll" ]; then + INSTALL_CARBON="1" + fi + + if [ ! -f "/steamcmd/rust/carbon/tools/environment.sh" ]; then + INSTALL_CARBON="1" + fi + + if [ "$INSTALL_CARBON" = "1" ]; then + echo "Downloading and installing latest Carbon.." + case $RUST_BRANCH in + "public") + CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" + ;; + "staging") + CARBON_URL="${CARBON_BASE_URL}rustbeta_staging_build/Carbon.Linux.Debug.tar.gz" + ;; + "aux01") + CARBON_URL="${CARBON_BASE_URL}rustbeta_aux01_build/Carbon.Linux.Debug.tar.gz" + ;; + "aux02") + CARBON_URL="${CARBON_BASE_URL}rustbeta_aux02_build/Carbon.Linux.Debug.tar.gz" + ;; + *) + CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" + ;; + esac + curl -sL $CARBON_URL | bsdtar -xvf- -C /steamcmd/rust/ + chmod 755 /steamcmd/rust/carbon/tools/environment.sh + fi +fi + # Start mode 1 means we only want to update if [ "$RUST_START_MODE" = "1" ]; then echo "Exiting, start mode is 1.." @@ -229,6 +264,10 @@ add_argument_pair ARGUMENTS "+server.maxplayers" "RUST_SERVER_MAXPLAYERS" add_argument_pair ARGUMENTS "+server.saveinterval" "RUST_SERVER_SAVE_INTERVAL" add_argument_pair ARGUMENTS "+app.port" "RUST_APP_PORT" +if [ "$RUST_CARBON_ENABLED" = "1" ]; then + source "/steamcmd/rust/carbon/tools/environment.sh" +fi + if [ "$LOGROTATE_ENABLED" = "1" ]; then unbuffer /steamcmd/rust/RustDedicated $RUST_STARTUP_COMMAND "${ARGUMENTS[@]}" 2>&1 | grep --line-buffered -Ev '^\s*$|Filename' | tee $RUST_SERVER_LOG_FILE & elif [ "$STDLOG_ENABLED" = "1" ]; then From 40d7ace47f28ddc28526b471b47edd879f79e04e Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Fri, 2 Jun 2023 15:51:07 -0500 Subject: [PATCH 2/9] Update Dockerfile Minor fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 46335d8..2937116 100644 --- a/Dockerfile +++ b/Dockerfile @@ -110,7 +110,7 @@ ENV RUST_UPDATE_BRANCH "public" ENV RUST_START_MODE "0" ENV RUST_OXIDE_ENABLED "0" ENV RUST_OXIDE_UPDATE_ON_BOOT "1" -ENV RUST_CARBON_ENABLED = "0" +ENV RUST_CARBON_ENABLED "0" ENV RUST_RCON_SECURE_WEBSOCKET "0" ENV RUST_SERVER_WORLDSIZE "3500" ENV RUST_SERVER_MAXPLAYERS "500" From 188782d91bbf9da01685a0af4db0a080024cc0fa Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Fri, 2 Jun 2023 19:53:16 -0500 Subject: [PATCH 3/9] Safeguard and Auto-Update Ensure that server is safeguarded from having both Oxide and Carbon installed, Also added Update on Boot option for Carbon. --- Dockerfile | 1 + start_rust.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index 2937116..cd580ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -111,6 +111,7 @@ ENV RUST_START_MODE "0" ENV RUST_OXIDE_ENABLED "0" ENV RUST_OXIDE_UPDATE_ON_BOOT "1" ENV RUST_CARBON_ENABLED "0" +ENV RUST_CARBON_UPDATE_ON_BOOT "1" ENV RUST_RCON_SECURE_WEBSOCKET "0" ENV RUST_SERVER_WORLDSIZE "3500" ENV RUST_SERVER_MAXPLAYERS "500" diff --git a/start_rust.sh b/start_rust.sh index a636af2..c9372a9 100755 --- a/start_rust.sh +++ b/start_rust.sh @@ -128,6 +128,10 @@ if [ "$RUST_CARBON_ENABLED" = "1" ]; then INSTALL_CARBON="1" fi + if [ "$RUST_CARBON_UPDATE_ON_BOOT" = "1" ]; then + INSTALL_CARBON="1" + fi + if [ "$INSTALL_CARBON" = "1" ]; then echo "Downloading and installing latest Carbon.." case $RUST_BRANCH in From 67f0801e660696dabd8bdc90f46f8f94276a7a83 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Fri, 2 Jun 2023 20:12:13 -0500 Subject: [PATCH 4/9] Update start_rust.sh Removed Environment.sh check, as we just need to see if Carbon.dll is in it's location. Added check to ensure that we aren't trying to enable both Oxide and Carbon at the same time. --- start_rust.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/start_rust.sh b/start_rust.sh index c9372a9..3304e2e 100755 --- a/start_rust.sh +++ b/start_rust.sh @@ -97,6 +97,12 @@ else fi fi +# Ensure only Oxide or Carbon is selected, not both. +if [ "$RUST_OXIDE_ENABLED" = "1" ] && [ "$RUST_CARBON_ENABLED" = "1" ]; then + echo "You need to select either Carbon or Oxide for your Plugins, can't enable both." + exit 1 +fi + # Check if Oxide is enabled if [ "$RUST_OXIDE_ENABLED" = "1" ]; then # Next check if Oxide doesn't' exist, or if we want to always update it @@ -124,10 +130,6 @@ if [ "$RUST_CARBON_ENABLED" = "1" ]; then INSTALL_CARBON="1" fi - if [ ! -f "/steamcmd/rust/carbon/tools/environment.sh" ]; then - INSTALL_CARBON="1" - fi - if [ "$RUST_CARBON_UPDATE_ON_BOOT" = "1" ]; then INSTALL_CARBON="1" fi From 189f548de538c074bae86954d168f97fe743bab6 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Mon, 5 Jun 2023 23:46:14 -0500 Subject: [PATCH 5/9] Added Carbon Branch For Production Only, Added Carbon Branch for Preview, and Edge. Only compatible with Production Rust, will not work on Staging, AUX01 or AUX02 releases of Rust. --- Dockerfile | 1 + start_rust.sh | 52 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index cd580ad..c8f1ac7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -112,6 +112,7 @@ ENV RUST_OXIDE_ENABLED "0" ENV RUST_OXIDE_UPDATE_ON_BOOT "1" ENV RUST_CARBON_ENABLED "0" ENV RUST_CARBON_UPDATE_ON_BOOT "1" +ENV RUST_CARBON_BRANCH "" ENV RUST_RCON_SECURE_WEBSOCKET "0" ENV RUST_SERVER_WORLDSIZE "3500" ENV RUST_SERVER_MAXPLAYERS "500" diff --git a/start_rust.sh b/start_rust.sh index 3304e2e..9dad4f8 100755 --- a/start_rust.sh +++ b/start_rust.sh @@ -136,23 +136,41 @@ if [ "$RUST_CARBON_ENABLED" = "1" ]; then if [ "$INSTALL_CARBON" = "1" ]; then echo "Downloading and installing latest Carbon.." - case $RUST_BRANCH in - "public") - CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" - ;; - "staging") - CARBON_URL="${CARBON_BASE_URL}rustbeta_staging_build/Carbon.Linux.Debug.tar.gz" - ;; - "aux01") - CARBON_URL="${CARBON_BASE_URL}rustbeta_aux01_build/Carbon.Linux.Debug.tar.gz" - ;; - "aux02") - CARBON_URL="${CARBON_BASE_URL}rustbeta_aux02_build/Carbon.Linux.Debug.tar.gz" - ;; - *) - CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" - ;; - esac + if [ -z ${RUST_CARBON_BUILDx} ]; then + case $RUST_BRANCH in + "preview") + echo "Downloading preview release.." + CARBON_URL="${CARBON_BASE_URL}preview_build/Carbon.Linux.Debug.tar.gz" + ;; + "edge") + echo "Downlaoding edge release.." + CARBON_URL="${CARBON_BASE_URL}edge_build/Carbon.Linux.Debug.tar.gz" + ;; + esac + else + case $RUST_BRANCH in + "public") + echo "Downloading Rust Production Release.." + CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" + ;; + "staging") + echo "Downloading Rust Staging Release.." + CARBON_URL="${CARBON_BASE_URL}rustbeta_staging_build/Carbon.Linux.Debug.tar.gz" + ;; + "aux01") + echo "Downloading Rust AUX01 Release.." + CARBON_URL="${CARBON_BASE_URL}rustbeta_aux01_build/Carbon.Linux.Debug.tar.gz" + ;; + "aux02") + echo "Downloading Rust AUX02 Release.." + CARBON_URL="${CARBON_BASE_URL}rustbeta_aux02_build/Carbon.Linux.Debug.tar.gz" + ;; + *) + echo "Downloading Rust Production Release.." + CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" + ;; + esac + fi curl -sL $CARBON_URL | bsdtar -xvf- -C /steamcmd/rust/ chmod 755 /steamcmd/rust/carbon/tools/environment.sh fi From 4c3703a770ddc66669ca6f8932af6fb9a472751d Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Tue, 6 Jun 2023 00:04:16 -0500 Subject: [PATCH 6/9] Update start_rust.sh Fixed Typos in RUST_CARBON_BUILD --- start_rust.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/start_rust.sh b/start_rust.sh index 9dad4f8..1930b55 100755 --- a/start_rust.sh +++ b/start_rust.sh @@ -136,8 +136,8 @@ if [ "$RUST_CARBON_ENABLED" = "1" ]; then if [ "$INSTALL_CARBON" = "1" ]; then echo "Downloading and installing latest Carbon.." - if [ -z ${RUST_CARBON_BUILDx} ]; then - case $RUST_BRANCH in + if [ ! -z ${RUST_CARBON_BUILD+x} ]; then + case $RUST_CARBON_BUILD in "preview") echo "Downloading preview release.." CARBON_URL="${CARBON_BASE_URL}preview_build/Carbon.Linux.Debug.tar.gz" From 29152cac59b06d69f315f45b36cb2cbbcd28d7c8 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Wed, 14 Jun 2023 14:40:15 -0500 Subject: [PATCH 7/9] Update start_rust.sh Re-worked Logic behind selecting Rust Branch, and Carbon Branch. --- start_rust.sh | 67 ++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/start_rust.sh b/start_rust.sh index 1930b55..a3bd38f 100755 --- a/start_rust.sh +++ b/start_rust.sh @@ -136,41 +136,42 @@ if [ "$RUST_CARBON_ENABLED" = "1" ]; then if [ "$INSTALL_CARBON" = "1" ]; then echo "Downloading and installing latest Carbon.." - if [ ! -z ${RUST_CARBON_BUILD+x} ]; then - case $RUST_CARBON_BUILD in - "preview") - echo "Downloading preview release.." - CARBON_URL="${CARBON_BASE_URL}preview_build/Carbon.Linux.Debug.tar.gz" - ;; - "edge") - echo "Downlaoding edge release.." - CARBON_URL="${CARBON_BASE_URL}edge_build/Carbon.Linux.Debug.tar.gz" - ;; - esac - else - case $RUST_BRANCH in - "public") - echo "Downloading Rust Production Release.." - CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" - ;; - "staging") - echo "Downloading Rust Staging Release.." - CARBON_URL="${CARBON_BASE_URL}rustbeta_staging_build/Carbon.Linux.Debug.tar.gz" - ;; - "aux01") - echo "Downloading Rust AUX01 Release.." - CARBON_URL="${CARBON_BASE_URL}rustbeta_aux01_build/Carbon.Linux.Debug.tar.gz" - ;; - "aux02") - echo "Downloading Rust AUX02 Release.." - CARBON_URL="${CARBON_BASE_URL}rustbeta_aux02_build/Carbon.Linux.Debug.tar.gz" - ;; - *) + + case $RUST_BRANCH in + "staging") + echo "Downloading Rust Staging Release.." + CARBON_URL="${CARBON_BASE_URL}rustbeta_staging_build/Carbon.Linux.Debug.tar.gz" + ;; + "aux01") + echo "Downloading Rust AUX01 Release.." + CARBON_URL="${CARBON_BASE_URL}rustbeta_aux01_build/Carbon.Linux.Debug.tar.gz" + ;; + "aux02") + echo "Downloading Rust AUX02 Release.." + CARBON_URL="${CARBON_BASE_URL}rustbeta_aux02_build/Carbon.Linux.Debug.tar.gz" + ;; + *) + if [ ! -z ${RUST_CARBON_BUILD+x} ]; then + case $RUST_CARBON_BUILD in + "preview") + echo "Downloading preview release.." + CARBON_URL="${CARBON_BASE_URL}preview_build/Carbon.Linux.Debug.tar.gz" + ;; + "edge") + echo "Downlaoding edge release.." + CARBON_URL="${CARBON_BASE_URL}edge_build/Carbon.Linux.Debug.tar.gz" + ;; + *) + echo "Downloading Rust Production Release.." + CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" + ;; + esac + else echo "Downloading Rust Production Release.." CARBON_URL="${CARBON_BASE_URL}production_build/Carbon.Linux.Release.tar.gz" - ;; - esac - fi + fi + ;; + esac curl -sL $CARBON_URL | bsdtar -xvf- -C /steamcmd/rust/ chmod 755 /steamcmd/rust/carbon/tools/environment.sh fi From fae10a42fab9246c54e1fd5f08d180786925cd36 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Wed, 14 Jun 2023 14:55:07 -0500 Subject: [PATCH 8/9] Update start_rust.sh Fixed Mis-named Environment Variable in script, now should properly see it. --- start_rust.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/start_rust.sh b/start_rust.sh index a3bd38f..63f9968 100755 --- a/start_rust.sh +++ b/start_rust.sh @@ -151,8 +151,8 @@ if [ "$RUST_CARBON_ENABLED" = "1" ]; then CARBON_URL="${CARBON_BASE_URL}rustbeta_aux02_build/Carbon.Linux.Debug.tar.gz" ;; *) - if [ ! -z ${RUST_CARBON_BUILD+x} ]; then - case $RUST_CARBON_BUILD in + if [ ! -z ${RUST_CARBON_BRANCH+x} ]; then + case $RUST_CARBON_BRANCH in "preview") echo "Downloading preview release.." CARBON_URL="${CARBON_BASE_URL}preview_build/Carbon.Linux.Debug.tar.gz" From 7503118b89b3287c695b461d0a45fca3e0e837d5 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Thu, 29 Jun 2023 22:49:41 -0500 Subject: [PATCH 9/9] Update README.md Updated documentation to reflect the addition of Carbon to the Docker image. --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index adae089..99428e0 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,21 @@ RUST_UPDATE_BRANCH (DEFAULT: "public" - Set to match the branch that you want to RUST_START_MODE (DEFAULT: "0" - Determines if the server should update and then start (0), only update (1) or only start (2)) RUST_OXIDE_ENABLED (DEFAULT: "0" - Set to 1 to automatically install the latest version of Oxide) RUST_OXIDE_UPDATE_ON_BOOT (DEFAULT: "1" - Set to 0 to disable automatic update of Oxide on boot) +RUST_CARBON_ENABLED (DEFAULT: "0" - Set to 1 to automatically install the latest version of Carbon) +RUST_CARBON_UPDATE_ON_BOOT (DEFAULT: "0" - Set to 1 to automatically update Carbon on boot) +RUST_CARBON_BRANCH (DEFAULT: "" - Set's the Branch of Carbon to install, Values: preview, edge, stable) RUST_RCON_SECURE_WEBSOCKET (DEFAULT: "0" - Set to 1 to enable secure websocket connections to the RCON web interface) RUST_HEARTBEAT (DEFAULT: "0" - Set to 1 to enable the heartbeat service which will forcibly quit the server if it becomes unresponsive to queries) ``` +# Oxide vs Carbon + +There are currently 3 systems for Modding Rust. Oxide, is the oldest, and most stable release of the Modding System, and most plugins are written for Oxide. However, Oxide is not updated as rapidly, or frequently, and can sometimes have a lag before a release matches with Rust server. + +Carbon on the other hand, is the new kid on the block, it's more newer, more frequently updated, and utilizes a Hook on Demand setup, where only the hooks that plugins subscribe to / override in their code, will actually be connected, instead of all of them. Most plugins written for Oxide will work with Carbon, but it is not currently 100 percent backwards compatible. And Extensions (Pre-compiled Assemblies) that specifically target Oxide, need to be re-compiled to work with Carbon, and may have issues if certain API functionality that is available in Oxide, is not available in Carbon. + +It is recommended that you only choose 1 of these systems for your server, and the docker will fail to run, if you enable both. + # Logging and rotating logs The image now supports log rotation, and all you need to do to enable it is to remove any `-logfile` arguments from your startup arguments.