1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +02:00

experimental multi-s3 support

This commit is contained in:
Robin Appelman 2023-02-03 15:57:46 +01:00
commit 6f78480b48
7 changed files with 60 additions and 13 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
flake.lock -diff

26
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
@ -20,11 +20,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1662220400,
"narHash": "sha256-9o2OGQqu4xyLZP9K6kNe1pTHnyPz0Wr3raGYnr9AIgY=",
"lastModified": 1671096816,
"narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=",
"owner": "nix-community",
"repo": "naersk",
"rev": "6944160c19cb591eb85bbf9b2f2768a935623ed3",
"rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114",
"type": "github"
},
"original": {
@ -35,9 +35,10 @@
},
"nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-h+4F8intTl5QFb+Yv9e4xH1p5FSbHlmbCavxnuoFFSE=",
"path": "/nix/store/k0ag5ji9grl4v14xsj1hyvbdzghyr578-source",
"lastModified": 1674407282,
"narHash": "sha256-2qwc8mrPINSFdWffPK+ji6nQ9aGnnZyHSItVcYDZDlk=",
"path": "/nix/store/47v7isgz6w8zgb1224d46lwvwkdd69bm-source",
"rev": "ab1254087f4cdf4af74b552d7fc95175d9bdbb49",
"type": "path"
},
"original": {
@ -47,9 +48,10 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 0,
"narHash": "sha256-h+4F8intTl5QFb+Yv9e4xH1p5FSbHlmbCavxnuoFFSE=",
"path": "/nix/store/k0ag5ji9grl4v14xsj1hyvbdzghyr578-source",
"lastModified": 1674407282,
"narHash": "sha256-2qwc8mrPINSFdWffPK+ji6nQ9aGnnZyHSItVcYDZDlk=",
"path": "/nix/store/47v7isgz6w8zgb1224d46lwvwkdd69bm-source",
"rev": "ab1254087f4cdf4af74b552d7fc95175d9bdbb49",
"type": "path"
},
"original": {

View file

@ -40,7 +40,7 @@ RUN DEBIAN_FRONTEND=noninteractive ;\
apt-get update && \
apt-get install --assume-yes blackfire
ADD configs/autoconfig_mariadb.php configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/s3mb.php configs/swift.php configs/swiftv3.php configs/azure.php configs/config.php /root/
ADD configs/autoconfig_mariadb.php configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/s3m.php configs/s3mb.php configs/swift.php configs/swiftv3.php configs/azure.php configs/config.php /root/
ADD configs/nginx-app.conf /etc/nginx/
RUN mkdir --parent /var/log/cron

View file

@ -0,0 +1,32 @@
'objectstore' => [
'default' => [
'class' => 'OC\Files\ObjectStore\S3',
'arguments' => [
'multibucket' => true,
'num_buckets' => 64,
'bucket' => 'nextcloud-',
'autocreate' => true,
'key' => 'dummy',
'secret' => 'dummyj',
'hostname' => 's3',
'port' => 4566,
'use_ssl' => false,
'use_path_style' => true,
'uploadPartSize' => 52428800,
],
],
'root' => [
'class' => 'OC\Files\ObjectStore\S3',
'arguments' => [
'bucket' => 'nextcloud-root',
'autocreate' => true,
'key' => 'dummy',
'secret' => 'asd',
'hostname' => 's3',
'port' => 4566,
'use_ssl' => false,
'use_path_style' => true,
'uploadPartSize' => 52428800,
],
],
],

View file

@ -50,6 +50,11 @@ then
sed -i '/\/\/PLACEHOLDER/ r /root/s3mb.php' /var/www/html/config/config.php
fi
if [ -n "$S3M" ]
then
sed -i '/\/\/PLACEHOLDER/ r /root/s3m.php' /var/www/html/config/config.php
fi
if [ -n "$SWIFT" ]
then
sed -i '/\/\/PLACEHOLDER/ r /root/swift.php' /var/www/html/config/config.php

View file

@ -88,6 +88,7 @@ impl Service {
pub fn from_type(ty: &str) -> Option<&'static [Self]> {
match ty {
"s3" => Some(&[Service::ObjectStore(ObjectStore::S3)]),
"s3m" => Some(&[Service::ObjectStore(ObjectStore::S3m)]),
"s3mb" => Some(&[Service::ObjectStore(ObjectStore::S3mb)]),
"azure" => Some(&[Service::ObjectStore(ObjectStore::Azure)]),
"ldap" => Some(&[Service::LDAP(LDAP), Service::LDAPAdmin(LDAPAdmin)]),

View file

@ -12,6 +12,7 @@ use miette::IntoDiagnostic;
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ObjectStore {
S3,
S3m,
S3mb,
Azure,
}
@ -20,6 +21,7 @@ impl ObjectStore {
fn image(&self) -> &str {
match self {
ObjectStore::S3 => "localstack/localstack:0.14.3",
ObjectStore::S3m => "localstack/localstack:0.14.3",
ObjectStore::S3mb => "localstack/localstack:0.14.3",
ObjectStore::Azure => "arafato/azurite:2.6.5",
}
@ -28,6 +30,7 @@ impl ObjectStore {
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::Azure => vec![],
}
@ -35,6 +38,7 @@ impl ObjectStore {
fn host_name(&self) -> &str {
match self {
ObjectStore::S3 => "s3",
ObjectStore::S3m => "s3",
ObjectStore::S3mb => "s3",
ObjectStore::Azure => "azure",
}
@ -46,6 +50,7 @@ impl ServiceTrait for ObjectStore {
fn name(&self) -> &str {
match self {
ObjectStore::S3 => "s3",
ObjectStore::S3m => "s3m",
ObjectStore::S3mb => "s3mb",
ObjectStore::Azure => "azure",
}
@ -54,6 +59,7 @@ impl ServiceTrait for ObjectStore {
fn env(&self) -> &[&str] {
match self {
ObjectStore::S3 => &["S3=1"],
ObjectStore::S3m => &["S3M=1"],
ObjectStore::S3mb => &["S3MB=1"],
ObjectStore::Azure => &["AZURE=1"],
}