Skip to content
Merged
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
505 changes: 266 additions & 239 deletions Cargo.lock

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,33 @@ services:
- cargo-registry:/usr/local/cargo/registry
- cargo-git:/usr/local/cargo/git
# - cargo-target:/app/target
- sqlite-data:/sqlite-data/workspace/data
- ./scripts/sqlite/test-db:/sqlite-data-2/workspace/data
# - sqlite-data:/sqlite-data/workspace/data
# - ./scripts/sqlite/test-db:/sqlite-data-2/workspace/data
environment:
APP_ENV: development
LOG: debug
TZ: "Europe/Paris"
EDGE_KEY: "eyJzZXJ2ZXJVcmwiOiJodHRwOi8vbG9jYWxob3N0Ojg4ODciLCJhZ2VudElkIjoiZjg4Y2E0MDMtNDgwOS00NGM4LTlkZjItY2VkNWYwYzhkNTM2IiwibWFzdGVyS2V5QjY0IjoiQlhWM1hvbEM2NTZTVjdkTmdjV1BHUWxrKytycExJNmxHRGk3Q1BCNWllbz0ifQ=="
EDGE_KEY: "eyJzZXJ2ZXJVcmwiOiJodHRwOi8vbG9jYWxob3N0Ojg4ODciLCJhZ2VudElkIjoiNjI1MDQzY2YtN2MwMC00M2M4LWJjYzktZDM1MTk5ODk2ZGNkIiwibWFzdGVyS2V5QjY0IjoiQlhWM1hvbEM2NTZTVjdkTmdjV1BHUWxrKytycExJNmxHRGk3Q1BCNWllbz0ifQ=="
#POOLING: 1
#DATABASES_CONFIG_FILE: "config.toml"
extra_hosts:
- "localhost:host-gateway"
networks:
- portabase

# db-postgres:
# container_name: db-postgres
# image: postgres:17-alpine
# ports:
# - "5436:5432"
# volumes:
# - postgres-data:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=devdb
# - POSTGRES_USER=devuser
# - POSTGRES_PASSWORD=changeme
# networks:
# - portabase
db-postgres:
container_name: db-postgres
image: postgres:17-alpine
ports:
- "5436:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=devdb
- POSTGRES_USER=devuser
- POSTGRES_PASSWORD=changeme
networks:
- portabase
#
# db-mariadb:
# container_name: db-mariadb
Expand Down Expand Up @@ -93,27 +93,27 @@ services:
# networks:
# - portabase

sqlite:
container_name: db-sqlite
image: keinos/sqlite3
volumes:
- sqlite-data:/workspace/data
working_dir: /workspace
command: tail -f /dev/null
stdin_open: true
tty: true
# sqlite:
# container_name: db-sqlite
# image: keinos/sqlite3
# volumes:
# - sqlite-data:/workspace/data
# working_dir: /workspace
# command: tail -f /dev/null
# stdin_open: true
# tty: true


volumes:
cargo-registry:
cargo-git:
# cargo-target:

# postgres-data:
postgres-data:
# mariadb-data:
# mongodb-data:
# mongodb-data-auth:
sqlite-data:
# sqlite-data:

networks:
portabase:
Expand Down
2 changes: 1 addition & 1 deletion scripts/postgres/seed-1gb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SELECT
)
FROM users u
JOIN generate_series(1, 30) AS p(post_no)
ON u.id <= 300000;
ON u.id <= 500000;

-- ============================================================
-- OPTIONAL: FORCE DISK MATERIALIZATION
Expand Down
3 changes: 2 additions & 1 deletion src/services/api/endpoints/agent/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod status;
pub mod backup;
pub mod backup;
pub mod restore;
33 changes: 33 additions & 0 deletions src/services/api/endpoints/agent/restore/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use crate::services::api::models::agent::restore::ResultRestoreResponse;
use crate::services::api::{ApiClient, ApiError};
use anyhow::Result;
use reqwest::Method;
use serde::Serialize;

#[derive(Serialize)]
pub struct ResultRestoreRequest {
#[serde(rename = "generatedId")]
pub generated_id: String,
pub status: String,
}

impl ApiClient {
pub async fn restore_result(
&self,
agent_id: impl Into<String>,
generated_id: impl Into<String>,
status: impl Into<String>,
) -> Result<Option<ResultRestoreResponse>, ApiError> {
let body = ResultRestoreRequest {
generated_id: generated_id.into(),
status: status.into(),
};

let agent_id = agent_id.into();

let path = format!("/agent/{}/restore", agent_id);

self.request_with_body(Method::POST, path.as_str(), &body)
.await
}
}
3 changes: 2 additions & 1 deletion src/services/api/models/agent/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod status;
pub mod backup;
pub mod backup;
pub mod restore;
7 changes: 7 additions & 0 deletions src/services/api/models/agent/restore.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
pub struct ResultRestoreResponse {
pub message: String,
pub status: bool,
}
Loading