Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable host networking and root users on dev #1387

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion packages/api/actor/src/route/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ define_router! {
),
},

"actors" / Uuid / "logs" : {
"actors" / Uuid / "logs": {
GET: logs::get_logs(
query: logs::GetActorLogsQuery,
opt_auth: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/common/chirp-workflow/core/src/db/pg_nats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ impl Database for DatabasePgNats {
)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
ON CONFLICT (workflow_id, location2_hash) DO UPDATE
SET output = excluded.output
SET output = EXCLUDED.output
",
))
.bind(workflow_id)
Expand Down
17 changes: 9 additions & 8 deletions packages/services/cloud/standalone/default-create/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@ license = "Apache-2.0"
chirp-client = { path = "../../../../common/chirp/client" }
chirp-workflow = { path = "../../../../common/chirp-workflow/core" }
reqwest = "0.11"
rivet-config = { version = "0.1.0", path = "../../../../common/config" }
rivet-connection = { path = "../../../../common/connection" }
rivet-pools = { path = "../../../../common/pools" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1.40", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "json", "ansi"] }
tracing-logfmt = "0.3"
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "json", "ansi"] }
uuid = { version = "1", features = ["v4"] }

rivet-config = { version = "0.1.0", path = "../../../../common/config" }
user = { version = "0.1.0", path = "../../../user" }
game-resolve-name-id = { version = "0.0.1", path = "../../../game/ops/resolve-name-id" }
cloud-game-config-create = { version = "0.0.1", path = "../../ops/game-config-create" }
team-resolve-display-name = { version = "0.0.1", path = "../../../team/ops/resolve-display-name" }
cloud-namespace-create = { version = "0.0.1", path = "../../ops/namespace-create" }
cloud-version-publish = { version = "0.0.1", path = "../../ops/version-publish" }
ds = { version = "0.0.1", path = "../../../ds" }
game-create = { version = "0.0.1", path = "../../../game/ops/create" }
rivet-operation = { version = "0.1.0", path = "../../../../common/operation/core" }
game-namespace-resolve-name-id = { version = "0.0.1", path = "../../../game/ops/namespace-resolve-name-id" }
game-namespace-create = { version = "0.0.1", path = "../../../game/ops/namespace-create" }
cloud-version-publish = { version = "0.0.1", path = "../../ops/version-publish" }
game-namespace-resolve-name-id = { version = "0.0.1", path = "../../../game/ops/namespace-resolve-name-id" }
game-resolve-name-id = { version = "0.0.1", path = "../../../game/ops/resolve-name-id" }
rivet-operation = { version = "0.1.0", path = "../../../../common/operation/core" }
team-resolve-display-name = { version = "0.0.1", path = "../../../team/ops/resolve-display-name" }
user = { version = "0.1.0", path = "../../../user" }

[dev-dependencies]
chirp-worker = { path = "../../../../common/chirp/worker" }
13 changes: 12 additions & 1 deletion packages/services/cloud/standalone/default-create/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use ::ds;
use chirp_workflow::prelude::*;
use rivet_operation::prelude::proto::backend::{self, pkg::*};
use util::dev_defaults;
Expand Down Expand Up @@ -84,7 +85,17 @@ pub async fn start(config: rivet_config::Config, pools: rivet_pools::Pools) -> G
})
.await?;

unwrap_ref!(create_game_res.game_id).as_uuid()
let game_id = unwrap_ref!(create_game_res.game_id).as_uuid();

ctx.op(ds::ops::game_config::upsert::Input {
game_id,
host_networking_enabled: Some(true),
root_user_enabled: Some(true),
..Default::default()
})
.await?;

game_id
};

// Create namespace
Expand Down
2 changes: 1 addition & 1 deletion packages/services/ds/src/ops/game_config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub mod get;
pub mod update;
pub mod upsert;
33 changes: 0 additions & 33 deletions packages/services/ds/src/ops/game_config/update.rs

This file was deleted.

34 changes: 34 additions & 0 deletions packages/services/ds/src/ops/game_config/upsert.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
use chirp_workflow::prelude::*;

use crate::types::ServerRuntime;

#[derive(Debug, Default)]
pub struct Input {
pub game_id: Uuid,
pub host_networking_enabled: Option<bool>,
pub root_user_enabled: Option<bool>,
pub runtime: Option<ServerRuntime>,
}

#[operation]
pub async fn ds_game_config_upsert(ctx: &OperationCtx, input: &Input) -> GlobalResult<()> {
sql_execute!(
[ctx]
"
INSERT INTO db_ds.game_config (game_id, host_networking_enabled, root_user_enabled, runtime)
VALUES ($1, $2, $3, $4)
ON CONFLICT (game_id) DO UPDATE
SET
host_networking_enabled = COALESCE($2, EXCLUDED.host_networking_enabled),
root_user_enabled = COALESCE($3, EXCLUDED.root_user_enabled),
runtime = COALESCE($4, EXCLUDED.runtime)
",
&input.game_id,
input.host_networking_enabled,
input.root_user_enabled,
input.runtime.unwrap_or_default() as i32,
)
.await?;

Ok(())
}
5 changes: 3 additions & 2 deletions packages/services/ds/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ pub enum HostProtocol {
Udp = 1,
}

#[derive(Serialize, Deserialize, Hash, Debug, Clone, Copy, PartialEq, Eq, FromRepr)]
#[derive(Serialize, Deserialize, Hash, Debug, Clone, Copy, PartialEq, Eq, FromRepr, Default)]
pub enum ServerRuntime {
Nomad = 0,
#[default]
Pegboard = 1,
}

Expand All @@ -108,7 +109,7 @@ impl GameConfig {
game_id,
host_networking_enabled: false,
root_user_enabled: false,
runtime: ServerRuntime::Pegboard,
runtime: ServerRuntime::default(),
}
}
}
Expand Down
Loading