1

So we have an asp.net core application we are hoping to start using with docker and host this all on aws.

We have multiple clients that we set up this project for, each with their own configuration settings, such as connection strings, application name, token secret, mailing server information, etc...

The problem we are going to have/are having, is how to make production configuration not built into the source code/docker whilst being accessible for multiple instances/containers that will need to use this on ECS/EC2.

So the idea we currently have, which i was hoping someone could check or suggest a better solution if there is one, is that we will build the container free of the specific configuration, then access the appSettings.production.json which we would mount from outside of the container. Because this would be on amazon it would be stored in EFS if capable or S3.

Is this possible and an appropriate solution?

Thanks

4
  • We have a few dotnet-core apps as well, deployed to EC2. We typically have a stage in the pipeline where Ansible is used to provision an image. If this is something that sounds acceptable to you, I could write it up as an answer. Sep 9, 2019 at 14:51
  • I am unfamiliar with ansible but I am unsure how this fits. I'm looking for configuration that is client instance specific. We have instance of applications that have app setting specific to that client. E.g. the connection string.
    – Matster2
    Sep 9, 2019 at 15:52
  • I'm not quite sure of another way other than mounting those setting onto some sort of storage the deployable instances can access.
    – Matster2
    Sep 9, 2019 at 15:53
  • I don't want any specific configuration for each client production stored in the image (as it would lead to image per client)
    – Matster2
    Sep 9, 2019 at 15:54

1 Answer 1

1

If you are going full on AWS, I would suggest to have a look at AWS SSM parameters. When EC2 or ECS container are starting, you have a script that is going to fetch the parameters. Then you can do whatever you need to do: replace variables in config files with the parameters fetched previously for example. You could also use files stored in S3. You would be able to copy it and place it in the right application folder when your EC2 or ECS container are starting.

4
  • Yer I've decided ATM to use environment variables on my docker file then have them set in the task definition. Some of these values are set from the parameter store.
    – Matster2
    Sep 10, 2019 at 22:32
  • The thing that was holding me back originally with using environment variables is that it will mean if I debug using docker, I would have to set them, but I think it's a compromise
    – Matster2
    Sep 10, 2019 at 22:34
  • If you have them in the task def., it means your secrets (password) are in clear text, no?
    – Kaymaz
    Sep 10, 2019 at 22:45
  • Yes which is why I have some in the task definition and the rest which get it from the parameter store. Specifically my connection string, token secret
    – Matster2
    Sep 11, 2019 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.