-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs platform/#2978: implement init filesystem and seed archives feature
- Loading branch information
Showing
8 changed files
with
228 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,86 @@ | ||
# Docker MinIO | ||
|
||
This is a simple docker image for running a minio server. It is based on alpine linux and uses the minio and minio-client packages from the alpine package repository. | ||
This is a simple docker image for running a MinIO server. It is based on alpine linux and uses the `minio` and `minio-client` packages from the alpine package repository. | ||
|
||
The `/scripts/entrypoint.sh` script is used to start the minio server. It is possible to configure the container to create and populate the new bucket at startup by setting the `BUCKET_NAME` environment variable and adding the seed files to the folder defined by the `INITFILES_FOLDER` environment variable. | ||
The `/scripts/entrypoint.sh` script is used to start the MinIO server. It is possible to configure the container to create and populate the new bucket at startup by setting the `BUCKET_NAME` environment variable. | ||
|
||
## Bucket initialization | ||
|
||
You can use two different methods to initialize the bucket: the `FileSystem` initialization and the `Seed` initialization. | ||
|
||
## FileSystem initialization | ||
|
||
If the `INITFILESYSTEM_FOLDER` path is not empty, the files in the folder are copied to the `BUCKET_ROOT` destination folder as a startup filesystem for the MinIO server. **The folder must contain a valid MinIO filesystem structure.** **ATTENTION**: when the `INITFILESYSTEM_FOLDER` is used, the startup process takes care of checking that the `BUCKET_NAME` is configured accordingly with the final MinIO server configuration, performing the filesystem check (the `BUCKET_NAME` folder is present in the `BUCKET_ROOT` folder) and the MinIO client check (the `mc ls ${MC_ALIAS}/${BUCKET_NAME}` command does not return an error). | ||
|
||
If this initialization method is used, **no other initialization actions are performed**. The final bucket content is only the data present in the `INITFILESYSTEM_FOLDER` folder. | ||
|
||
## Seed initialization | ||
|
||
This initialization method is used to populate the bucket with **seed archives and files**. Both the archives and the files are processed at startup, and the resulting bucket content is the union of the archives and files content. | ||
|
||
The archives are processed first, and then the files. So, if the file with the same name is present in one or more archives and in the `INITFILES_FOLDER` folder, the file in the `INITFILES_FOLDER` will overwrite the files in the archives. If the bucket has a versioning enabled, the previous versions of the files are preserved. See the [Versioning enabled example](#versioning-enabled-example) for more details. | ||
|
||
If the `DO_NOT_PROCESS_INITFILES` environment variable is set to `1`, the seed archives and files are not processed at startup. | ||
|
||
### Process the seed archives | ||
|
||
If the `INITARCHIVES_FOLDER` path is not empty, the archives in the folder are extracted in a temporary folder and all the resulting files and folders are uploaded in the bucket defined by the `BUCKET_NAME` environment variable using the MinIO client (`mc cp --recursive`). The archives are extracted and files are uploaded sequentially in the alphabetical order of the filenames, using the output of the `ls -A ${INITARCHIVES_FOLDER}` command. So, if the archives contain the same files, the last archive extracted will overwrite the files extracted by the previous archives. If the bucket has a versioning enabled, the previous versions of the files are preserved. | ||
|
||
**The supported archive formats are `.zip`, `.tar`, `.tar.gz`, `.tar.bz2` and `.tar.xz`.** | ||
|
||
### Process the seed files | ||
|
||
If the `INITFILES_FOLDER` path is not empty, the files in the folder are uploaded in the bucket defined by the `BUCKET_NAME` environment variable using the MinIO client (`mc cp --recursive`). As for the archives, if the `INITFILES_FOLDER` contains files with the same name of one or more files already present in the bucket (processed by the `INITARCHIVES_FOLDER`), the files in the `INITFILES_FOLDER` will overwrite the files in the bucket. If the bucket has a versioning enabled, the previous versions of the files are preserved. | ||
|
||
### Versioning enabled example | ||
|
||
To be more clear, here is an example of the initialization process if the versioning is enabled: | ||
|
||
1. The `INITARCHIVES_FOLDER` contains the following archives: | ||
- `archive1.zip` with the files `file1.txt` and `file2.txt` | ||
- `archive2.tar.xz` with the files `file2.txt` and `file3.txt` | ||
2. The `INITFILES_FOLDER` contains the following files: | ||
- `file2.txt` | ||
- `file3.txt` | ||
- `file4.txt` | ||
- `file5.txt` | ||
|
||
The resulting bucket content will be: | ||
|
||
- `file1.txt` with the content of the `archive1.zip` file | ||
- `file2.txt`, in the current version, with the content of the `INITFILES_FOLDER` file | ||
- `file2.txt`, in the first version, with the content of the `archive1.zip` file | ||
- `file2.txt`, in the second version, with the content of the `archive2.tar.xz` file | ||
- `file3.txt`, in the current version, with the content of the `INITFILES_FOLDER` file | ||
- `file3.txt`, in the first version, with the content of the `archive2.tar.xz` file | ||
- `file4.txt` with the content of the `INITFILES_FOLDER` file | ||
- `file5.txt` with the content of the `INITFILES_FOLDER` file | ||
|
||
## Environment Variables | ||
|
||
| Variable | Description | Default | | ||
| -------------------------- | ----------------------------------------------------------- | -------------------------------- | | ||
| `BUCKET_NAME` | The name of the bucket to create and populate at startup. | `-` | | ||
| `BUCKET_ROOT` | The folder used by the minio server to store the files. | `/data` | | ||
| `INITFILES_FOLDER` | The folder where the seed files are stored. | `/docker-entrypoint-initfiles.d` | | ||
| `DO_NOT_PROCESS_INITFILES` | If set to `1`, the seed files are not processed at startup. | `0` | | ||
| `MINIO_VERSION_ENABLED` | If set to `1`, the minio version is enabled. | `0` | | ||
| `MINIO_ROOT_USER` | The access key used to authenticate with the minio server. | `-` | | ||
| `MINIO_ROOT_PASSWORD` | The secret key used to authenticate with the minio server. | `-` | | ||
| `MINIO_BROWSER` | If set to `on`, the minio console is enabled. | `off` | | ||
| `MINIO_CONSOLE_PORT` | The port used by the minio console. | `9001` | | ||
| `MINIO_OPTS` | Additional options to pass to the minio server. | `-` | | ||
| `MC_ALIAS` | The alias used by the minio client. | `minio` | | ||
| `MINIO_PROTO` | The protocol used to connect to the minio server. | `http` | | ||
| `MINIO_HOST` | The host used to connect to the minio server. | `localhost` | | ||
| `MINIO_PORT` | The port used to connect to the minio server. | `9000` | | ||
| Variable | Description | Default | | ||
| -------------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | | ||
| `BUCKET_NAME` | The name of the bucket to create and populate at startup. | `-` | | ||
| `BUCKET_ROOT` | The folder used by the MinIO server to store the files. | `/data` | | ||
| `INITFILESYSTEM_FOLDER` | The folder where the root init filesystem is stored. If not empty, the files are copied to the `BUCKET_ROOT` folder. | `/docker-entrypoint-initfs.d` | | ||
| `INITARCHIVES_FOLDER` | The folder where the seed archives are stored. | `/docker-entrypoint-initarchives.d` | | ||
| `INITFILES_FOLDER` | The folder where the seed files are stored. | `/docker-entrypoint-initfiles.d` | | ||
| `DO_NOT_PROCESS_INITFILES` | If set to `1`, the seed archives and files are not processed at startup. | `0` | | ||
| `MINIO_ROOT_USER` | The access key used to authenticate with the MinIO server. | `-` | | ||
| `MINIO_ROOT_PASSWORD` | The secret key used to authenticate with the MinIO server. | `-` | | ||
| `MINIO_VERSION_ENABLED` | If set to `1`, the MinIO version is enabled. | `0` | | ||
| `MINIO_OPTS` | Additional options to pass to the MinIO server. | `-` | | ||
| `MINIO_BROWSER` | If set to `on`, the MinIO console is enabled. | `off` | | ||
| `MINIO_CONSOLE_PORT` | The port used by the MinIO console. | `9001` | | ||
| `MC_ALIAS` | The alias used by the MinIO client. | `minio` | | ||
| `MINIO_PROTO` | The protocol used to connect to the MinIO server. | `http` | | ||
| `MINIO_HOST` | The host used to connect to the MinIO server. | `localhost` | | ||
| `MINIO_PORT` | The port used to connect to the MinIO server. | `9000` | | ||
|
||
### Deprecated Variables | ||
|
||
| Variable | Description | | ||
| ------------------ | ------------------------------------------------------------------------------------------------- | | ||
| `OSB_BUCKET` | The name of the bucket to create and populate at startup. **Use `BUCKET_NAME` instead.** | | ||
| `MINIO_ACCESS_KEY` | The access key used to authenticate with the minio server. **Use `MINIO_ROOT_USER` instead.** | | ||
| `MINIO_SECRET_KEY` | The secret key used to authenticate with the minio server. **Use `MINIO_ROOT_PASSWORD` instead.** | | ||
| `MINIO_ACCESS_KEY` | The access key used to authenticate with the MinIO server. **Use `MINIO_ROOT_USER` instead.** | | ||
| `MINIO_SECRET_KEY` | The secret key used to authenticate with the MinIO server. **Use `MINIO_ROOT_PASSWORD` instead.** | |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.