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

chore: upgrade to ntex 1.0 #812

Merged
merged 2 commits into from
Jan 10, 2024
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
404 changes: 215 additions & 189 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/nanocl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ serde_yaml = "0.9"
tabled = "0.15"
indicatif = "0.17"
serde_json = "1.0"
ntex = { version = "0.7", features = ["tokio", "openssl"] }
ntex = { version = "1.0", features = ["tokio", "openssl"] }
serde = { version = "1.0", features = ["derive"] }
clap = { version = "4.4", features = ["derive", "cargo"] }
tokio = { version = "1.34", features = ["fs"] }
Expand Down
6 changes: 3 additions & 3 deletions bin/nanocld/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ clap = { version = "4.4", features = ["derive"] }
url = { version = "2", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
uuid = { version = "1.6", features = ["serde", "v4"] }
ntex = { version = "0.7", features = ["tokio", "openssl"] }
ntex = { version = "1.0", features = ["tokio", "openssl"] }
diesel = { version = "2.1", features = [
"postgres",
"r2d2",
Expand All @@ -81,7 +81,7 @@ nanocld_client = { version = "0.13", features = ["tokio"] }
metrsd_client = "0.5"
nanocl_stubs = { version = "0.13", features = ["serde"] }
nanocl_utils = { version = "0.4", features = ["unix", "ntex", "logger"] }
utoipa = { version = "4.1", features = ["yaml"], optional = true }
utoipa = { version = "4.2", features = ["yaml"], optional = true }
notify = "6.1"
ntex-cors = "0.4"
ntex-cors = "0.5"
rand = "0.8"
37 changes: 37 additions & 0 deletions bin/nanocld/specs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2089,6 +2089,7 @@ components:
type: string
description: Name of the image
example: nginx:latest
additionalProperties: false
CargoInspect:
type: object
description: |-
Expand Down Expand Up @@ -2217,6 +2218,7 @@ components:
allOf:
- $ref: '#/components/schemas/ReplicationMode'
nullable: true
additionalProperties: false
CargoSpecUpdate:
type: object
description: |-
Expand Down Expand Up @@ -2251,6 +2253,7 @@ components:
allOf:
- $ref: '#/components/schemas/ReplicationMode'
nullable: true
additionalProperties: false
CargoSummary:
type: object
description: |-
Expand Down Expand Up @@ -3017,6 +3020,7 @@ components:
type: string
IpAddress:
type: string
additionalProperties: false
Driver:
type: object
description: Driver represents a driver (network, logging, secrets).
Expand Down Expand Up @@ -3203,6 +3207,7 @@ components:
- Resource
- Secret
- Process
- ContainerImage
EventKind:
type: string
description: Kind of event (Error, Normal, Warning), new types could be added in the future.
Expand Down Expand Up @@ -3913,6 +3918,7 @@ components:
allOf:
- $ref: '#/components/schemas/UrlRedirect'
nullable: true
additionalProperties: false
ImageInspect:
type: object
description: Information about an image in the local image cache.
Expand Down Expand Up @@ -4251,6 +4257,7 @@ components:
items:
$ref: '#/components/schemas/Config'
description: List of container to run
additionalProperties: false
JobSummary:
type: object
description: Summary of a job (used in list)
Expand Down Expand Up @@ -4534,6 +4541,7 @@ components:
format: int64
nullable: true
minimum: 0
additionalProperties: false
MemoryStatsStatsV2:
type: object
description: |-
Expand Down Expand Up @@ -4697,6 +4705,7 @@ components:
type: integer
format: int64
minimum: 0
additionalProperties: false
Metric:
type: object
description: Metric entry
Expand Down Expand Up @@ -4956,6 +4965,7 @@ components:
Name:
type: string
description: Name of the namespace
additionalProperties: false
NamespaceSummary:
type: object
description: |-
Expand Down Expand Up @@ -5412,6 +5422,7 @@ components:
format: double
description: Http version to use
nullable: true
additionalProperties: false
ProxyRule:
oneOf:
- $ref: '#/components/schemas/ProxyRuleHttp'
Expand Down Expand Up @@ -5446,6 +5457,7 @@ components:
type: string
description: Path to extra config file to include
nullable: true
additionalProperties: false
ProxyRuleStream:
type: object
description: Proxy rules modes
Expand All @@ -5471,6 +5483,7 @@ components:
nullable: true
Target:
$ref: '#/components/schemas/StreamTarget'
additionalProperties: false
ProxySsl:
oneOf:
- $ref: '#/components/schemas/ProxySslConfig'
Expand Down Expand Up @@ -5499,6 +5512,7 @@ components:
type: string
description: Path to the dhparam file
nullable: true
additionalProperties: false
ProxyStreamProtocol:
type: string
description: Proxy rules modes
Expand Down Expand Up @@ -5662,6 +5676,7 @@ components:
Number:
type: integer
minimum: 0
additionalProperties: false
Resource:
type: object
description: |-
Expand Down Expand Up @@ -5693,6 +5708,7 @@ components:
type: array
items:
$ref: '#/components/schemas/DnsEntry'
additionalProperties: false
ResourceKind:
type: object
required:
Expand All @@ -5716,6 +5732,7 @@ components:
nullable: true
Data:
$ref: '#/components/schemas/ResourceKindSpec'
additionalProperties: false
ResourceKindInspect:
type: object
required:
Expand All @@ -5735,6 +5752,7 @@ components:
items:
$ref: '#/components/schemas/ResourceKindVersion'
description: List of versions available
additionalProperties: false
ResourceKindPartial:
type: object
description: |-
Expand All @@ -5758,6 +5776,7 @@ components:
$ref: '#/components/schemas/Any'
Data:
$ref: '#/components/schemas/ResourceKindSpec'
additionalProperties: false
ResourceKindSpec:
type: object
description: |-
Expand All @@ -5773,6 +5792,7 @@ components:
type: string
description: The service to call when creating, updating or deleting a resource of this kind and version
nullable: true
additionalProperties: false
ResourceKindVersion:
type: object
required:
Expand Down Expand Up @@ -5803,6 +5823,7 @@ components:
$ref: '#/components/schemas/Any'
Data:
$ref: '#/components/schemas/ResourceKindSpec'
additionalProperties: false
ResourcePartial:
type: object
description: Payload used to create a new resource
Expand All @@ -5827,6 +5848,7 @@ components:
description: The metadata of the resource (user defined)
additionalProperties:
$ref: '#/components/schemas/Any'
additionalProperties: false
ResourceProxyRule:
type: object
description: Define proxy rules to apply
Expand All @@ -5838,6 +5860,7 @@ components:
items:
$ref: '#/components/schemas/ProxyRule'
description: The rules to apply
additionalProperties: false
ResourceSpec:
type: object
description: The spec of a resource once created in the system
Expand Down Expand Up @@ -5872,6 +5895,7 @@ components:
description: The metadata of the resource (user defined)
additionalProperties:
$ref: '#/components/schemas/Any'
additionalProperties: false
ResourceUpdate:
type: object
description: Payload used to update a resource
Expand All @@ -5888,6 +5912,7 @@ components:
description: The metadata of the resource as a json object
additionalProperties:
$ref: '#/components/schemas/Any'
additionalProperties: false
ResourcesBlkioWeightDevice:
type: object
properties:
Expand Down Expand Up @@ -6021,6 +6046,7 @@ components:
description: The secret data
additionalProperties:
$ref: '#/components/schemas/Any'
additionalProperties: false
SecretUpdate:
type: object
description: This structure is used to update a secret.
Expand All @@ -6037,6 +6063,7 @@ components:
description: The data of the secret as a json object
additionalProperties:
$ref: '#/components/schemas/Any'
additionalProperties: false
StartExecOptions:
type: object
description: Exec configuration used in the [Create Exec API](Docker::create_exec())
Expand Down Expand Up @@ -6108,6 +6135,7 @@ components:
$ref: '#/components/schemas/JobPartial'
description: List of jobs to create and run
nullable: true
additionalProperties: false
StatefileArg:
type: object
description: Statefile argument definition to pass to the Statefile
Expand All @@ -6125,6 +6153,7 @@ components:
type: string
description: Default value of the build arg
nullable: true
additionalProperties: false
Stats:
type: object
description: Statistics for the container.
Expand Down Expand Up @@ -6780,6 +6809,7 @@ components:
properties:
UnixPath:
type: string
additionalProperties: false
UpstreamTarget:
type: object
description: Config for targetting a cargo or a vm
Expand All @@ -6803,6 +6833,7 @@ components:
type: boolean
description: Disable logging for this target
nullable: true
additionalProperties: false
UriTarget:
type: object
required:
Expand All @@ -6811,6 +6842,7 @@ components:
Uri:
type: string
description: Uri to target
additionalProperties: false
UrlRedirect:
type: string
enum:
Expand Down Expand Up @@ -6849,6 +6881,7 @@ components:
description: 'Virtual size allowed for the disk in GB (default: 20)'
nullable: true
minimum: 0
additionalProperties: false
VmHostConfig:
type: object
description: A vm's resources (cpu, memory, network)
Expand Down Expand Up @@ -6895,6 +6928,7 @@ components:
type: boolean
description: Use host tun device
nullable: true
additionalProperties: false
VmImage:
type: object
required:
Expand Down Expand Up @@ -6944,6 +6978,7 @@ components:
Shrink:
type: boolean
description: Whether to shrink the image or not
additionalProperties: false
VmInspect:
type: object
description: |-
Expand Down Expand Up @@ -7095,6 +7130,7 @@ components:
allOf:
- $ref: '#/components/schemas/VmHostConfig'
nullable: true
additionalProperties: false
VmSpecUpdate:
type: object
description: |
Expand Down Expand Up @@ -7139,6 +7175,7 @@ components:
allOf:
- $ref: '#/components/schemas/VmHostConfig'
nullable: true
additionalProperties: false
VmSummary:
type: object
description: |-
Expand Down
10 changes: 5 additions & 5 deletions bin/nanocld/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod cli;
mod config;
mod schema;
mod models;
mod version;
mod vars;
mod utils;
mod subsystem;
mod repositories;
Expand All @@ -31,10 +31,10 @@ async fn main() -> std::io::Result<()> {
logger::enable_logger("nanocld");
log::info!(
"nanocld_{}_v{}-{}:{}",
version::ARCH,
version::VERSION,
version::CHANNEL,
version::COMMIT_ID
vars::ARCH,
vars::VERSION,
vars::CHANNEL,
vars::COMMIT_ID
);
// Init config by comparing command line arguments and config file
let config = match config::init(&args) {
Expand Down
6 changes: 3 additions & 3 deletions bin/nanocld/src/models/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use nanocl_stubs::{
system::{Event, EventPartial, NativeEventAction, EventActor, EventKind},
};

use crate::{version, utils, repositories::generic::*};
use crate::{vars, utils, repositories::generic::*};

use super::{Pool, EventDb, RawEventEmitter, RawEventClient};

Expand Down Expand Up @@ -165,7 +165,7 @@ impl SystemState {
docker_api: docker.clone(),
config: conf.to_owned(),
event_manager: EventManager::new(),
version: version::VERSION.to_owned(),
version: vars::VERSION.to_owned(),
};
Ok(system_state)
}
Expand Down Expand Up @@ -222,7 +222,7 @@ impl SystemState {
{
let actor = actor.clone().into();
let event = EventPartial {
reporting_controller: "nanocl.io/core".to_owned(),
reporting_controller: vars::CONTROLLER_NAME.to_owned(),
reporting_node: self.config.hostname.clone(),
kind: EventKind::Normal,
action: action.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion bin/nanocld/src/objects/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
use super::generic::*;

impl ObjProcess for CargoDb {
fn get_kind() -> ProcessKind {
fn get_process_kind() -> ProcessKind {
ProcessKind::Cargo
}
}
Expand Down
Loading
Loading