Elasticsearch: how to make snapshot to minio s3? - docker

when i am trying to make snapshots to my s3 (minio deployed locally), by executing the following command inside my elasticsearch docker container:
curl -X PUT "localhost:9200/_snapshot/s3_repository/snapshot_1?wait_for_completion=true&pretty"
i got the following :
{
"error" : {
"root_cause" : [
{
"type" : "repository_exception",
"reason" : "[s3_repository] Could not determine repository generation from root blobs"
}
],
"type" : "repository_exception",
"reason" : "[s3_repository] Could not determine repository generation from root blobs",
"caused_by" : {
"type" : "i_o_exception",
"reason" : "Exception when listing blobs by prefix [index-]",
"caused_by" : {
"type" : "sdk_client_exception",
"reason" : "Unable to execute HTTP request: my-first-bucket.s3",
"caused_by" : {
"type" : "unknown_host_exception",
"reason" : "my-first-bucket.s3"
}
}
}
},
"status" : 500
}
Any help please ?
Notice, i created s3_repository using the followig :
curl -XPUT 'http://localhost:9200/_snapshot/s3_repository?verify=false&pretty' -H 'Content-Type: application/json' -d'
{
"type": "s3",
"settings": {
"bucket": "my-first-bucket",
"endpoint": "http://s3:9000"
}
}'
Notice s3 in http://s3:9000 is the name of the service minio in my docker-compose.yml
Thank you in advance!

Most likely the problem here is that the bucket is not created at MinIO startup. The environment variable MINIO_DEFAULT_BUCKETS is not officially supported by MinIO at least. After MinIO starts, you can try to confirm if the bucket exists as expected.
As the bucket only needs to be created once, you could do it via a script after MinIO starts.
Please know you can find us at https://slack.min.io/ 24/7/365. If you have commercial questions, please reach out to us on hello#min.io or on our Ask an Expert Chat functionality at https://min.io/pricing?action=talk-to-us.

Related

Migrating Elasticsearch logs to a different cluster

I have an Elasticsearch deployment on Kubernetes (AKS). I'm using the official Elastic's docker images for deployments. Logs are being stored in a persistent Azure Disk. How can I migrate some of these logs to another cluster with a similar setup? Only those logs that matches a filter condition based on datetime of the logs needs to be migrated.
Please use Reindex API for achieving the same
POST _reindex
{
"source": {
"remote": {
"host": "http://oldhost:9200",
"username": "user",
"password": "pass"
},
"index": "source",
"query": {
"match": {
"test": "data"
}
}
},
"dest": {
"index": "dest"
}
}
Note:
Run the aforementioned command on your target instance.
Make sure that the source instance is whitelisted in elasticsearch.yml
reindex.remote.whitelist: oldhost:9200
Run the process asynchronously using below query param
POST _reindex?wait_for_completion=false

Using private docker images in AWS Beanstalk

I have tried following the documentation on this link :
<https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-images-private>
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-alami
My .dockercfg file looks something like this:
{
"https://index.docker.io/v1/" :
{
"auth" : "username:pwd [base 64 enc]",
"email" : "email_id"
}
}
I'm trying to pull a private image from Docker hub and my Dockerrun.aws.json looks something like this :
{
"AWSEBDockerrunVersion": "1",
"Authentication": {
"Bucket": "my-bucket",
"Key": ".dockercfg"
},
"Image": {
"Name": "dishvy/imgname:tag",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "80"
}
],
"Volumes": [
{
"HostDirectory": "/var/app/mydb",
"ContainerDirectory": "/etc/mysql"
}
],
"Logging": "/var/log/nginx"
}
I have added the dockercfg file at the root of the bucket. And when i'm trying to deploy this to AWS Beanstalk, I get this error :
Error response from daemon: pull access denied for dishvy/imgname:tag, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
This essentially means my authentication file on S3 isn't correct but i followed the steps given in documentation and can't figure out where i went wrong. Can anybody help me out here?

502 Bad Gateway nginx/1.13.12 on localhost while creating a new policy in ditto

