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

Option to execute docker commands / access volumes #350

Open
motiejuss opened this issue Mar 10, 2023 · 0 comments
Open

Option to execute docker commands / access volumes #350

motiejuss opened this issue Mar 10, 2023 · 0 comments

Comments

@motiejuss
Copy link

Hi. I'm not sure this is the right place, but I'm trying to run a pre-made docker image. There is a well known permissions issue with it as described in the documentation.

In the logs I see I'm getting this error, but I can't figure out how to chown directory / volume using CDK. I'm also using cdk-ecs-service-extensions, because I want to use AssignPublicIpExtension extension.

My code:

import { Construct } from "constructs";
import {
  AssignPublicIpExtension,
  Container,
  Environment,
  EnvironmentCapacityType,
  Service,
  ServiceDescription,
} from "@aws-cdk-containers/ecs-service-extensions";
import { AwsLogDriver, Cluster, ContainerImage } from "aws-cdk-lib/aws-ecs";
import { Vpc } from "aws-cdk-lib/aws-ec2";
import { HostedZone } from "aws-cdk-lib/aws-route53";
import { RetentionDays } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps } from "aws-cdk-lib";

export class RedisInsightStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const ns = "RedisInsight";

    const vpc = Vpc.fromLookup(this, "vpc-123456", {
      isDefault: true,
    });

    const cluster = new Cluster(this, "Cluster", {
      clusterName: `${ns}ProductionCluster`,
      vpc: vpc,
    });

    const logging = new AwsLogDriver({
      streamPrefix: `${ns}Production`,
      logRetention: RetentionDays.ONE_MONTH,
    });

    const zone = HostedZone.fromLookup(this, "Zone", {
      domainName: "zone.io",
    });

    const environment = Environment.fromEnvironmentAttributes(
      this,
      `${ns}Environment`,
      {
        capacityType: EnvironmentCapacityType.FARGATE,
        cluster,
      }
    );

    const serviceDescription = new ServiceDescription();

    serviceDescription.add(
      new Container({
        cpu: 256,
        memoryMiB: 512,
        trafficPort: 80,
        image: ContainerImage.fromRegistry("redislabs/redisinsight:latest"),
        environment: {
          RIPORT: "80",
        },
        logGroup: logging.logGroup,
      })
    );

    serviceDescription.add(
      new AssignPublicIpExtension({
        dns: {
          recordName: "ri",
          zone,
        },
      })
    );

    const service = new Service(this, `${ns}Service`, {
      environment,
      serviceDescription,
    });
  }
}

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant