jamestagal / edtechdesigner

A professional blog site of Benjamin Waller
https://edtechdesigner.io
0 stars 1 forks source link

Hosting #5

Closed jimafisk closed 2 years ago

jimafisk commented 2 years ago

Later on, when I finish modifying the content of this theme I would like to host this site...I see in one of your talks you mentioned Netlify integration. Could you please point me in the right direction to help me with this process? I am quite interested to host on Vercel but any suggestion here would be appreciated.

jimafisk commented 2 years ago

The best approach for deploying to Netlify is to build your Plenti app in CI (e.g. GitHub Actions) outside of Netlify and then copy those assets over to Netlify to deploy the site. Here's an issue discussing exactly how to do that: https://github.com/plentico/plenti/issues/140

I also created a video explaining this process and why it's necessary: https://youtu.be/TmWIeUOsERY

There is also community written documentation that takes a slightly different approach by tracking your "public" build folder in git and then pointing Netlify to this location if you'd rather go with that approach: https://leighdinaya.com/post/deploy-plenti-site-on-netlify/

If your project doesn't require additional Netlify/Vercel features like protected pages, redirects, serverless functions, form backend, etc then your cheapest and easiest option would be to just use GitHub pages: https://plenti.co/docs/github-actions

jamestagal commented 2 years ago

Hi Jim, That all interesting....Hopefully Netlify will add the option to simply point to your Plenti docker image in the future. I have followed your post https://github.com/plentico/plenti/issues/140 and created a .github/workflows/netlify-deploy.yml as you have suggested. Thanks for your recommendations here. I will try connecting the app to Netlify. :)

jamestagal commented 2 years ago

Hi jim, After going through the set up and deploying to Netlify I get an error. See below. Failed at the netlify-cli@8.6.0 postinstall script. Screen Shot 2021-12-30 at 10 55 22 am

any ideas? There is more info in the Netlify log: Screen Shot 2021-12-30 at 11 09 21 am

jimafisk commented 2 years ago

I just took a look at your last failed build and it looks like an error I was seeing locally when I first cloned your project:

Error: Unable to read site config file unexpected end of JSON input.

Are you in the site folder that was created?.

We suggest that you begin by typing:

  cd [project name]
  plenti serve

To fix this on my end I simply ran plenti theme add https://github.com/plenti-themes/compendium and that made some adjustments to plenti.json that fixed this. If you try that locally and then commit the changes and push them up does that fix things?

jamestagal commented 2 years ago

Hi jim, No unfortunately. I just ran that command and did see a change to the plenti.json file. See my commit below.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   .DS_Store
        modified:   plenti.json
        deleted:    themes/compendium/.DS_Store
        deleted:    themes/compendium/.github/.DS_Store
        modified:   themes/compendium/assets/color-scheme.css

I'm still getting the same error. Do I need to run plenti build before pushing to the repo? I was thinking that i don't need to because that folder is ignored.

jimafisk commented 2 years ago

Looking at the latest failed build it does appear that fixed the issue I mentioned above, but now it's failing at the "Deploy to Netlify" step like you first mentioned:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader

According to this you probably have to update your version of NodeJS used in CI. The script I referenced in https://github.com/plentico/plenti/issues/140 is quite old and uses v13 so maybe try changing the line node-version: '13' to node-version: '16' in your .github/workflows/netlify-deploy.yml file and see if that works?

jamestagal commented 2 years ago

Actually that worked....I changed the node version to 16 and the build looked like it failed again but i got the green tick! :) thanks for all this.https://vigorous-einstein-b90548.netlify.app

jimafisk commented 2 years ago

Nice! I'm glad it's working :tada:

jamestagal commented 2 years ago

Yes ...but it's very strange because it does initially fail then a few seconds later it builds successfully...but the error only shows up on the Netlify end...not in Github actions. Screen Shot 2021-12-31 at 3 26 29 pm

jimafisk commented 2 years ago

That's because it's still trying to do the build on Netlify and with GitHub Actions. The netlify build doesn't work so you can remove that entirely under Site Settings > Build & Deploy > Edit Settings. Just delete the "Build command" and "Publish directory" then set the "Builds" to "Stop builds":

See screenshot ![build](https://user-images.githubusercontent.com/5913244/147863691-26b583f5-3114-464c-b70a-c400bb3ad780.png)
jamestagal commented 2 years ago

Great! thanks Jim. This worked 👍