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

CMS 5 compatability #46

Merged
merged 7 commits into from
Feb 13, 2023

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Feb 12, 2023

Note there aren't really any useful tests in this module but that's out of scope for this PR. I've created a separate card for that concern: #47

For now, manually test this with a local dynamodb install (or docker image) and use the AWS CLI to confirm that the sessions table gets updated as expected.

Don't squash

Each commit here is its own concern (albeit related to the overall purpose of making this module CMS 5 compatible) - we should keep the commit history readable by keeping all of these commits.

CI Run

Because this is the first time github actions are being added to this module, they won't run on this PR (because they're not in the default branch yet).
See the CI run on creative-commoners.

AFTER MERGING

After you merge this, create a new 5.0 branch off the 5 branch, and tag 5.0.0-beta1!

Parent issue

@GuySartorelli GuySartorelli marked this pull request as draft February 12, 2023 23:37
Comment on lines -33 to -36
"installer-name": "silverstripe-dynamodb",
"branch-alias": {
"dev-master": "4.0.x-dev"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed branch alias as a matter of course.
Removed installer-name because it wasn't actually working anyway and is non-standard to ss modules.

Comment on lines -67 to +53
// cache credentials when IAM fetches the credentials from EC2 metadata service
// this will use doctrine/cache (included via composer) to do the actual caching into APCu
// http://docs.aws.amazon.com/aws-sdk-php/guide/latest/performance.html#cache-instance-profile-credentials
$dynamoOptions['credentials'] = new DoctrineCacheAdapter(new ApcuCache());
$dynamoOptions['credentials'] = CredentialProvider::defaultProvider();
Copy link
Member Author

Choose a reason for hiding this comment

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

doctrine/cache is deprecated - this is from their readme:

This library is deprecated and will no longer receive bug fixes from the Doctrine Project. Please use a different cache library, preferably PSR-6 or PSR-16 instead.

The default credential provider is memoised, which is a fancy way of saying it caches the credentials after finding them.

Comment on lines -59 to +65
AWS_REGION_NAME=us-east-1
AWS_REGION_NAME=ap-southeast-2
Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense to use the same example as above

@@ -1,43 +1,40 @@
{
"name": "silverstripe/dynamodb",
Copy link
Member Author

Choose a reason for hiding this comment

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

All lines were touched because I replaced tabs with spaces. May be easier to look through each commit to see what changed here and why.

Environment::setEnv('AWS_DYNAMODB_SESSION_TABLE', $origValue);
}

public function testGetReturnsSessionWhenConfigured()
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this because the other test could be satisfied by simply always returning null - which is obviously not correct.

@GuySartorelli GuySartorelli marked this pull request as ready for review February 13, 2023 04:02
@GuySartorelli GuySartorelli mentioned this pull request Feb 13, 2023
6 tasks
[![Build Status](https://travis-ci.org/silverstripe/silverstripe-dynamodb.svg?branch=master)](https://travis-ci.org/silverstripe/silverstripe-dynamodb)
[![CI](https://github.com/silverstripe/silverstripe-dynamodb/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-dynamodb/actions/workflows/ci.yml)
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that this is wrong in the preview because currently there is no github actions in this repo. It'll fix itself after this PR is merged.

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

Tested locally, it works.

I'll provide a follow up PR to improve docs / CI a little more

@emteknetnz emteknetnz merged commit 6129014 into silverstripe:5 Feb 13, 2023
@emteknetnz emteknetnz deleted the pulls/5/cms5-compat branch February 13, 2023 22:03
@GuySartorelli
Copy link
Member Author

Tagged as 5.0.0-beta1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants