From 8a241770a9204d6a41d4b71056b3c0379f589487 Mon Sep 17 00:00:00 2001 From: Edu Herraiz Aparicio Date: Fri, 10 Jun 2016 17:18:58 +0200 Subject: [PATCH] Examples revision --- .../aws_beanstalk/README.md | 32 +++++ .../docker-compose}/aws-s3-storage.yml | 0 .../docker-compose}/detector.yml | 0 .../docker-compose}/graphicsmagick-engine.yml | 0 .../docker-compose}/lazy-detector.yml | 0 .../docker-compose}/production-swarm.yml | 0 .../docker-compose}/production.yml | 0 .../production/remotecv-rc.yaml | 50 ++++++++ .../production/thumbor-rc.yaml | 111 ++++++++++++++++++ .../production/thumbor-svc.yaml | 14 +++ 10 files changed, 207 insertions(+) create mode 100644 configuration_examples/aws_beanstalk/README.md rename {docker-compose-examples => configuration_examples/docker-compose}/aws-s3-storage.yml (100%) rename {docker-compose-examples => configuration_examples/docker-compose}/detector.yml (100%) rename {docker-compose-examples => configuration_examples/docker-compose}/graphicsmagick-engine.yml (100%) rename {docker-compose-examples => configuration_examples/docker-compose}/lazy-detector.yml (100%) rename {docker-compose-examples => configuration_examples/docker-compose}/production-swarm.yml (100%) rename {docker-compose-examples => configuration_examples/docker-compose}/production.yml (100%) create mode 100644 configuration_examples/google_cloud_engine/production/remotecv-rc.yaml create mode 100644 configuration_examples/google_cloud_engine/production/thumbor-rc.yaml create mode 100644 configuration_examples/google_cloud_engine/production/thumbor-svc.yaml diff --git a/configuration_examples/aws_beanstalk/README.md b/configuration_examples/aws_beanstalk/README.md new file mode 100644 index 00000000..7e40d1e7 --- /dev/null +++ b/configuration_examples/aws_beanstalk/README.md @@ -0,0 +1,32 @@ +From: https://github.com/APSL/docker-thumbor/issues/12#issuecomment-191765018 +By @bf: https://github.com/bf + +For AWS Beanstalk you need to create a `Dockerun.aws.json` file with the following contents. Create a new Beanstalk environment and simply upload the JSON file. + +``` +{ + "AWSEBDockerrunVersion": "1", + "Image": { + "Name": "apsl/thumbor" + }, + "Ports": [ + { + "ContainerPort": "8000" + } + ] +} +``` + +As soon as the new environment is booted, you need to go to the configuration section where you can set the environment parameters for the docker container. There you should define the following environment variables to serve files from your AWS S3 Bucket through thumbor to your users (all environment params are listed on https://hub.docker.com/r/apsl/thumbor/ ). + +``` +AWS_ACCESS_KEY_ID=XXXXXX +AWS_SECRET_ACCESS_KEY=XXXXXX +LOADER=tc_aws.loaders.s3_loader +S3_USE_SIGV4=True +TC_AWS_LOADER_BUCKET=bucket-name +TC_AWS_REGION=eu-central-1 +``` + +If you want to store the files resized by thumbor on S3 as well, you need to add some more evironment params. We use a caching server in front of thumbor which solves the need for caching of result files in S3. + diff --git a/docker-compose-examples/aws-s3-storage.yml b/configuration_examples/docker-compose/aws-s3-storage.yml similarity index 100% rename from docker-compose-examples/aws-s3-storage.yml rename to configuration_examples/docker-compose/aws-s3-storage.yml diff --git a/docker-compose-examples/detector.yml b/configuration_examples/docker-compose/detector.yml similarity index 100% rename from docker-compose-examples/detector.yml rename to configuration_examples/docker-compose/detector.yml diff --git a/docker-compose-examples/graphicsmagick-engine.yml b/configuration_examples/docker-compose/graphicsmagick-engine.yml similarity index 100% rename from docker-compose-examples/graphicsmagick-engine.yml rename to configuration_examples/docker-compose/graphicsmagick-engine.yml diff --git a/docker-compose-examples/lazy-detector.yml b/configuration_examples/docker-compose/lazy-detector.yml similarity index 100% rename from docker-compose-examples/lazy-detector.yml rename to configuration_examples/docker-compose/lazy-detector.yml diff --git a/docker-compose-examples/production-swarm.yml b/configuration_examples/docker-compose/production-swarm.yml similarity index 100% rename from docker-compose-examples/production-swarm.yml rename to configuration_examples/docker-compose/production-swarm.yml diff --git a/docker-compose-examples/production.yml b/configuration_examples/docker-compose/production.yml similarity index 100% rename from docker-compose-examples/production.yml rename to configuration_examples/docker-compose/production.yml diff --git a/configuration_examples/google_cloud_engine/production/remotecv-rc.yaml b/configuration_examples/google_cloud_engine/production/remotecv-rc.yaml new file mode 100644 index 00000000..352ca301 --- /dev/null +++ b/configuration_examples/google_cloud_engine/production/remotecv-rc.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: remotecv-production + labels: + app: remotecv-production + version: "latest" +spec: + replicas: 2 + selector: + app: remotecv-production + version: "latest" + template: + metadata: + generateName: remotecv-production-pod- + labels: + app: remotecv-production + version: "latest" + spec: + containers: + - name: remotecv + image: apsl/remotecv:latest + env: + - name: REDIS_HOST + value: redis + - name: REDIS_PORT + value: "6379" + - name: REDIS_DATABASE + value: "11" + - name: AWS_ACCESS_KEY_ID + value: "MY_AWS_ACCESS_KEY_ID" + - name: AWS_SECRET_ACCESS_KEY + value: "MY_AWS_SECRET_ACCESS_KEY" + - name: AWS_LOADER_BUCKET + value: "thumbor-production" + - name: REMOTECV_LOADER + value: "remotecv_aws.loader" + #- name: LOG_LEVEL + #value: "DEBUG" + resources: + limits: + cpu: 600m + memory: 1200Mi + requests: + cpu: 10m + memory: 10Mi + imagePullPolicy: Always + restartPolicy: Always + dnsPolicy: ClusterFirst + diff --git a/configuration_examples/google_cloud_engine/production/thumbor-rc.yaml b/configuration_examples/google_cloud_engine/production/thumbor-rc.yaml new file mode 100644 index 00000000..b978bcd5 --- /dev/null +++ b/configuration_examples/google_cloud_engine/production/thumbor-rc.yaml @@ -0,0 +1,111 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: thumbor-prod + labels: + app: thumbor-prod + version: "latest" +spec: + replicas: 4 + selector: + app: thumbor-prod + version: "latest" + template: + metadata: + name: thumbor-prod + labels: + app: thumbor-prod + version: "latest" + role: service + group: yourgroup + spec: + containers: + - name: thumbor-prod + image: apsl/thumbor:latest + resources: + limits: + cpu: 600m + memory: 1200Mi + requests: + cpu: 10m + memory: 10Mi + env: + - name: LOG_LEVEL + value: "DEBUG" + - name: ALLOW_UNSAFE_URL + value: "False" + - name: SECURITY_KEY + value: "MY_SECURITY_KEY" + - name: DETECTORS + value: "['thumbor.detectors.queued_detector.queued_complete_detector',]" + - name: RESULT_STORAGE + value: "thumbor.result_storages.file_storage" + - name: REDIS_STORAGE_SERVER_HOST + value: redis + - name: REDIS_STORAGE_SERVER_PORT + value: "6379" + - name: REDIS_STORAGE_SERVER_DB + value: "11" + - name: REDIS_QUEUE_SERVER_HOST + value: redis + - name: REDIS_QUEUE_SERVER_PORT + value: "6379" + - name: REDIS_QUEUE_SERVER_DB + value: "11" + - name: STORAGE + value: "thumbor.storages.mixed_storage" + - name: MIXED_STORAGE_DETECTOR_STORAGE + value: "thumbor.storages.redis_storage" + - name: MIXED_STORAGE_FILE_STORAGE + value: "thumbor.storages.file_storage" + #- name: THUMBOR_NUM_PROCESSES + #value: "8" + - name: LOADER + value: "tc_aws.loaders.s3_loader" + - name: AWS_ACCESS_KEY_ID + value: "MY_AWS_ACCESS_KEY_ID" + - name: AWS_SECRET_ACCESS_KEY + value: "MY_AWS_SECRET_ACCESS_KEY" + - name: TC_AWS_LOADER_BUCKET + value: "thumbor-production" + - name: THUMBOR_PORT + value: "8001" + - name: STORAGE_EXPIRATION_SECONDS + value: "None" + - name: RESULT_STORAGE_EXPIRATION_SECONDS + value: "None" + - name: RESPECT_ORIENTATION + value: "True" + volumeMounts: + - name: thumbor-prod-data + mountPath: /data + readOnly: False + imagePullPolicy: Always + - name: thumbor-prod-nginx + image: apsl/thumbor-nginx:latest + resources: + limits: + cpu: 100m + memory: 50Mi + requests: + cpu: 10m + memory: 5Mi + env: + - name: THUMBOR_DEFAULT_HOST + value: 127.0.0.1 + - name: THUMBOR_DEFAULT_PORT + value: "8001" + ports: + - containerPort: 80 + name: thumbor-prod + volumeMounts: + - name: thumbor-prod-data + mountPath: /data + readOnly: True + imagePullPolicy: Always + volumes: + - name: thumbor-prod-data + hostPath: + path: /var/thumbor-production + restartPolicy: Always + dnsPolicy: ClusterFirst diff --git a/configuration_examples/google_cloud_engine/production/thumbor-svc.yaml b/configuration_examples/google_cloud_engine/production/thumbor-svc.yaml new file mode 100644 index 00000000..e0ecd1e2 --- /dev/null +++ b/configuration_examples/google_cloud_engine/production/thumbor-svc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: thumbor-prod + labels: + app: thumbor-prod +spec: + type: NodePort + ports: + - port: 80 + targetPort: thumbor-prod + name: thumbor-prod + selector: + app: thumbor-prod