I am new to docker, I'm using docker on windows 10 and am using Eclipse Ditto and Eclipse Mosquitto, I have to create a twin device. Before that I have to create a new policy via Postman,
While executing the policy am getting the following error:
The code to create the new policy is ass follow
curl -X put 'http://localhost:8080/api/2/policies/my.test:policy' -u 'ditto:ditto' -H 'Content-Type: application/json' -d '{
"entries": {
"owner": {
"subjects": {
"nginx:ditto": {
"type": "nginx basic auth user"
}
},
"resources": {
"thing:/": {
"grant": [
"READ","WRITE"
],
"revoke": []
},
"policy:/": {
"grant": [
"READ","WRITE"
],
"revoke": []
},
"message:/": {
"grant": [
"READ","WRITE"
],
"revoke": []
}
}
}
}
}'
I'm following the procedure given in this link
is there any solution to solve this kind of problem?
Seems that the Eclipse Ditto gateway service was not running correctly.
I'm confident that you figured out to look at the output of docker-compose ps and restarted the services.

How to get the dockerTag label via the Artifactory API?

I am using Artifactory Version 4.16.0 and need to retrieve the Docker Info Label used to tag my image using the Artifactory API.
The label is definitely set as it appears in the Artifactory UI, under the Docker Info panel, in the Label key-value section.
Using the following API I can see the manifest.json
curl -uadmin:pass https://artifacts.mycompany.com/artifactory/api/storage/my-docker-dev/my-component/my-image-1.0.0-1498449060
but this does not contain the Docker Label I am after. I read the documentation, but cannot figure out how I can achieve this.
The access the build properties, which include the Docker labels, the name of the artefact must be followed by /manifest.json?properties
e.g.:
curl -uadmin:pass https://artifacts.my-company.com/artifactory/api/storage/my-docker-dev/my-component/my-image-1.0.0-1498449060/manifest.json?properties
returns something like
{
"properties" : {
"docker.label.com.my-company.repository.commit.full" : [ "4fb524c0cb2139b15074b348bddb1952fa68deb1" ],
"docker.label.com.my-company.repository.commit.short" : [ "4fb52" ],
"docker.manifest" : [ "develop-1.0.0-1498449060" ],
"docker.manifest.type" : [ "application/vnd.docker.distribution.manifest.v2+json" ],
"docker.repoName" : [ "my-component" ],
"sha256" : [ "0c8f855fbd7f6065972eec9a8ca7e48980f19sd3db07c47751bbe17043ddda4d" ]
},
"uri" : "https://artifacts.my-company.com/artifactory/api/storage/my-docker-dev/my-component/develop-1.0.0-1498449060/manifest.json"
}

Any API or Web UI project to manage a Docker private registry?

