Fork me on GitHub
#off-topic
<
2021-04-11
>
West01:04:25

What's the simplest way to do continuous deployment of static pages? I just want my site to update on my raspberry pi every time I push to master. I use gitlab if that makes things easier. Anybody know how to use gitlab ci-cd?

solf02:04:12

The simplest way would be to use plain ssh - Create a pair of private/public ssh keys - Store the private key on a gitlab variable - Add the public key to your raspberry’s authorized keys From gitlab-ci.yaml: - get the contents of the variable and echo them to ~/.ssh/id_rsa - you might have to either disable ssh host checking, or add the server public key to known hosts - run scp ...

West05:04:59

Do you know how shell runners work? I'm using a hand-rolled static site generator. Since I can't seem to get node and clojure running in docker, I figured I could just use shell commands.

gklijs06:04:02

I guess a webhook would be easier, just have gitlab call the webhook on each push to master. On the pi, when the webhook is triggered, pull and build the site.

solf07:04:07

@U01KQ9EGU79 I’m not sure I understand. Gitlab-ci uses docker by default, but from your point of view it’s just writing shell commands. Shell runners is a kind of gitlab-ci-runner that you install on a server, but it’s really overkill for your usecase. Can you paste what you’ve tried so far? Here’s an example that I use for running one of my clojure projects on gitlab-ci. There’s no node, but you could just apt install node:

build_jar:
  stage: build_jar
  image: clojure:openjdk-11-lein-stretch
  artifacts:
    paths: [Services.jar]
  script:
    # Install clojure tools
    - curl -O 
    - chmod +x linux-install-1.10.2.774.sh
    - ./linux-install-1.10.2.774.sh
    - clojure -X:build-services

solf07:04:46

This is actually a weird example as I’m using an image with lein installed (`clojure:openjdk-11-lein-stretch` ) and then I install clojure tools, because at some point I was running lein and clojure in parallel.

West18:04:28

Ok, I didn't know that you could specify an image like that. I thought you could only use the default ruby 2.6 unless you host your own runner.

West18:04:00

stages:
  - deploy
deploy:
  stage: deploy
  image: clojure:openjdk-17-tools-deps-alpine
  script:
    - apk add yarn
    - yarn install
    - yarn release
    - mkdir public/
    - touch public/index.html
    - cp -R public/* /var/www/westrom.xyz/html
Here's what I have so far.

West18:04:41

I'm doing a lot of trial and error with this.

West19:04:42

Ok, I've created some artifacts.

stages:
  - deploy

workflow:
  rules:
    - if: '$CI_COMMIT_BRANCH'

deploy:
  stage: deploy
  image: clojure:openjdk-17-tools-deps-alpine
  script:
    - apk add yarn
    - yarn install
    - yarn release
  artifacts:
    paths:
      - public
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'

West19:04:24

Now how can I move these artifacts to my pi? If it's through ssh, then how exactly?

West21:04:46

Ok, I got it! I found out about variables in gitlab. Now I can do scp. The pipeline is complete! \o/ I must say, although it's nice to use gitlab as it's all integrated, but I don't like how spread out their UI is. Not a very intuitive experience with deploying to a raspberry pi. It's super convoluted trying to do a simple thing like build and deploy.

sova-soars-the-sora17:04:57

how do we get that feedback to the people in charge of gitlab 😅

West19:04:13

I'm sure there's a way to get that message to them. They're a corporation after all. They're selling gitlab as a product.

sova-soars-the-sora15:04:51

good product feedback is more valuable than customers sometimes!

Vincent Cantin08:04:59

I am trying an experimental idea, a Github issue's tag named "no contrib no release". Example: https://github.com/green-coder/girouette/labels/no%20contrib%20no%20release%20%F0%9F%98%8E Do you think it is going to work or the project will just die as a consequence of it?

vemv16:04:25

as in, "if a random developer doesn't solve this issue for me, I won't cut a release?"

Vincent Cantin16:04:41

Except that solving the issue is not for me.

vemv16:04:11

> Do you think it is going to work or the project will just die as a consequence of it? not sure if it will work, but the worst-case scenario seems pretty harmless :) one would just backpedal

West21:04:46

Ok, I got it! I found out about variables in gitlab. Now I can do scp. The pipeline is complete! \o/ I must say, although it's nice to use gitlab as it's all integrated, but I don't like how spread out their UI is. Not a very intuitive experience with deploying to a raspberry pi. It's super convoluted trying to do a simple thing like build and deploy.

raspasov22:04:15

This app is absolutely impressive (free Photoshop in the browser) http://photopea.com

👀 3
👍 4
raspasov09:04:54

👍 That’s where I learned about it.

👍 4