Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Fix site deployment #17

Closed
wants to merge 3 commits into from

Conversation

tcharding
Copy link
Member

Fix site deployment by doing:

  • Commit some resources
  • Add the build.sh script back as it was when we recently removed it [0]
  • Remove the gh-pages CI job

Please see last patch for explanation and reasoning.

[0] I ran the build script, site is live now with the new cookbook!

I'm not sure where these came from but commit them anyways.
Recently we removed the build/deployment script, add it back it.
The gh-pages CI job is incorrect. We maintain two separate repositories,
one for the web site source code and one for the built site. We use the
`build.sh` script to build and deploy the site.

The reason for the separation is so that the source code is not tied
to the site hosting. Just because we currently host the site using
github pages there is no reason that we must continue to do so. Keeping
the hosting separate from the source means we can immediately switch
to a new hosting service by just grabbing the built site and moving it
to the new host, no changes to the source files required.

This separation also allows us to merge things into `master` and
manually control when we deploy while still testing each merge in this
repo.
@tcharding
Copy link
Member Author

cc @realeinherjar

Happy to take your input on the repository separation but as I see it I still think the separation is valid. Also this PR requires the least work by Andrew since everything is already set up like this. (He has admin perms to the org.)

@realeinherjar
Copy link
Contributor

realeinherjar commented Oct 12, 2023

I think that we should think what is best in the long-term.

First, repository separation:
I think we should delete/archive rust-bitcoin/www.rust-bitcoin.org
and move all publishing activities to rust-bitcoin/rust-bitcoin.github.io.
The problem is that GitHub Pages hardcodes the main landing page for any hosted GitHub Pages to the orgname.github.io repo.
I searched this extensively and I cannot find a workaround to circumvent this.
Any other organization repo, e.g. orgname/repo, that publishes a GitHub Pages would be accessible in www.orgname.com/repo.
Hence, that's why the GitHub Pages deployment in rust-bitcoin/www.rust-bitcoin.org redirects to http://rust-bitcoin.org/www.rust-bitcoin.org/.
Thus, if we keep committing on rust-bitcoin/www.rust-bitcoin.org, we will have to do the duplicate work to update the same changes to rust-bitcoin/rust-bitcoin.github.io.
It doesn't make sense...

Second, the bash script:
I don't think a bash script is the least work.
Someone needs to run it.
Additionally, it depends on Hugo and mdbook, so who is in charge of running it also needs to keep Hugo and mdbook installed, updated and maintained.
We already saw a problem with an older version of mdbook not rendering code locally correct, as in #9 (comment).
The GH Action is the least effort it runs every time there's a new change on master rebuilds the website and publishes it.
No need to run any bash script.
No need for you or andrew to do anything.

Conclusion: if we archive/delete rust-bitcoin/www.rust-bitcoin.org and move all activities (including the GH Pages CI action) to rust-bitcoin/rust-bitcoin.github.io will be most logical and easy to maintain course of action. No need for duplicate work or bash scripts that depend on someone's local dependencies.

EDIT: for the

should delete/archive rust-bitcoin/www.rust-bitcoin.org
and move all publishing activities to rust-bitcoin/rust-bitcoin.github.io

it would be easy just to copy master of rust-bitcoin/www.rust-bitcoin.org to master of rust-bitcoin/rust-bitcoin.github.io and commit.

@tcharding
Copy link
Member Author

I had a bit more of a read of the github docs, it seems we have two options

  1. deploy from branch
  2. deploy with github actions

I believe you are suggesting we use (2). A few problems I see

  1. Its in beta
  2. It supports Jekyll sites or static HTML

So it looks like to get our build to work we have to do custom stuff, am I missing something?

Said another way, where do you propose the static site files go once built? In the gh-pages job that is removed in this PR I don't understand where they will live after the build VM goes away?

@realeinherjar
Copy link
Contributor

So it looks like to get our build to work we have to do custom stuff, am I missing something?

