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?
@c.westrom 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 <https://download.clojure.org/install/linux-install-1.10.2.774.sh>
- chmod +x linux-install-1.10.2.774.sh
- ./linux-install-1.10.2.774.sh
- clojure -X:build-services
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.
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.
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.I'm doing a lot of trial and error with this.
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"'
Now how can I move these artifacts to my pi? If it's through ssh, then how exactly?
how do we get that feedback to the people in charge of gitlab 😅
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.
good product feedback is more valuable than customers sometimes!
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 ...
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.
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.
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?
as in, "if a random developer doesn't solve this issue for me, I won't cut a release?"
Kind of, yes.
Except that solving the issue is not for me.
> 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
This app is absolutely impressive (free Photoshop in the browser) http://photopea.com
👍 That’s where I learned about it.