-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[RFR] [1.x] OpenCloud adapter rewrite #533
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
currentMenu: open-stack | ||
--- | ||
|
||
# OpenStack | ||
|
||
First, you will need to install the adapter: | ||
```bash | ||
composer require gaufrette/openstack-adapter | ||
``` | ||
|
||
To use the OpenStack adapter you will need to create a connection using the | ||
[OpenStack SDK](https://github.com/php-opencloud/openstack). | ||
|
||
The OpenStack container to use with the adapter should be created on your own. | ||
You can do it manually from the admin panel of your cloud provider, or | ||
progammatically using the OpenStack SDK : | ||
|
||
```php | ||
$objectStore = (new OpenStack([ | ||
// connection options | ||
])) | ||
->objectStoreV1() | ||
; | ||
|
||
/* | ||
* @see \OpenStack\ObjectStore\v1\Api::putContainer for the list of options | ||
*/ | ||
$objectStore->createContainer([ | ||
'name' => 'my-container', | ||
]); | ||
``` | ||
|
||
## Usage with Identity API v3 | ||
|
||
For services using the [OpenStack Identity API v3](https://developer.openstack.org/api-ref/identity/v3/index.html), | ||
such as [IBM Cloud](https://www.ibm.com/cloud/) : | ||
|
||
```php | ||
use Gaufrette\Adapter\OpenStack as OpenStackAdapter; | ||
use Gaufrette\Filesystem; | ||
use OpenStack\OpenStack; | ||
|
||
$objectStore = (new OpenStack([ | ||
'user' => [ | ||
'id' => 'the user ID related to the storage service', | ||
'password' => 'the user password related to the storage service', | ||
], | ||
'authUrl' => 'https://example.com/v2/identity', | ||
'region' => 'the cloud region (eg "london")', | ||
])) | ||
->objectStoreV1() | ||
; | ||
|
||
$adapter = new OpenStackAdapter( | ||
$objectStore, | ||
'container-name' | ||
); | ||
|
||
$filesystem = new Filesystem($adapter); | ||
``` | ||
|
||
To find the options to use with IBM Cloud, [create a new project](https://console.bluemix.net/developer/appservice/starter-kits) | ||
and add an ObjectStorage to the project. The storage will be configured | ||
automatically and you'll be able to see its service credentials then. | ||
|
||
## Usage with Identity API v2 | ||
|
||
For services using the [OpenStack Identity API v2](https://developer.openstack.org/api-ref/identity/v2/), | ||
such as [rackspace.com](https://www.rackspace.com/) : | ||
|
||
```php | ||
use Gaufrette\Adapter\OpenStack as OpenStackAdapter; | ||
use Gaufrette\Filesystem; | ||
use GuzzleHttp\Client; | ||
use GuzzleHttp\HandlerStack; | ||
use OpenStack\Identity\v2\Service as IdentityService; | ||
use OpenStack\OpenStack; | ||
|
||
$objectStore = new (OpenStack([ | ||
'username' => 'your username', | ||
'password' => 'your password', | ||
'tenantId' => 'your tenant Id (also known as account Id/number)' | ||
'authUrl' => 'https://example.com/v2/identity', | ||
'region' => 'the cloud region (eg "LON" for London)', | ||
'identityService' => IdentityService::factory( | ||
new Client([ | ||
'base_uri' => 'https://example.com/v2/identity', | ||
'handler' => HandlerStack::create(), | ||
]) | ||
), | ||
])) | ||
->objectStoreV1([ | ||
'catalogName' => 'cloudFiles', // default to "swift", use "cloudFiles" for rackspace, | ||
// or find the catalog name of your cloud service | ||
// associated with the "object-store" catalog type | ||
]) | ||
; | ||
|
||
$adapter = new OpenStackAdapter( | ||
$objectStore, | ||
'container-name' | ||
); | ||
|
||
$filesystem = new Filesystem($adapter); | ||
``` | ||
|
||
## Links | ||
|
||
- Go [here](https://github.com/php-opencloud/openstack/blob/master/src/OpenStack.php) | ||
to see all OpenStack connection options. |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we require specific patch versions? IMHO we should always build using last patch version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis had issues with curl on its minor php versions. I tried to manually download a root certificate and to set a php option to point to this certificate but there was no changes.
Secifying the latest patch fixed the issue (see commit 9224c74 ).
I can try to always use the latest version instead of hardcoding it.