I need to deploy static sites with dynamic routing based on Git branch names, similar to Netlify’s --alias parameter. How can I implement this in Fastly?
With Netlify I was able to do it via yarn netlify deploy --alias=$branch --cwd projects/documentation
1 Like
I’m not sure if we have this well defined yet within our CLI experience, but the relevant teams pay attention to posts like this in case they’re able to make some future improvements.
We have just released v7 of Compute-JS-Static-Publish, our static file server app for Compute
In this version we have added support for named collections, a feature that allows a set of assets to be grouped as a collection so that they can be served up by name, handy for usages such as “preview builds”, which sounds like a fit for your usage.
GitHub: GitHub - fastly/compute-js-static-publish: Static Publisher for Fastly Compute JavaScript
1 Like
Hey thanks! I was able to create KV store with this command from my Circle CI config.
npx @fastly/compute-js-static-publish publish-content --collection-name=$hash --root-dir=../test/visual
Note: I created a compute service and linked the KV store to this service, but the issue is I am not able to generate any URLS.
I am on a branch rajdeep-fastly, so what would be my generated prod url? LIke this I have multiple sites like storybook url and visual regression testing urls.
With Netlify we used to do this via
- [Documentation Site](https://${branchSlug}--spectrum-wc.netlify.app/)
- [Storybook](https://${branchSlug}--spectrum-wc.netlify.app/storybook/)
Can you guide here how to do this with fastly?
Ok a little more context: I have the subdomain setup and trying to host like below but it gives me no app is attached.
https://rajdeep-fastly--spectrum.edgecompute.app/
rajdeep-fastly - is the branch name.
Also do you feel we can create endpoints like https://{branchname}.swc.edgecompute.app ?
There’s no ‘feeling’ about it
You cannot create subdomains of any name in edgecompute.app
. You’ll have to register your own domain and attach it your Compute service.
We plan to publish a guide for how to do this in a few weeks, at the moment we don’t have any documentation to point you to.
2 Likes
Can we create a Wild Card entry subdomain like *.preview.swc.yourcompany.com which can deploy the service (setting up TLS and routing)