Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage Driver for Aliyun OSS #514

Merged
merged 20 commits into from
Aug 4, 2015
Merged

Storage Driver for Aliyun OSS #514

merged 20 commits into from
Aug 4, 2015

Conversation

denverdino
Copy link
Contributor

This driver implements the storagedriver.StorageDriver interface and uses Aliyun OSS Open Storage Service as storage backend.

The documentation for this driver is in https://github.com/denverdino/distribution/blob/master/docs/storage-drivers/oss.md

To run the unit test case for this driver, you need set the following environment variables before

export ALIYUN_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID>
export ALIYUN_ACCESS_KEY_SECRET=<YOUR_ACCESS_SECRET>
export OSS_REGION=<OSS_REGION_ID>   E.g. oss-us-west-1
export OSS_BUCKET=<OSS_BUCKET_NAME>
export OSS_ENCRYPT=false

NOTE: This driver reuses the code logic from the S3 driver.

Signed-off-by: Li Yi ([email protected]) Boshi Lian([email protected])

@stevvooe
Copy link
Collaborator

@denverdino This looks like a duplicate of #513. Which one would you like to keep?

@denverdino
Copy link
Contributor Author

@stevvooe, Steve

This is looking like a straight copy paste from the s3 driver? Any way we can modify the s3 driver to support Aliyun OSS?

If we can abstract S3 driver with the interface, we can have the Aliyun OSS implementation. And currently, I provide the Aliyun OSS GO API in https://github.com/denverdino/aliyungo which refers the API of https://github.com/AdRoll/goamz. So, it should be easy to provide the OSS impl with that.

@stevvooe
Copy link
Collaborator

@denverdino Why can't the s3 driver be used directly? What is missing? What is different?

@denverdino
Copy link
Contributor Author

@stevvooe ,
The current S3 driver is using the impl of github.com/AdRoll/goamz. OSS API is similar to S3, but there are still some differences, e.g. Authentication, Region definition, host for Bucket to access, etc. That is why, we cannot use the S3 driver directly.

So if we can have one abstract S3 driver, I can make the OSS Go API provide the compatibility layer to hide the implementation differences.

Thanks

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "master" [email protected]:denverdino/distribution.git somewhere
$ cd somewhere
$ git rebase -i HEAD~5
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Ammending updates the existing PR. You DO NOT need to open a new one.

@stevvooe
Copy link
Collaborator

@denverdino Let us know if you'll continue work on this PR. We are closing for now.

@stevvooe stevvooe closed this Jun 30, 2015
@denverdino
Copy link
Contributor Author

@stevvooe
We will continue maintain the OSS driver. and we have already used it in several internal projects in Aliyun of Alibaba inc. It is pretty solid now.

Can you reopen this PR?

Thanks

@stevvooe
Copy link
Collaborator

stevvooe commented Jul 1, 2015

@denverdino Reopened. Please rebase or merge, since a large number of commits seem to have diverged.

@stevvooe stevvooe reopened this Jul 1, 2015
@denverdino
Copy link
Contributor Author

@Stevooe

Thank you. I will update that.

@dmp42 dmp42 added this to the Registry/2.1 milestone Jul 23, 2015
//
// Keep in mind that OSS guarantees only eventual consistency, so do not assume
// that a successful write will mean immediate access to the data written (although
// in most regions a new object put has guaranteed read after write). The only true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note about consistency looks like it's copied from the S3 driver. Is it really valid for OSS as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, OSS provide the similar capability to S3. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS has different consistency guarantees in different regions. I was wondering if OSS also has differences between the regions. If not (or if we're not sure), we should remove the part that says "(although in most regions a new object put has guaranteed read after write)". It's a very minor thing - I just want to make sure the comment is accurate.

@dmp42
Copy link
Contributor

dmp42 commented Jul 23, 2015

@denverdino we fixed the build on master - can you rebase and push -f ?

Thanks!

@denverdino
Copy link
Contributor Author

