Invalidate Cloudfront after deploy completes
Hey everyone, quick questions I was looking through the documentation and Im wondering how I can run a command after a build completes a successful deploy wih railway example ->
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths '/*'
21 Replies
Project ID:
N/A
N/A
so first, how do you currently have your service setup to deploy to railway? github action? github source?
just as a github source
could you include a pre-run shell script with that command? then update your start command to
./pre-run.sh && <original start command>
as long as you use a readiness type health check your deployment would not be switched in until its ready to handle requestshmmm, so for context I use alot of git hub actions , cloudformation etc for work . I only used the git hub source as I was just testing out railway. Can I do all this with git hub actions on railway ?
at this moment, nope.
it's currently broken, but otherwise you would use
railway up
in an action with the --ci
flag, with that flag set it will wait for the deployment to either succeed or fail and exit with the applicable exit code, then you would run your aws command in the action as long as the deployment succeed.
but that's currently broken so pre-run script is the best I can think of.Okay interesting thanks for the insight
of course the drawback of the pre-run script is now you need to bundle the aws cli with your image
Yea, i was hoping for a simple solution instead of building a docker image and packing everything. Which i suppose if i have to do then I would just stuff it back into aws
yeah for now the pre-run script is the best way I can think of
Do you have a gist or simlar of what your envisioning ?
do you currently use a dockerfile or nixpacks?
I was just setting a basic next js app with strapi cms. and uses the templats I found on railway
I believe they use nixpacks
I think you can get the aws cli as a nix package, but I actually just thought of something that has a slim chance to get --ci to work in an action, let me do some testing
nice
I assume you're familiar with how to get the aws cli available in a GitHub action?
uses: chrislennon/[email protected]
yupnot working how i had hoped, but ive ran out of time for today
I appreciate the effort
I can try to run some bash commands in an action now to see how things pan out
New reply sent from Help Station thread:
Can you let me know how you connected CloudFront inside the railway server?You're seeing this because this thread has been automatically linked to the Help Station thread.