nairobilug / nairobilug.or.ke

A lively community of GNU/Linux 🐧 enthusiasts
https://nairobilug.or.ke
22 stars 35 forks source link

Automate hosting setup #189

Closed ianmuchina closed 3 years ago

ianmuchina commented 4 years ago

Right now, (I think) the maintainers do this each time there is a PR/change to be made

Merge PR -> 👨‍💻 Pull repo -> generate site -> 🥱 push to gh-pages -> site deployed

I propose we use some sort of automation so the work-flow looks like this.

Merge PR -> 🤖 Automation 🤖 -> site deployed

Option 1. Netlify

The services focus on making static site hosting easier.

Advantages

Disadvantages

Demo

Example PR with preview url

Other providers

Option 2. github-pages + github actions

Github actions can be used to automate almost anything.

Advantages

Demo

Example site actions.yml fotr the site

If we end up using github actions, we can still use netlify just for checks & deploy previews.

jasonrogena commented 4 years ago

@IanMuchina for simplicity’s sake, "Option 2" seems viable to me.

bkmgit commented 4 years ago

@jasonrogena @IanMuchina Possibly ok without previews. One can update the site as needed if some errors are found. Actions are well documented: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/introduction-to-github-actions Possible steps to put in an action (not tested, but may help get started) is in #190

ianmuchina commented 4 years ago

@bkmgit this should work.

name: Update Website

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true # Gets all submodules
          fetch-depth: 0 # get entire history

      - name: Python
        uses: actions/setup-python@v2     
        with:
          python-version: 3.8

      - name: Install dependencies
        run: pip install -r requirements.txt

      - name: Generate site 
        run: make html

      - name: push output to gh-pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./output

https://github.com/peaceiris/actions-gh-pages

ianmuchina commented 4 years ago

The output looks like this

bkmgit commented 4 years ago

@IanMuchina Thanks. Current request #190 should work, requirements do not always seem to install cleanly. Also uses fewer dependencies.

bkmgit commented 4 years ago

@IanMuchina Sorry did not realise you had something working 17 days ago! Would have suggested just using that.

ianmuchina commented 4 years ago

@jasonrogena @bkmgit

191

bkmgit commented 3 years ago

Some alternatives to Netlify: https://vercel.com/ https://blog.cloudflare.com/cloudflare-pages/

It might be nice to transition to a different static site generator with fewer dependencies: https://jamstack.org/generators/ Maybe something written in Go, Ruby, Rust or C++

ianmuchina commented 3 years ago

Cloudflare pages is a really good option

alanorth commented 3 years ago

I agree with @jasonrogena that GitHub pages is the best option. The idea behind using GitHub originally was that the site's code is managed in git so that anyone in the world who wants to contribute can—in the true social code model. As for updating the website, that should be automated, but trigger-able by a few people in the LUG with permissions.

Managing everything in GitHub makes it easier to keep most of our user/group/permissions management in one place. We don't have to maintain accounts on third-party service providers and try to share the passwords. Let's not over-engineer this. The one exception to this is that @rwanyoike and I have access to the CloudFlare account that manages DNS for nairobilug.or.ke.

I don't think we need deploy previews. It's cool of course, but our website changes just about once a month and it's not critical infrastructure. For what it's worth, when I was more active in the LUG I would attach a screenshot to my pull requests.