I have rebased the PR. Thanks!

@stevvooe stevvooe modified the milestones: Registry/2.2, Registry/2.1 Jul 24, 2015
@denverdino
Copy link
Contributor Author

Update the comments of the consistence model per Aaron's comment.
Thanks

@aaronlehmann
Copy link
Contributor

@denverdino: Sorry to request one more change... could you please add build tags to the new files so the driver can be enabled or disabled at compile time? See the rados driver for an example.

Once this is done, we should be able to merge this PR.

Thanks for the contribution!

@tg123
Copy link
Contributor

tg123 commented Jul 28, 2015

Hi build tag has been added

should I change circle.yml and add include_oss into DOCKER_BUILDTAGS

@tg123
Copy link
Contributor

tg123 commented Jul 31, 2015

@stevvooe
thanks

  1. fix with goimports
  2. link added
  3. todo formatted
  4. comment codes removed
  5. rebase with latest master

@stevvooe
Copy link
Collaborator

@tg123 Is there a link to documentation?

@tg123
Copy link
Contributor

tg123 commented Jul 31, 2015

@stevvooe
do you mean add a link to storage-drivers/oss.md in docs/storagedrivers.md

here is the diff 3eaab7d

@stevvooe
Copy link
Collaborator

@tg123 Imagine I am a user who has never heard of aliyun oss. Where can I go to get information about how it works?

@tg123
Copy link
Contributor

tg123 commented Aug 1, 2015

hi @stevvooe
product link was added in 3eaab7d

http://www.aliyun.com/product/oss is the link to the product

detail
+- [oss](storage-drivers/oss.md): A driver storing objects in [Aliyun OSS](http://www.aliyun.com/product/oss).

or anywhere else I need to add the link to ?

@stevvooe
Copy link
Collaborator

stevvooe commented Aug 3, 2015

@tg123 I requested a link in docs/storage-drivers/oss.md, per #514 (comment).

This ensures the user doesn't have to click back to get further information.

Change-Id: I940fb50f467ce6fc5fbdd9ceb0f9d848e422ced7
Signed-off-by: Li Yi <[email protected]>
@tg123
Copy link
Contributor

tg123 commented Aug 4, 2015

@stevvooe
Hi
link added

but tests did not pass, any way to trigger them again?

@aaronlehmann
Copy link
Contributor

I reran the tests.

@stevvooe
Copy link
Collaborator

stevvooe commented Aug 4, 2015

LGTM

aaronlehmann added a commit that referenced this pull request Aug 4, 2015
Storage Driver for Aliyun OSS
@aaronlehmann aaronlehmann merged commit 3a414de into distribution:master Aug 4, 2015
@aaronlehmann
Copy link
Contributor

Merged. Thanks for your contribution!

@denverdino
Copy link
Contributor Author

@aaronlehmann @stevvooe Thanks for your support

@longwuyuan
Copy link

Hi, please advise if this is wrong place to ask this. I intend to use Docker Containers running on Aliyun ECS Servers. Aliyun only has stock CentOS with a 2.6 kernel. So I intend to update kernel and run containers with docker-compose. Does the driver here mean that I can use a specific storage-driver with docker on the servers I described above and relocate /var/lib/docker on OSS ?

@aaronlehmann
Copy link
Contributor

No, this storage driver is for the Docker Registry, which is a server that provides container images for docker pull. It's not involved in running containers.

@denverdino
Copy link
Contributor Author

@longwuyuan, you can contact to me for this question with email [email protected].

And you can try the Docker Machine with ECS driver for using Docker on Aliyun, the simple tutorial is enclosed

https://github.com/denverdino/aliyungo/wiki/%08%E9%98%BF%E9%87%8C%E4%BA%91Docker-Machine%E9%A9%B1%E5%8A%A8

thaJeztah pushed a commit to thaJeztah/distribution that referenced this pull request Apr 22, 2021
thaJeztah pushed a commit to thaJeztah/distribution that referenced this pull request Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants