diff --git a/README.md b/README.md index 6805083..802fa51 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ _a simple image hosting service_ ## Usage ### Running ``` -pict-rs 0.3.0-alpha.42 +pict-rs 0.3.0-alpha.43 USAGE: pict-rs [FLAGS] [OPTIONS] [SUBCOMMAND] @@ -33,6 +33,7 @@ OPTIONS: --max-image-area Specify the maximum area in pixels allowed in an image --max-image-height Specify the maximum width in pixels allowed on an image --max-image-width Specify the maximum width in pixels allowed on an image + --migrate-file Path to a file defining a store migration -o, --opentelemetry-url Enable OpenTelemetry Tracing exports to the given OpenTelemetry collector @@ -41,11 +42,11 @@ OPTIONS: SUBCOMMANDS: file-store help Prints this message or the help of the given subcommand(s) - s3-store + s3-store ``` ``` -pict-rs-file-store 0.3.0-alpha.42 +pict-rs-file-store 0.3.0-alpha.43 USAGE: pict-rs file-store [OPTIONS] @@ -55,11 +56,11 @@ FLAGS: -V, --version Prints version information OPTIONS: - --path + --path Path in which pict-rs will create it's 'files' directory ``` ``` -pict-rs-s3-store 0.3.0-alpha.42 +pict-rs-s3-store 0.3.0-alpha.43 USAGE: pict-rs s3-store [OPTIONS] --bucket-name --region @@ -70,14 +71,16 @@ FLAGS: OPTIONS: --access-key - --bucket-name - --region + --bucket-name Name of the bucket in which pict-rs will store images + --region Region in which the bucket exists, can be an http endpoint --secret-key --security-token - --session-token + --session-token ``` -See [`pict-rs.toml`](https://git.asonix.dog/asonix/pict-rs/src/branch/main/pict-rs.toml) for more configuration +See [`pict-rs.toml`](https://git.asonix.dog/asonix/pict-rs/src/branch/main/pict-rs.toml) and +[`migrate.toml`](https://git.asonix.dog/asonix/pict-rs/src/branch/main/migrate.toml) for more +configuration #### Example: Running on all interfaces, port 8080, storing data in /opt/data diff --git a/migrate.toml b/migrate.toml new file mode 100644 index 0000000..72381b7 --- /dev/null +++ b/migrate.toml @@ -0,0 +1,13 @@ +## Store config where files currently exist +# see [store] documentation in pict-rs.toml for more info +[from] +type = "file_store" + +## Store config where files will be moved to +# see [store] documentation in pict-rs.toml for more info +[to] +type = 's3_store' +bucket_name = 'pict-rs' +region = 'http://minio:9000' +access_key = '09ODZ3BGBISV4U92JLIM' +secret_key = 'j35YE9RrxhBP0dpiD5mmdXRXvPkEJR4k6zK12q3o' diff --git a/src/upload_manager.rs b/src/upload_manager.rs index a66f9b0..1de0848 100644 --- a/src/upload_manager.rs +++ b/src/upload_manager.rs @@ -150,6 +150,10 @@ impl UploadManager { settings?; } + // clean up the migration key to avoid interfering with future migrations + self.inner.settings_tree.remove(STORE_MIGRATION_PROGRESS)?; + self.inner.settings_tree.flush_async().await?; + Ok(()) }