sonicjs
sonicjs copied to clipboard
added a deploy method
I integrated Cloudflares deploy hooks into SonicJS
https://developers.cloudflare.com/pages/configuration/deploy-hooks/
This allows you to rebuild Cloudflare pages when you click the publish button on the left-hand menu from SonicJS
When you click the deploy hyper it calls a new API endpoint called deploy
This works well in a headless / jamstack manner as you can make changes in the SonicJS CMS and push a rebuild via the deploy hook, which will rebuild your frontend site with the new content.
Our site uses it now
https://orbitlabs.xyz/
https://github.com/OrbitLabsDAO/orbitlabsxyzv2
You will see an API.JS that makes a call to SonicJS and posts an API call.
USAGE
LOCAL
add a new var to the wrangler.toml file with the deploy hook URL
[vars] DISABLED_CACHE = true DEPOLY_URL = "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/dasdasdasjfshkdjf938r49fha"
PRODUCTION
Add a new variable in the variables and settings section in your pages settings
hey @cryptoskillz this is pretty cool, but why would you want this over git integration where pushing to main automatically deploys your site? This method could allow your deployed site to get out of sync with git
hey @cryptoskillz this is pretty cool, but why would you want this over git integration where pushing to main automatically deploys your site? This method could allow your deployed site to get out of sync with git
When you make a CMS change you would like the ability to push this change to your production site, granted this is not much of an issue in a traditional style website where you ping the API for content changes but if you have built it in JAM and it is a 100% static (which virtually all of my sites are) you want to rebuild the site when the editors have finished their copy changes and it bypasses having to teach you copy editors how to use git
Hope this makes sense
Thanks, I still think this is cool, but has limited use cases (for small projects only) which is fine.
Would you mind putting it behind a feature switch? So add a var called "ENABLED_ONE_CLICK_DEPLOY" which will be false by default?
If so, I would also request your help updating the documentation if you are open to that? https://github.com/lane711/sonicjs-public/blob/main/src/pages/deploy.mdx
merging this so that you can be added to the contributors. I'll be merging in the versoin 2 branch soon, so this will only be in main for a short while, but thank you for your PR.
⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.
Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.
Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard. Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.
🔎 Detected hardcoded secret in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 17136732 | Triggered | Generic Password | d06ba5bdb299059f7671183b84762600f29c06c8 | src/services/auth.ts | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.