Issues with s3 CloudStorage Addon in Docker

Hi

We are Proof Of Concepting, whether or not we want to use Cockpit as our CMS. Im running CockPit in Docker, where i extend agentejo/cockpit and add the addon files and the config.yaml

But when i upload an asset, it doesnt upload to S3. I can see that the iam user’s accesskey is never used, so it looks like its not even attempting to upload it? Any ideas?

IAM Policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::BUCKETNAME/*",
                "arn:aws:s3:::BUCKETNAME"
            ]
        }
    ]
}

config.yaml:

cloudstorage:
    assets:
        type: s3
        key: ACCESS-KEY
        secret: SECRET-ACCESS-KEY
        region: eu-west-1
        bucket: BUCKETNAME

Dockerfile:

FROM agentejo/cockpit

ARG CONFIG_FILE

COPY CloudStorage-master-52afa0f5389c5bc75e961ae60fd17ad78f5ed58c/ /var/www/html/addons/CloudStorage/

COPY ${CONFIG_FILE} /var/www/html/config/config.yaml

Everything looks correct inside the built docker image

The folder CloudStorage-master-52afa0f5389c5bc75e961ae60fd17ad78f5ed58c contains the content of the master branch (commit: 52afa0f5389c5bc75e961ae60fd17ad78f5ed58c) from CloudStorage, which is copied into the image as instructed - as is the config.yaml.

Please help, as this is a show stopper for us :frowning:

Kind Regards
Frederik

I desperately need help, i feel like i have tried everything. But no error logs or anything, and the assets do not go to s3

Hey Frederik,

we are using cockpit with docker in production and S3 is working fine.

Possibly try the below on the cloud storage ad-don inside your docker image.

Your bucket policy looks fine, and make sure you can see your credentials setup inside the cockpit CMS under the config section, to ensure that the image did not overwrite the config file on creation.

# install cloud storage addon for AWS, Azure or Google storage
RUN wget https://github.com/agentejo/CloudStorage/archive/${COCKPIT_VERSION}.zip -O /tmp/CloudStorage.zip; unzip /tmp/CloudStorage.zip -d /tmp/; rm /tmp/CloudStorage.zip
RUN mkdir -p /var/www/html/addons/CloudStorage
RUN mv /tmp/CloudStorage-${COCKPIT_VERSION}/* /var/www/html/addons/CloudStorage/
RUN rm -R /tmp/CloudStorage-${COCKPIT_VERSION}/

Thank you so much for your response

I have tried with the following dockerfile:

FROM agentejo/cockpit

ARG COCKPIT_VERSION="master"
ARG CONFIG_FILE_YAML

# install cloud storage addon for AWS, Azure or Google storage
RUN wget https://github.com/agentejo/CloudStorage/archive/${COCKPIT_VERSION}.zip -O /tmp/CloudStorage.zip; unzip /tmp/CloudStorage.zip -d /tmp/; rm /tmp/CloudStorage.zip
RUN mkdir -p /var/www/html/addons/CloudStorage
RUN mv /tmp/CloudStorage-${COCKPIT_VERSION}/* /var/www/html/addons/CloudStorage/
RUN rm -R /tmp/CloudStorage-${COCKPIT_VERSION}/

COPY ./${CONFIG_FILE_YAML} /var/www/html/config/config.yaml
COPY ./config/config.php /var/www/html/config/config.php

But i get the same result. The Asset is still uploaded to the containers filesystem instead of S3, no errors or anything.

I have a hunch i place the config.yaml in the wrong place? Can you confirm that /var/www/html/config/config.yaml is the correct path?

Kind Regards
Frederik

@AKApumkin BonusInfo - i am running Cockpit in ECS - Fargate. Although i havent been able to get it up and running with S3 locally either

Do you use both, config.yaml and config.php? If so, the yaml file will be ignored.

1 Like