mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
switch to minio for s3
This commit is contained in:
parent
b726358e60
commit
ce6f5c0d4c
5 changed files with 28 additions and 28 deletions
2
.github/workflows/docker.yaml
vendored
2
.github/workflows/docker.yaml
vendored
|
|
@ -37,7 +37,6 @@ jobs:
|
|||
context: "images/php"
|
||||
push: true
|
||||
tags: icewind1991/haze-php:${{ matrix.php-version }}${{ matrix.variant }}
|
||||
dockerfile: "images/php/Dockerfile"
|
||||
build-args: |
|
||||
PHP_VERSION=${{ matrix.php-version }}
|
||||
BASE_IMAGE=${{ matrix.variant == '-dbg' && 'icewind1991/php-dbg' || 'php' }}
|
||||
|
|
@ -50,7 +49,6 @@ jobs:
|
|||
context: "images/haze"
|
||||
push: true
|
||||
tags: icewind1991/haze:${{ matrix.php-version }}${{ matrix.variant }}
|
||||
dockerfile: "images/haze/Dockerfile"
|
||||
build-args: |
|
||||
PHP_VERSION=${{ matrix.php-version }}${{ matrix.variant }}
|
||||
cache-from: type=gha
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
'arguments' => [
|
||||
'bucket' => 'nextcloud',
|
||||
'autocreate' => true,
|
||||
'key' => 'dummy',
|
||||
'secret' => 'dummyj',
|
||||
'key' => 'minio',
|
||||
'secret' => 'minio123',
|
||||
'hostname' => 's3',
|
||||
'port' => 4566,
|
||||
'port' => 9000,
|
||||
'use_ssl' => false,
|
||||
'use_path_style' => true,
|
||||
'uploadPartSize' => 52428800,
|
||||
|
|
|
|||
|
|
@ -172,6 +172,10 @@ pub async fn container_logs(
|
|||
pub struct ExitCode(i64);
|
||||
|
||||
impl ExitCode {
|
||||
pub fn is_ok(&self) -> bool {
|
||||
self.0 == 0
|
||||
}
|
||||
|
||||
pub fn to_result(&self) -> Result<()> {
|
||||
match self.0 {
|
||||
0 => Ok(()),
|
||||
|
|
|
|||
|
|
@ -13,10 +13,11 @@ use std::str::FromStr;
|
|||
use std::time::Duration;
|
||||
use tokio::time::{sleep, timeout};
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Default)]
|
||||
#[allow(dead_code)]
|
||||
pub enum PhpVersion {
|
||||
Php82,
|
||||
#[default]
|
||||
Php81,
|
||||
Php80,
|
||||
Php74,
|
||||
|
|
@ -184,9 +185,3 @@ impl PhpVersion {
|
|||
.wrap_err("Timeout after 15 seconds")
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PhpVersion {
|
||||
fn default() -> Self {
|
||||
PhpVersion::Php81
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,29 +20,35 @@ pub enum ObjectStore {
|
|||
impl ObjectStore {
|
||||
fn image(&self) -> &str {
|
||||
match self {
|
||||
ObjectStore::S3 => "localstack/localstack:2.1.0",
|
||||
ObjectStore::S3m => "localstack/localstack:2.1.0",
|
||||
ObjectStore::S3mb => "localstack/localstack:2.1.0",
|
||||
ObjectStore::S3 | ObjectStore::S3m | ObjectStore::S3mb => {
|
||||
"minio/minio:RELEASE.2023-01-20T02-05-44Z.hotfix.b9b60d73d"
|
||||
}
|
||||
ObjectStore::Azure => "arafato/azurite:2.6.5",
|
||||
}
|
||||
}
|
||||
|
||||
fn self_env(&self) -> Vec<&str> {
|
||||
match self {
|
||||
ObjectStore::S3 => vec!["DEBUG=1", "SERVICES=s3"],
|
||||
ObjectStore::S3m => vec!["DEBUG=1", "SERVICES=s3"],
|
||||
ObjectStore::S3mb => vec!["DEBUG=1", "SERVICES=s3"],
|
||||
ObjectStore::S3 | ObjectStore::S3m | ObjectStore::S3mb => {
|
||||
vec!["MINIO_ACCESS_KEY=minio", "MINIO_SECRET_KEY=minio123"]
|
||||
}
|
||||
ObjectStore::Azure => vec![],
|
||||
}
|
||||
}
|
||||
|
||||
fn host_name(&self) -> &str {
|
||||
match self {
|
||||
ObjectStore::S3 => "s3",
|
||||
ObjectStore::S3m => "s3",
|
||||
ObjectStore::S3mb => "s3",
|
||||
ObjectStore::S3 | ObjectStore::S3m | ObjectStore::S3mb => "s3",
|
||||
ObjectStore::Azure => "azure",
|
||||
}
|
||||
}
|
||||
|
||||
fn args(&self) -> &[&str] {
|
||||
match self {
|
||||
ObjectStore::S3 | ObjectStore::S3m | ObjectStore::S3mb => &["server", "/data"],
|
||||
_ => &[],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
|
|
@ -88,6 +94,7 @@ impl ServiceTrait for ObjectStore {
|
|||
"haze-type" => self.name(),
|
||||
"haze-cloud-id" => cloud_id
|
||||
}),
|
||||
cmd: Some(self.args().into()),
|
||||
networking_config: Some(NetworkingConfig {
|
||||
endpoints_config: hashmap! {
|
||||
network => EndpointSettings {
|
||||
|
|
@ -114,20 +121,16 @@ impl ServiceTrait for ObjectStore {
|
|||
match self {
|
||||
ObjectStore::S3 | ObjectStore::S3mb => {
|
||||
let mut output = Vec::new();
|
||||
exec(
|
||||
let exit = exec(
|
||||
docker,
|
||||
format!("{}-object", cloud_id),
|
||||
"root",
|
||||
vec!["curl", "localhost:4566/health"],
|
||||
vec!["curl", "localhost:9000/minio/health/ready"],
|
||||
vec![],
|
||||
Some(&mut output),
|
||||
)
|
||||
.await?;
|
||||
let output = String::from_utf8(output).into_diagnostic()?;
|
||||
Ok(
|
||||
output.contains(r#""s3": "running""#)
|
||||
|| output.contains(r#""s3": "available""#),
|
||||
)
|
||||
Ok(exit.is_ok())
|
||||
}
|
||||
_ => {
|
||||
let info = docker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue