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

Wider S3 deployment options #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions qmk_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Configuration
STORAGE_ENGINE = environ.get('STORAGE_ENGINE', 's3') # 's3' or 'filesystem'
FILESYSTEM_PATH = environ.get('FILESYSTEM_PATH', 'firmwares')
S3_HOST = environ.get('S3_HOST', 'http://127.0.0.1:9000')
S3_HOST = environ.get('S3_HOST', None)
S3_LOCATION = environ.get('S3_LOCATION', 'nyc3')
S3_BUCKET = environ.get('S3_BUCKET', 'qmk-api')
COMPILE_S3_BUCKET = environ.get('COMPILE_S3_BUCKET', 'qmk')
Expand Down Expand Up @@ -41,17 +41,17 @@
endpoint_url=S3_HOST,
aws_access_key_id=S3_ACCESS_KEY,
aws_secret_access_key=S3_SECRET_KEY,
config=botocore.client.Config(signature_version='s3'),
config=botocore.config.Config(signature_version='s3v4')
Copy link
Member

Choose a reason for hiding this comment

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

Will be removed in #96

)

# Check to see if S3 is working, and if not print an error in the log.
for bucket in [S3_BUCKET, COMPILE_S3_BUCKET]:
try:
s3.create_bucket(Bucket=bucket)
s3.get_bucket_location(Bucket=bucket)
Copy link
Member

Choose a reason for hiding this comment

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

create_bucket is needed for qmk_web_stack.

Suggested change
s3.get_bucket_location(Bucket=bucket)
s3.create_bucket(Bucket=bucket)


except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] not in ['BucketAlreadyOwnedByYou', 'BucketAlreadyExists']:
logging.warning('Could not contact S3! Storage related functionality will not work!')
msg = 'Could not contact S3 bucket "%s"! Storage related functionality will not work!' % bucket
logging.warning('%s [%s]: "%s"' % (msg, e.response['Error']['Code'], e.response['Error']['Message']))


def delete(object, *, bucket=S3_BUCKET, **kwargs):
Expand Down