docker limit resources
This commit is contained in:
parent
0c46e4ad32
commit
d790e2cb98
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -410,7 +410,6 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "detee-shared"
|
name = "detee-shared"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+ssh://git@gitea.detee.cloud/noormohammedb/detee-shared?branch=stable_01#9ba3bc318617b08d8c761767a23abd77519b7e6d"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"prost",
|
"prost",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
|
use detee_shared::sgx::types::brain::Resource;
|
||||||
use log::info;
|
use log::info;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
@ -7,6 +8,7 @@ pub fn deploy_enclave(
|
|||||||
container_name_uuid: String,
|
container_name_uuid: String,
|
||||||
port_map: Vec<(u16, u16)>,
|
port_map: Vec<(u16, u16)>,
|
||||||
hratls_pubkey: String,
|
hratls_pubkey: String,
|
||||||
|
app_resource: Resource,
|
||||||
) -> Result<i32> {
|
) -> Result<i32> {
|
||||||
let port_maping_string = port_map
|
let port_maping_string = port_map
|
||||||
.iter()
|
.iter()
|
||||||
@ -18,10 +20,16 @@ pub fn deploy_enclave(
|
|||||||
"Deploying enclave: {:?} with hratls: {:?}",
|
"Deploying enclave: {:?} with hratls: {:?}",
|
||||||
enclave_path, hratls_pubkey
|
enclave_path, hratls_pubkey
|
||||||
);
|
);
|
||||||
// TODO: docker limit resources
|
|
||||||
|
let memory_mb = app_resource.memory_mb;
|
||||||
|
let vcpu = app_resource.vcpu;
|
||||||
|
// TODO: docker limit disk space
|
||||||
|
// let disk_mb = app_resource.disk_mb;
|
||||||
|
// --storage-opt size={disk_mb}m
|
||||||
|
|
||||||
let docker_deploy_str = format!(
|
let docker_deploy_str = format!(
|
||||||
r#"docker run -d --name {container_name_uuid} -v {enclave_path}:/enclave_package \
|
r#"docker run -d --name {container_name_uuid} --memory={memory_mb}m --cpus={vcpu} \
|
||||||
--device /dev/sgx/enclave --device /dev/sgx/provision \
|
-v {enclave_path}:/enclave_package --device /dev/sgx/enclave --device /dev/sgx/provision \
|
||||||
{port_maping_string} noormohammedb/occlum-enclave:v1 {hratls_pubkey}"#
|
{port_maping_string} noormohammedb/occlum-enclave:v1 {hratls_pubkey}"#
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ impl App {
|
|||||||
app_name.clone(),
|
app_name.clone(),
|
||||||
mapped_ports.clone(),
|
mapped_ports.clone(),
|
||||||
new_app_req.hratls_pubkey,
|
new_app_req.hratls_pubkey,
|
||||||
|
new_app_req.resource.clone(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if exit_code != 0 {
|
if exit_code != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user