I can't find how to manage images in a private registry. I can push or pull an image because i know the id but how to get the list of pushed images ?
Take for example a person who wants to see the available images under the private registry of his organization. How can she do ?
Unless I'm mistaken, I can't find API or Web UI to discover the registry content like the index.docker.io do with the public registry.
Are there any open source projects to manage this ?
thanks.
Are there any open source projects to manage this ?
There is a containerized web application that provides administration of one-to-many private registries. Its name is Docker Registry UI and it is FOSS.
The source is on Github and you can run it in a container like so:
docker run -p 8080:8080 -v my_data_dir:/var/lib/h2/ atcol/docker-registry-ui
Disclaimer: I wrote the web-app as I could not find one myself. I believe this answers your question (as quoted).
Thanks Thomas !
To allow the use of the search API, you must start the container by specifying the value of the environment variable SEARCH_BACKEND like this :
docker run -d -e SEARCH_BACKEND=sqlalchemy -p 5000:5000 --name registry samalba/docker-registry
Then i have a result for this query :
GET http://registry_host:5000/v1/search?q=base
Result :
{
"num_results": 1,
"query": "base",
"results": [{"description": "", "name": "test/base-img"}]
}
To list all images, you can do this :
GET http://registry_host:5000/v1/search
Result :
{
"num_results": 2,
"query": "",
"results": [
{"description": "", "name": "test/base-img"},
{"description": "", "name": "test/base-test"}]
}
And to know the available versions of an image :
GET http://localhost:5000/v1/repositories/**test/base-img**/tags
Result :
{
"0.1": "04e073e1efd31f50011dcde9b9f4d3148ecc4da94c0b7ba9abfadef5a8522d13",
"0.2": "04e073e1efd31f50011dcde9b9f4d3148ecc4da94c0b7ba9abfadef5a8522d13",
"0.3": "04e073e1efd31f50011dcde9b9f4d3148ecc4da94c0b7ba9abfadef5a8522d13"
}
I've written a docker-registry-frontend that you can find on github. It allows you to browse your private registry and do almost everything that is available through the Docker registry API v1. Plus, it can be run as a docker container on its own.
Here's a list of basic features with some screenshots: https://github.com/kwk/docker-registry-frontend/wiki/Features. In addition to these features, there's support for SSL encryption and Kerberos authentication.
I want to present for you, my frontend for private registry, you may try it from github or dockerhub.
Also you can find interface screenshots there.
To sum up it has:
- internal db (BoltBD) gives it ability to store info, and as result it responses much more faster then after direct api call like in other projects
- app can pars, store and show info from registry such as:
- image layers info:
- name / tag
- image size and pushes number
- upload and push dates
- image creating commands history
- it is possible to set multiple repositories in case you have more than one registries and observe them in one place
- show statistics pretty, draw curves for uploads number and image sizes for tag with respects to dates
Update 2017-02-15
So far also there was added:
find a parent
show tree-graph of parents
image deletion
Bearer token auth support
As far as I see, the Docker registry has a REST API, very similar to Docker itself. You can find the documentation at http://docs.docker.io/reference/api/registry_api/. But on the first glance I don't see a method to just list all images.
There is also an REST API for the official index (infos at http://docs.docker.io/reference/api/docker-io_api/).
EDIT
I just tested the Docker registry API and it is not so self-explanatory. You can query all images of a certain repository. In my case, my repository is called "thomas/busybox". I can query all images in there by calling:
https://my-private-registry.com/v1/repositories/thomas/busybox/images
Result:
[
{
"id": "2d8e5b282c81244037eb15b2068e1c46319c1a42b80493acb128da24b2090739"
},
{
"id": "6c991eb934609424f761d3d0a7c79f4f72b76db286aa02e617659ac116aa7758"
},
{
"id": "9f4e93171ec525221fa9013d0e21f8690cef68590664eb5249e0b324c5faf31a"
},
{
"id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"
}
]
Now I know that I have four images in my repository and I can query every image. The query for the first image would be:
https://my-private-registry.com/v1/images/2d8e5b282c81244037eb15b2068e1c46319c1a42b80493acb128da24b2090739/json
Result:
{
"id": "2d8e5b282c81244037eb15b2068e1c46319c1a42b80493acb128da24b2090739",
"parent": "9f4e93171ec525221fa9013d0e21f8690cef68590664eb5249e0b324c5faf31a",
"created": "2014-04-24T15:59:59.47081913Z",
"container": "d15320d6935ca35bc4198e373f29e730f4c53cce32b3809c2fecec22eb30018b",
"container_config": {
"Hostname": "4964db5b599b",
...
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"HOME=\/",
"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin"
],
"Cmd": [
"\/bin\/sh",
"-c",
"#(nop) CMD [\/bin\/sh -c \/bin\/sh]"
],
"Image": "9f4e93171ec525221fa9013d0e21f8690cef68590664eb5249e0b324c5faf31a",
...
"OnBuild": [
]
},
"docker_version": "0.10.0",
"author": "J\u00c3\u00a9r\u00c3\u00b4me Petazzoni <jerome#docker.com>",
"config": {
"Hostname": "4964db5b599b",
"Domainname": "",
"User": "",
"Memory": 0,
...
"Env": [
"HOME=\/",
"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin"
],
"Cmd": [
"\/bin\/sh",
"-c",
"\/bin\/sh"
],
"Image": "9f4e93171ec525221fa9013d0e21f8690cef68590664eb5249e0b324c5faf31a",
...
"OnBuild": [
]
},
"architecture": "amd64",
"os": "linux",
"Size": 0
}
You can also search for an image, but I do not get any results:
https://my-private-registry.com/v1/search?q=thomas
Result:
{"num_results": 0, "query": "thomas", "results": []}
Sonatype Nexus Repository Manager 3.0 has Private Registry for Docker

Resources