We need to do what we are doing here (including the GH Actions CI) in rust-bitcoin/rust-bitcoin.github.io.

Said another way, where do you propose the static site files go once built? In the gh-pages job that is removed in this PR I don't understand where they will live after the build VM goes away?

It is a static site, or client-side rendered. GH Pages do not support server-side rendering.
The GH Pages CI renders everything (hugo and mdbook) and then commits the server HTML, CSS and JS code into the gh-pages in the / root folder.
GH Pages then monitors that gh-pages branch and redeploy on changes.

Everything that you do with your build.sh is automated and done by the GH Pages CI.

@tcharding
Copy link
Member Author

oooo, the gh-pages branch was the piece I was missing. I'm going to push the current state of master on this repo to the https://github.com/rust-bitcoin/rust-bitcoin.github.io/settings/pages repo and configure that repo to use the gh-pages branch. I'm don't know what the current behaviour of that repo is in regards to running the actions though. I'll manually create the gh-pages branch with the current site on it so that we don't get down time. Then next time we push to master we will see if it re-builds.

@realeinherjar
Copy link
Contributor

I'm going to push the current state of master on this repo to the https://github.com/rust-bitcoin/rust-bitcoin.github.io/settings/pages repo and configure that repo to use the gh-pages branch.

I don't follow. You mean rust-bitcoin/www.rust-bitcoin.org/master to rust-bitcoin/rust-bitcoin.github.io/master?

If yes,
I am confident that the it will work.
I did all this here thinking that this was the repo behind <www.rust-bitcoin.org>.

So what if we archive this repo and migrate all issues and PRs to rust-bitcoin/rust-bitcoin.github.io?

@tcharding
Copy link
Member Author

I've got a bad feeling its not going to handle the submodule (site/themes/nightfall). I'm going to push it anyway, lets see.

@tcharding
Copy link
Member Author

tcharding commented Oct 12, 2023

I'm going to push the current state of master on this repo to the https://github.com/rust-bitcoin/rust-bitcoin.github.io/settings/pages repo and configure that repo to use the gh-pages branch.

I don't follow. You mean rust-bitcoin/www.rust-bitcoin.org/master to rust-bitcoin/rust-bitcoin.github.io/master?

My bad, cut'n'pasta fail.

If yes, I am confident that the it will work. I did all this here thinking that this was the repo behind <www.rust-bitcoin.org>.

So what if we archive this repo and migrate all issues and PRs to rust-bitcoin/rust-bitcoin.github.io?

Yep, we should do that.

@tcharding
Copy link
Member Author

@apoelstra, I've been intentionally not mentioning you to shield you from all this but now we need you to please update some settings. To save you reading everything this is whats happened:

  • I migrated all the source code from github.com/rust-bitcoin/www.rust-bitcoin.org to https://github.com/rust-bitcoin/rust-bitcoin.github.io (I created a couple of patches on master in my tree then pushed to upstream).
  • First I branched off gh-pages on that repo and pushed that branch, and configured the repo to serve from that branch
  • Now, in order for the github actions to run (build and deploy on push to master) we need your perms to set the github actions settings please
# This needs the following setting:
# Setttings > Actions > General > Workflow permissions
# change to "Read and write permissions"

@tcharding
Copy link
Member Author

Once that is all done we can:

  • Migrate issues/PRs from www.rust-bitcoin.org to this repo
  • Archive www.rust-bitcoin.org
  • Stop pushing to master and go back to only PRing things in - bad Tobin, no biscuit.

@realeinherjar
Copy link
Contributor

Any updates on this?

@apoelstra
Copy link
Member

Just looking at this now, sorry, sometimes I forget to look at the github notification "reason" column and miss mentions.

@apoelstra
Copy link
Member

@tcharding I think the "read and write permissions" setting is already set.

@tcharding
Copy link
Member Author

We don't want to go this direction.

@tcharding tcharding closed this Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants