ipfs-inactive / website

This repo has been replaced by https://github.com/ipfs/ipfs-website/
https://github.com/ipfs/ipfs-website/
MIT License
182 stars 128 forks source link

Updating website in github publishes changes to IPFS && to ipfs.io #17

Closed harlantwood closed 8 years ago

harlantwood commented 9 years ago

Edit: Original title of this issue was: Idea: Publishing website to IPFS auto-publishes to github pages

Background: I've been having fun setting up continuous deployment to github pages recently for a few of my own sites. For example, when anyone updates the site source on github for dstack.org, CI notices the changes, builds the site from source, and pushes the resulting pages to gh-pages.

We could certainly do the same or similar for ipfs.io. But maybe we could do something much cooler, which could serve as an example to boot.

The basic flow I have in mind is:

What would all this get us? A fantastic example of publishing content to the "permanent web" first, then mirroring it to github pages, a lightning fast, highly scalable free hosting system, which also hooks into DNS with custom domain names. That is to say, it's a bridge, to allow pioneers who are publishing on IPFS to mirror their work to the "old web".

Caveat: I'm still an IPFS noob, tho enthusiastic. If this sounds interesting, I'd be happy to throw a bit of development at it. Feedback and upgrades welcome.

harlantwood commented 9 years ago

CC @jacksenechal

harlantwood commented 9 years ago

@jbenet interested to hear your thoughts on this when you have a chance...

jbenet commented 9 years ago

Hey @harlantwood finally getting around to this one.

This would definitely work, but can skip the gh-pages entirely (if there is someone willing to provide the data -- we're considering this sort of thing). Can skip gh-pages because IPFS supports a way to serve arbitrary websites at their own domains, with two DNS records: a TXT and an A.

TXT dnslink=/ipfs/path/to/content
A <ip-address-of-gateway>  # this probably should be a CNAME

I'd love for someone to write up an example of how to do this (maybe @Luzifer or @kevinwallace?) or maybe adding it to https://github.com/ipfs/examples/tree/master/examples/websites (@whyrusleeping).

RichardLitt commented 9 years ago

I think this is pretty much done with the last merge in #59, which automatically sets the DNS record.

jbenet commented 9 years ago

yeah last part would be to automate the publish with a githook webhook or something

RichardLitt commented 9 years ago

Can't do that without publicly providing digitalocean keys.

jbenet commented 9 years ago

well, would have a githook to a machine we control with the token or something

harlantwood commented 9 years ago

Maybe we can provide the DO auth token as an env variable in Travis or Circle and publish from there?

73

jbenet commented 9 years ago

yeah maybe, though not sure if those creds might be leakable through their public webuis.

we could write a nice dedicated webhook bot for people to deploy on heroku or something. maybe this is something https://github.com/diasdavid/ipscend could help with-- particularly if it did the dnslink-deploy part too-- then the hook would be very simple.

the hook could still do it, but would be more complicated, would need to:

daviddias commented 9 years ago

Doesn't gh-pages require that a repo with a gh-pages branch to exist? We could add an option on ipscend for 'onpublish' to also push to the gh-pages branch, would that fulfil the expectation?

RichardLitt commented 9 years ago

We could just make gh-pages the main branch. GitHub allows that option, and we don't need master to be the trunk.

harlantwood commented 8 years ago

I think this thread is no longer about github pages. I'll change the title to reflect that. It's about deploying to IPFS triggered by a git commit, ie from a github webhook.

I've been playing with this for IPFS/ci-status#1, and found a nice module to do this with node... Something like:

githubhook = require 'githubhook'
github = githubhook
  port: process.env.PORT
  path: '/'
  # secret: 'xxx'

github.listen()
github.on '*', (event, repo, ref, data) ->
  # build, deploy, whatever...

I plan to build this anyway to deploy the CI dashboard on any github commits to its own codebase; we could certainly repurpose the same idea (or even the same server instance) for building and deploying the website.

Questions:

  1. I am prototyping this on heroku. Should we plan to run there, or elsewhere, eg digital ocean? Heroku is easy, and a free instance should work fine, but it's also nice to have all our stuff in one place... My recommendation: heroku
  2. Should we have a single codebase to manage any git hooks, which would build/deploy etc as needed? Or split it into CI / website / etc codebase / servers? My recommendation: single codebase, at new repo: ipfs/githooks
RichardLitt commented 8 years ago

I'm always for putting everything in one place: I would vote for using DigitalOcean, and for using ipfs/githooks.

Everything else looks great.

harlantwood commented 8 years ago

Sounds good, will prototype on my own server and ping when it's baked.

jbenet commented 8 years ago

@harlantwood im ok with heroku for things like these -- particularly since it's free :). the tricky bit is accounting all apps hosted there and so on. i could get us an account etc.

jbenet commented 8 years ago

also ok with one or several codebases (if several have one be an index)

harlantwood commented 8 years ago

I'll keep prototyping on heroku for now... not sure if the free tier will work, or the $7/mo hobby tier would be needed.

Going with one codebase, at least for now.

harlantwood commented 8 years ago

This development is moving forward in https://github.com/ipfs/infrastructure/issues/137; closing this issue.