SOLVED

Loading config.js into web app container

%3CLINGO-SUB%20id%3D%22lingo-sub-2307467%22%20slang%3D%22en-US%22%3ELoading%20config.js%20into%20web%20app%20container%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2307467%22%20slang%3D%22en-US%22%3E%3CP%3EVery%20much%20new%20to%20azure.%20Running%20containers%20in%20a%20swarm%20on%20our%20servers%20currently%20and%20looking%20to%20move%20to%20azure.%20We%20have%20a%20legacy%20app%20which%20we%20have%20containerised%20and%20to%20make%20it%20as%20useable%20as%20possible%2C%20we%20want%20to%20load%20the%20config.js%20in%20much%20like%20we%20do%20with%20docker%20swarm%20and%20docker%20configs.%20For%20the%20life%20of%20me%20I%20cannot%20work%20out%20how%20to%20achieve%20injecting%20a%20file%20into%20the%20container.%20We%20are%20using%20a%20webapp%20containers.%20Any%20hints%20from%20anyone%20on%20what%20feels%20like%20it%20should%20be%20a%20simple%20thing%20to%20do%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2317684%22%20slang%3D%22en-US%22%3ERe%3A%20Loading%20config.js%20into%20web%20app%20container%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2317684%22%20slang%3D%22en-US%22%3EI'm%20guessing%20your%20file%20is%20environment%20specific%2C%20so%20you%20have%20different%20ones%20for%20dev%2C%20test%2C%20etc.%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20typical%20path%20would%20be%20to%20convert%20these%20to%20environment%20variables%2C%20and%20then%20validate%20them%20through%20kudu%2Fscm.%20https%3A%2F%2F%3CAPP%3E.scm.azurewebsites.net%2FEnv%20Changing%20environment%20variables%20doesn't%20trigger%20a%20container%20restart%2C%20like%20many%20update%20or%20redeploy%20operations%20will.%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20have%20the%20option%20to%20enable%20persistent%20storage%20(%2Fhome)%20and%20put%20shared%20files%20there%2C%20but%20this%20might%20require%20app%20changes.%3CBR%20%2F%3E%3CBR%20%2F%3ESince%20you%20have%20a%20container%2C%20you%20can%20add%20the%20file%20to%20the%20image%2C%20or%20as%20part%20of%20a%20deployment%20pipeline.%3CBR%20%2F%3E%3CBR%20%2F%3ELastly%2C%20you%20can%20use%20the%20kudu%20(%2Fscm)%20endpoint%20to%20upload%20files%2C%20but%20I%20would%20stay%20away%20from%20this.%3C%2FAPP%3E%3C%2FLINGO-BODY%3E
New Contributor

Very much new to azure. Running containers in a swarm on our servers currently and looking to move to azure. We have a legacy app which we have containerised and to make it as useable as possible, we want to load the config.js in much like we do with docker swarm and docker configs. For the life of me I cannot work out how to achieve injecting a file into the container. We are using a webapp containers. Any hints from anyone on what feels like it should be a simple thing to do?

1 Reply
best response confirmed by jontwy (New Contributor)
Solution
I'm guessing your file is environment specific, so you have different ones for dev, test, etc.

The typical path would be to convert these to environment variables, and then validate them through kudu/scm. https://<app>.scm.azurewebsites.net/Env Changing environment variables doesn't trigger a container restart, like many update or redeploy operations will.

You have the option to enable persistent storage (/home) and put shared files there, but this might require app changes.

Since you have a container, you can add the file to the image, or as part of a deployment pipeline.

Lastly, you can use the kudu (/scm) endpoint to upload files, but I would stay away from this.