Sign inSign up

jdef/s3repo

By jdef

•Updated almost 11 years ago

Utility to create a yum repository from an RPMS/ build directory and push it to an S3 bucket that you can then access from anywhere.

Image
0

1.7K

jdef/s3repo repository overview

⁠Description

This container will create a yum repository from an RPMS directory and upload the contents to an Amazon S3 bucket. Set up your bucket as a static website and you have a yum repository that you can access from anywhere.

⁠Usage

The container expects RPMS to live at:

/home/makerpm/exports/RPMS

It also expects some environment variables:

  • ACCESS_KEY -- an Amazon IAM credential
  • SECRET_KEY -- an Amazon IAM credential
  • BUCKET_NAME -- the name of your Amazon S3 bucket

For example:

docker run --rm=true -ti --volumes-from=${BUILD_CONTAINER} \
  -e BUCKET_NAME=${YOUR_S3_BUCKET_NAME_HERE}               \
  -e ACCESS_KEY=$(cat .access_key)                         \
  -e SECRET_KEY=$(cat .secret_key)                         \
  jdef/s3repo

In this case the RPMS generated by my ${BUILD_CONTAINER} would be uploaded as a yum repository to my ${YOUR_BUCKET_NAME_HERE} S3 bucket. A yum .repo file to access the S3/Yum bucket might look like this:

[my-s3-repo]
name=My S3/yum repo - $basearch
baseurl=http://___YOUR_BUCKET_NAME_HERE___.s3-website-us-east-1.amazonaws.com/$basearch
gpgcheck=0

⁠AWS Policy

Upon running the container, the specified AWS credentials need access rights to the S3 bucket that's being sync'd to. You need to set these up beforehand (e.g. IAM console). Here's what I'm using:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1405868503010",
      "Effect": "Allow",
      "Action": [
        "s3:ListAllMyBuckets"
      ],
      "Resource": [
        "arn:aws:s3:::*"
      ]
    },
    {
      "Sid": "Stmt1405868583000",
      "Effect": "Allow",
      "Action": [
        "s3:AbortMultipartUpload",
        "s3:DeleteObject",
        "s3:DeleteObjectVersion",
        "s3:GetObject",
        "s3:GetObjectAcl",
        "s3:GetObjectVersion",
        "s3:ListBucket",
        "s3:ListMultipartUploadParts",
        "s3:PutObject",
        "s3:PutObjectAcl",
        "s3:RestoreObject"
      ],
      "Resource": [
        "arn:aws:s3:::__YOUR_BUCKET_NAME_HERE__",
        "arn:aws:s3:::__YOUR_BUCKET_NAME_HERE__/*"
      ]
    }
  ]
}

Tag summary

Content type

Image

Digest

sha256:1349e4f66…

Size

303.6 MB

Last updated

almost 11 years ago

docker pull jdef/s3repo