@opencode-cloud/core 4.0.1 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +1 -1
- package/package.json +1 -1
- package/src/config/schema.rs +5 -2
- package/src/docker/Dockerfile +2 -2
- package/src/docker/container.rs +5 -5
- package/src/docker/exec.rs +2 -2
- package/src/docker/mount.rs +3 -3
- package/src/docker/users.rs +2 -2
- package/src/docker/volume.rs +12 -12
package/Cargo.toml
CHANGED
package/package.json
CHANGED
package/src/config/schema.rs
CHANGED
|
@@ -700,7 +700,7 @@ mod tests {
|
|
|
700
700
|
fn test_serialize_deserialize_with_mounts() {
|
|
701
701
|
let config = Config {
|
|
702
702
|
mounts: vec![
|
|
703
|
-
"/home/user/data:/workspace/data".to_string(),
|
|
703
|
+
"/home/user/data:/home/opencode/workspace/data".to_string(),
|
|
704
704
|
"/home/user/config:/etc/app:ro".to_string(),
|
|
705
705
|
],
|
|
706
706
|
..Config::default()
|
|
@@ -708,7 +708,10 @@ mod tests {
|
|
|
708
708
|
let json = serde_json::to_string(&config).unwrap();
|
|
709
709
|
let parsed: Config = serde_json::from_str(&json).unwrap();
|
|
710
710
|
assert_eq!(parsed.mounts.len(), 2);
|
|
711
|
-
assert_eq!(
|
|
711
|
+
assert_eq!(
|
|
712
|
+
parsed.mounts[0],
|
|
713
|
+
"/home/user/data:/home/opencode/workspace/data"
|
|
714
|
+
);
|
|
712
715
|
assert_eq!(parsed.mounts[1], "/home/user/config:/etc/app:ro");
|
|
713
716
|
}
|
|
714
717
|
|
package/src/docker/Dockerfile
CHANGED
|
@@ -710,10 +710,10 @@ RUN printf '%s\n' \
|
|
|
710
710
|
# -----------------------------------------------------------------------------
|
|
711
711
|
# Health Check
|
|
712
712
|
# -----------------------------------------------------------------------------
|
|
713
|
-
# Check that opencode
|
|
713
|
+
# Check that opencode main page responds
|
|
714
714
|
# Works for both tini and systemd modes
|
|
715
715
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
|
716
|
-
CMD curl -f http://localhost:3000/
|
|
716
|
+
CMD curl -f http://localhost:3000/ || exit 1
|
|
717
717
|
|
|
718
718
|
# -----------------------------------------------------------------------------
|
|
719
719
|
# Version File
|
package/src/docker/container.rs
CHANGED
|
@@ -20,7 +20,7 @@ use std::collections::HashMap;
|
|
|
20
20
|
use tracing::debug;
|
|
21
21
|
|
|
22
22
|
/// Default container name
|
|
23
|
-
pub const CONTAINER_NAME: &str = "opencode-cloud";
|
|
23
|
+
pub const CONTAINER_NAME: &str = "opencode-cloud-sandbox";
|
|
24
24
|
|
|
25
25
|
/// Default port for opencode web UI
|
|
26
26
|
pub const OPENCODE_WEB_PORT: u16 = 3000;
|
|
@@ -38,7 +38,7 @@ pub const OPENCODE_WEB_PORT: u16 = 3000;
|
|
|
38
38
|
/// * `env_vars` - Additional environment variables (optional)
|
|
39
39
|
/// * `bind_address` - IP address to bind on host (defaults to "127.0.0.1")
|
|
40
40
|
/// * `cockpit_port` - Port to bind on host for Cockpit (defaults to 9090)
|
|
41
|
-
/// * `cockpit_enabled` - Whether to enable Cockpit port mapping (defaults to
|
|
41
|
+
/// * `cockpit_enabled` - Whether to enable Cockpit port mapping (defaults to false)
|
|
42
42
|
/// * `bind_mounts` - User-defined bind mounts from config and CLI flags (optional)
|
|
43
43
|
#[allow(clippy::too_many_arguments)]
|
|
44
44
|
pub async fn create_container(
|
|
@@ -57,7 +57,7 @@ pub async fn create_container(
|
|
|
57
57
|
let image_name = image.unwrap_or(&default_image);
|
|
58
58
|
let port = opencode_web_port.unwrap_or(OPENCODE_WEB_PORT);
|
|
59
59
|
let cockpit_port_val = cockpit_port.unwrap_or(9090);
|
|
60
|
-
let cockpit_enabled_val = cockpit_enabled.unwrap_or(
|
|
60
|
+
let cockpit_enabled_val = cockpit_enabled.unwrap_or(false);
|
|
61
61
|
|
|
62
62
|
debug!(
|
|
63
63
|
"Creating container {} from image {} with port {} and cockpit_port {} (enabled: {})",
|
|
@@ -202,7 +202,7 @@ pub async fn create_container(
|
|
|
202
202
|
let config = Config {
|
|
203
203
|
image: Some(image_name.to_string()),
|
|
204
204
|
hostname: Some(CONTAINER_NAME.to_string()),
|
|
205
|
-
working_dir: Some("/workspace".to_string()),
|
|
205
|
+
working_dir: Some("/home/opencode/workspace".to_string()),
|
|
206
206
|
exposed_ports: Some(exposed_ports),
|
|
207
207
|
env: final_env,
|
|
208
208
|
host_config: Some(host_config),
|
|
@@ -473,7 +473,7 @@ mod tests {
|
|
|
473
473
|
|
|
474
474
|
#[test]
|
|
475
475
|
fn container_constants_are_correct() {
|
|
476
|
-
assert_eq!(CONTAINER_NAME, "opencode-cloud");
|
|
476
|
+
assert_eq!(CONTAINER_NAME, "opencode-cloud-sandbox");
|
|
477
477
|
assert_eq!(OPENCODE_WEB_PORT, 3000);
|
|
478
478
|
}
|
|
479
479
|
|
package/src/docker/exec.rs
CHANGED
|
@@ -22,7 +22,7 @@ use super::{DockerClient, DockerError};
|
|
|
22
22
|
///
|
|
23
23
|
/// # Example
|
|
24
24
|
/// ```ignore
|
|
25
|
-
/// let output = exec_command(&client, "opencode-cloud", vec!["whoami"]).await?;
|
|
25
|
+
/// let output = exec_command(&client, "opencode-cloud-sandbox", vec!["whoami"]).await?;
|
|
26
26
|
/// ```
|
|
27
27
|
pub async fn exec_command(
|
|
28
28
|
client: &DockerClient,
|
|
@@ -104,7 +104,7 @@ pub async fn exec_command(
|
|
|
104
104
|
/// // Set password via chpasswd (secure, non-interactive)
|
|
105
105
|
/// exec_command_with_stdin(
|
|
106
106
|
/// &client,
|
|
107
|
-
/// "opencode-cloud",
|
|
107
|
+
/// "opencode-cloud-sandbox",
|
|
108
108
|
/// vec!["chpasswd"],
|
|
109
109
|
/// "username:password\n"
|
|
110
110
|
/// ).await?;
|
package/src/docker/mount.rs
CHANGED
|
@@ -64,9 +64,9 @@ impl ParsedMount {
|
|
|
64
64
|
/// use opencode_cloud_core::docker::ParsedMount;
|
|
65
65
|
///
|
|
66
66
|
/// // Read-write mount (default)
|
|
67
|
-
/// let mount = ParsedMount::parse("/home/user/data:/workspace/data").unwrap();
|
|
67
|
+
/// let mount = ParsedMount::parse("/home/user/data:/home/opencode/workspace/data").unwrap();
|
|
68
68
|
/// assert_eq!(mount.host_path.to_str().unwrap(), "/home/user/data");
|
|
69
|
-
/// assert_eq!(mount.container_path, "/workspace/data");
|
|
69
|
+
/// assert_eq!(mount.container_path, "/home/opencode/workspace/data");
|
|
70
70
|
/// assert!(!mount.read_only);
|
|
71
71
|
///
|
|
72
72
|
/// // Read-only mount
|
|
@@ -285,7 +285,7 @@ mod tests {
|
|
|
285
285
|
|
|
286
286
|
#[test]
|
|
287
287
|
fn non_system_path_no_warning() {
|
|
288
|
-
let warning = check_container_path_warning("/workspace/data");
|
|
288
|
+
let warning = check_container_path_warning("/home/opencode/workspace/data");
|
|
289
289
|
assert!(warning.is_none());
|
|
290
290
|
}
|
|
291
291
|
|
package/src/docker/users.rs
CHANGED
|
@@ -37,7 +37,7 @@ pub struct UserInfo {
|
|
|
37
37
|
///
|
|
38
38
|
/// # Example
|
|
39
39
|
/// ```ignore
|
|
40
|
-
/// create_user(&client, "opencode-cloud", "admin").await?;
|
|
40
|
+
/// create_user(&client, "opencode-cloud-sandbox", "admin").await?;
|
|
41
41
|
/// ```
|
|
42
42
|
pub async fn create_user(
|
|
43
43
|
client: &DockerClient,
|
|
@@ -80,7 +80,7 @@ pub async fn create_user(
|
|
|
80
80
|
///
|
|
81
81
|
/// # Example
|
|
82
82
|
/// ```ignore
|
|
83
|
-
/// set_user_password(&client, "opencode-cloud", "admin", "secret123").await?;
|
|
83
|
+
/// set_user_password(&client, "opencode-cloud-sandbox", "admin", "secret123").await?;
|
|
84
84
|
/// ```
|
|
85
85
|
pub async fn set_user_password(
|
|
86
86
|
client: &DockerClient,
|
package/src/docker/volume.rs
CHANGED
|
@@ -8,23 +8,23 @@ use bollard::volume::CreateVolumeOptions;
|
|
|
8
8
|
use std::collections::HashMap;
|
|
9
9
|
use tracing::debug;
|
|
10
10
|
|
|
11
|
-
/// Volume name for opencode
|
|
12
|
-
pub const VOLUME_SESSION: &str = "opencode-
|
|
11
|
+
/// Volume name for opencode data
|
|
12
|
+
pub const VOLUME_SESSION: &str = "opencode-data";
|
|
13
13
|
|
|
14
14
|
/// Volume name for project files
|
|
15
|
-
pub const VOLUME_PROJECTS: &str = "opencode-
|
|
15
|
+
pub const VOLUME_PROJECTS: &str = "opencode-workspace";
|
|
16
16
|
|
|
17
17
|
/// Volume name for opencode configuration
|
|
18
|
-
pub const VOLUME_CONFIG: &str = "opencode-
|
|
18
|
+
pub const VOLUME_CONFIG: &str = "opencode-config";
|
|
19
19
|
|
|
20
20
|
/// All volume names as array for iteration
|
|
21
21
|
pub const VOLUME_NAMES: [&str; 3] = [VOLUME_SESSION, VOLUME_PROJECTS, VOLUME_CONFIG];
|
|
22
22
|
|
|
23
|
-
/// Mount point for
|
|
24
|
-
pub const MOUNT_SESSION: &str = "/home/opencode/.
|
|
23
|
+
/// Mount point for opencode data inside container
|
|
24
|
+
pub const MOUNT_SESSION: &str = "/home/opencode/.local/share";
|
|
25
25
|
|
|
26
26
|
/// Mount point for project files inside container
|
|
27
|
-
pub const MOUNT_PROJECTS: &str = "/workspace";
|
|
27
|
+
pub const MOUNT_PROJECTS: &str = "/home/opencode/workspace";
|
|
28
28
|
|
|
29
29
|
/// Mount point for configuration inside container
|
|
30
30
|
pub const MOUNT_CONFIG: &str = "/home/opencode/.config";
|
|
@@ -122,9 +122,9 @@ mod tests {
|
|
|
122
122
|
|
|
123
123
|
#[test]
|
|
124
124
|
fn volume_constants_are_correct() {
|
|
125
|
-
assert_eq!(VOLUME_SESSION, "opencode-
|
|
126
|
-
assert_eq!(VOLUME_PROJECTS, "opencode-
|
|
127
|
-
assert_eq!(VOLUME_CONFIG, "opencode-
|
|
125
|
+
assert_eq!(VOLUME_SESSION, "opencode-data");
|
|
126
|
+
assert_eq!(VOLUME_PROJECTS, "opencode-workspace");
|
|
127
|
+
assert_eq!(VOLUME_CONFIG, "opencode-config");
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
#[test]
|
|
@@ -137,8 +137,8 @@ mod tests {
|
|
|
137
137
|
|
|
138
138
|
#[test]
|
|
139
139
|
fn mount_points_are_correct() {
|
|
140
|
-
assert_eq!(MOUNT_SESSION, "/home/opencode/.
|
|
141
|
-
assert_eq!(MOUNT_PROJECTS, "/workspace");
|
|
140
|
+
assert_eq!(MOUNT_SESSION, "/home/opencode/.local/share");
|
|
141
|
+
assert_eq!(MOUNT_PROJECTS, "/home/opencode/workspace");
|
|
142
142
|
assert_eq!(MOUNT_CONFIG, "/home/opencode/.config");
|
|
143
143
|
}
|
|
144
144
|
}
|