3 ms·
For my personal blog, I have a poor man's version of a CMS written in Go that builds a binary locally and then scp it to the server directly using a Makefile th
by codegeek 3y ago
For my personal blog, I have a poor man's version of a CMS written in Go that builds a binary locally and then scp it to the server directly using a Makefile that also configures Caddy as a reverse proxy in front of the binary for other goodies like SSL etc and uses supervisor to run the binary. I don't even use Git for the personal blog (not yet :)). Here is the snippet from Makefile for deployment:
.PHONY: deploy/web
deploy/web:
ssh -i ~/.ssh/id_rsa2 -t root@${production_host_ip} '\
sudo supervisorctl stop ycblog\
'
scp ./build/ycblog-linux/ root@${production_host_ip}:/home/projects/ycblog
scp ./remote/production/Caddyfile root@${production_host_ip}:/home/projects/ycblog
ssh -t root@${production_host_ip} '\
sudo mv /home/projects/ycblog/Caddyfile /etc/caddy/ \
&& sudo systemctl reload caddy \
&& sudo supervisorctl start ycblog \
Whenever I change the code, I just do:
make deploy/web