grim/containers/trac-bootstrap

Add the initial version I created years ago.
draft
2021-02-23, Gary Kramlich
3743be918e11
Parents
Children 972e509e412a
Add the initial version I created years ago.
  • +15 -0
    Dockerfile
  • +6 -0
    README.md
  • +47 -0
    bootstrap
  • +36 -0
    convey.yml
  • +82 -0
    s3cfg
  • +82 -0
    s3cfg.in
  • --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/Dockerfile Tue Feb 23 04:05:54 2021 -0600
    @@ -0,0 +1,15 @@
    +FROM jess/s3cmd:latest
    +
    +MAINTAINER Gary Kramlich <grim@reaperworld.com>
    +
    +RUN set -ex && \
    + apt-get update && \
    + apt-get install -y --no-install-recommends gettext xz-utils && \
    + apt-get clean && \
    + rm -rf /var/lib/apt/lists
    +
    +COPY s3cfg.in /root/
    +COPY bootstrap /usr/local/bin/
    +
    +ENTRYPOINT ["/usr/local/bin/bootstrap"]
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/README.md Tue Feb 23 04:05:54 2021 -0600
    @@ -0,0 +1,6 @@
    +# trac-bootstrap
    +
    +trac-bootstrap is meant to be used an in initContainer in kubernetes to
    +initialize a trac instead from a backup that's stored in an s3 compatible
    +provider.
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/bootstrap Tue Feb 23 04:05:54 2021 -0600
    @@ -0,0 +1,47 @@
    +#!/bin/sh -e
    +
    +OUTPUT_FILENAME="/tmp/bootstrap.tar.xz"
    +
    +export S3CMD_SIGNATURE_V2="${S3CMD_SIGNATURE_V2:-False}"
    +export S3CMD_BUCKET_LOCATION="${S3CMD_BUCKET_LOCATION:-US}"
    +export S3CMD_HOST_BASE="${S3CMD_HOST_BASE:-s3.amazonaws.com}"
    +export S3CMD_HOST_BUCKET="${S3CMD_HOST_BUCKET:-%(bucket)s.s3.amazonaws.com}"
    +
    +# make sure our required environment variables are set
    +if [ -z "${AWS_ACCESS_KEY_ID}" ] ; then
    + echo "AWS_ACCESS_KEY_ID environment variable must be set" >&2
    + exit 1
    +fi
    +
    +if [ -z "${AWS_SECRET_ACCESS_KEY}" ] ; then
    + echo "AWS_SECRET_ACCESS_KEY environment variable must be set" >&2
    + exit 1
    +fi
    +
    +if [ -z "${S3_URL}" ] ; then
    + echo "S3_URL environment variable must be set" >&2
    + exit 1
    +fi
    +
    +if [ -z "${OUTPUT}" ] ; then
    + echo "OUTPUT environment variable must be set" >&2
    + exit 1
    +fi
    +
    +# Make sure we're not already bootstrapped
    +if [ -f "${OUTPUT}/conf/trac.ini" ] ; then
    + echo "Already boot strapped"
    + exit 0
    +fi
    +
    +cat /root/s3cfg.in | envsubst > /root/.s3cfg
    +rm -f /root/s3cfg.in
    +
    +s3cmd get "${S3_URL}" "${OUTPUT_FILENAME}"
    +
    +mkdir -p "${OUTPUT}"
    +cd "${OUTPUT}"
    +tar Jxf "${OUTPUT_FILENAME}"
    +
    +exit 0
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/convey.yml Tue Feb 23 04:05:54 2021 -0600
    @@ -0,0 +1,36 @@
    +environment:
    + - REPO=rwgrim/pidgin-trac-bootstrap
    + - TAG=latest
    + - REGISTRY=docker.io
    + - REGISTRY_USERNAME
    + - REGISTRY_PASSWORD
    +tasks:
    + import:
    + type: docker/import
    + files: .:.
    + build:
    + type: docker/build
    + dockerfile: Dockerfile
    + files: .
    + tag: ${REGISTRY}/${REPO}:${TAG}
    + login:
    + type: docker/login
    + server: ${REGISTRY}
    + username: ${REGISTRY_USERNAME}
    + password: ${REGISTRY_PASSWORD}
    + logout:
    + type: docker/logout
    + server: ${REGISTRY}
    + push:
    + type: docker/push
    + image: ${REGISTRY}/${REPO}:${TAG}
    +plans:
    + default:
    + stages:
    + - tasks: [import, build]
    + cicd:
    + stages:
    + - tasks: [login, import, build, push]
    + - tasks: [logout]
    + run: always
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/s3cfg Tue Feb 23 04:05:54 2021 -0600
    @@ -0,0 +1,82 @@
    +[default]
    +access_key = ${AWS_ACCESS_KEY_ID}
    +access_token =
    +add_encoding_exts =
    +add_headers =
    +bucket_location = main
    +ca_certs_file =
    +cache_file =
    +check_ssl_certificate = True
    +check_ssl_hostname = True
    +cloudfront_host = cloudfront.amazonaws.com
    +content_disposition =
    +content_type =
    +default_mime_type = binary/octet-stream
    +delay_updates = False
    +delete_after = False
    +delete_after_fetch = False
    +delete_removed = False
    +dry_run = False
    +enable_multipart = True
    +encoding = UTF-8
    +encrypt = False
    +expiry_date =
    +expiry_days =
    +expiry_prefix =
    +follow_symlinks = False
    +force = False
    +get_continue = False
    +gpg_command = None
    +gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
    +gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
    +gpg_passphrase =
    +guess_mime_type = True
    +host_base = data.imfreedom.org
    +host_bucket = data.imfreedom.org/%(bucket)s/
    +human_readable_sizes = False
    +invalidate_default_index_on_cf = False
    +invalidate_default_index_root_on_cf = True
    +invalidate_on_cf = False
    +kms_key =
    +limit = -1
    +limitrate = 0
    +list_md5 = False
    +log_target_prefix =
    +long_listing = False
    +max_delete = -1
    +mime_type =
    +multipart_chunk_size_mb = 15
    +multipart_max_chunks = 10000
    +preserve_attrs = True
    +progress_meter = True
    +proxy_host =
    +proxy_port = 0
    +put_continue = False
    +recursive = False
    +recv_chunk = 65536
    +reduced_redundancy = False
    +requester_pays = False
    +restore_days = 1
    +restore_priority = Standard
    +secret_key = ${AWS_SECRET_ACCESS_KEY}
    +send_chunk = 65536
    +server_side_encryption = False
    +signature_v2 = False
    +signurl_use_https = False
    +simpledb_host = sdb.amazonaws.com
    +skip_existing = False
    +socket_timeout = 300
    +stats = False
    +stop_on_error = False
    +storage_class =
    +throttle_max = 100
    +upload_id =
    +urlencoding_mode = normal
    +use_http_expect = False
    +use_https = True
    +use_mime_magic = True
    +verbosity = WARNING
    +website_endpoint = http://%(bucket)s.s3-website-%(location)s.amazonaws.com/
    +website_error =
    +website_index = index.html
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/s3cfg.in Tue Feb 23 04:05:54 2021 -0600
    @@ -0,0 +1,82 @@
    +[default]
    +access_key = ${AWS_ACCESS_KEY_ID}
    +access_token =
    +add_encoding_exts =
    +add_headers =
    +bucket_location = ${S3CMD_BUCKET_LOCATION}
    +ca_certs_file =
    +cache_file =
    +check_ssl_certificate = True
    +check_ssl_hostname = True
    +cloudfront_host = cloudfront.amazonaws.com
    +content_disposition =
    +content_type =
    +default_mime_type = binary/octet-stream
    +delay_updates = False
    +delete_after = False
    +delete_after_fetch = False
    +delete_removed = False
    +dry_run = False
    +enable_multipart = True
    +encoding = UTF-8
    +encrypt = False
    +expiry_date =
    +expiry_days =
    +expiry_prefix =
    +follow_symlinks = False
    +force = False
    +get_continue = False
    +gpg_command = None
    +gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
    +gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
    +gpg_passphrase =
    +guess_mime_type = True
    +host_base = ${S3CMD_HOST_BASE}
    +host_bucket = ${S3CMD_HOST_BUCKET}
    +human_readable_sizes = False
    +invalidate_default_index_on_cf = False
    +invalidate_default_index_root_on_cf = True
    +invalidate_on_cf = False
    +kms_key =
    +limit = -1
    +limitrate = 0
    +list_md5 = False
    +log_target_prefix =
    +long_listing = False
    +max_delete = -1
    +mime_type =
    +multipart_chunk_size_mb = 15
    +multipart_max_chunks = 10000
    +preserve_attrs = True
    +progress_meter = True
    +proxy_host =
    +proxy_port = 0
    +put_continue = False
    +recursive = False
    +recv_chunk = 65536
    +reduced_redundancy = False
    +requester_pays = False
    +restore_days = 1
    +restore_priority = Standard
    +secret_key = ${AWS_SECRET_ACCESS_KEY}
    +send_chunk = 65536
    +server_side_encryption = False
    +signature_v2 = ${S3CMD_SIGNATURE_V2}
    +signurl_use_https = False
    +simpledb_host = sdb.amazonaws.com
    +skip_existing = False
    +socket_timeout = 300
    +stats = False
    +stop_on_error = False
    +storage_class =
    +throttle_max = 100
    +upload_id =
    +urlencoding_mode = normal
    +use_http_expect = False
    +use_https = True
    +use_mime_magic = True
    +verbosity = WARNING
    +website_endpoint = http://%(bucket)s.s3-website-%(location)s.amazonaws.com/
    +website_error =
    +website_index = index.html
    +