Piku: Allows git push deployments to your own servers
github.com
github.com
https://github.com/piku/webapp-tutorial?tab=readme-ov-file#b...
It explains how piku works under the hood, as well as showing a minimalistic Python web app example from a user standpoint.
thanks for that. I have no idea what heroku is or does.
Git push deployment where it detects your stack and automatically builds, then deploys with zero downtime.
So, did I understand correctly, that Pico installs both an agent on the remote machine and a commit hook on the local machine? Why didn't they minimize the overhead by just making the remote machine a Git remote and do all the work there when you push a specific branch to that remote?
There is no commit hook on the local machine. On the local machine, you simply have a shim named "piku" which is essentially running "ssh remote /path/to/piku.py $@" to control the remote machine.
At a minimum, your doc should be prominently linked to from both the piku repo and the piku docs (or more prominently linked, if it's already linked somewhere), if not pulled completely into the docs home page.
That said, if you're interested in a suggestion, take a look at an end-to-end coolio tutorial that shows how to go from new bare metal server to publicly accessible custom domain name with SSL cert, and add the extra steps to your doc (even though yes, they have nothing directly to do with piku, because they have everything to do with what a potential new user actually wants to do and the potential new user doesn't know how to do those steps yet even though you do).
Your doc is already hundreds of times more useful than the main piku docs page. Extending your doc to cover an example of how to get to exposing a publicly accessible custom domain with SSL cert would make your doc hundreds of times more useful than it is now. Yes, I know, there are a ton of ways to get from where your doc ends to a publicly available custom domain with SSL cert. Pick one. It doesn't matter what you pick. The person who cares which approach you use already knows how to do the approach they prefer. You're adding these steps for the person who doesn't know how to do any of the anpproaches and just wants to get to their site hosted on a $5 droplet or whatever.
Again, your page is a huge help, this suggestion is just about making your page a huger help.
For reference, here's a sample coolio end-to-end example showing how they go from bare metal to publicly accessible custom domain with SSL:
https://billyle.dev/posts/self-hosting-your-website-with-coo...
The goal of all this isn't about making it possible to do things, it's about massively increasing the number of people who adopt piku by making it easier for more people to do so.
Most of the deployments I got wind of are on extremely stable distros - typically LTS versions where you will not need to upgrade your runtime every six months (and my website has been running in it for at least two Ubuntu LTS releases…)
But you can trivially use pyenv/nvenv/etc. by just setting environment variables. My home automation system now needs two different Node versions, and I have one set per app.
The service was ironically so old that no modern vulnerability scanner or programming language would be able to connect!
This made me seeiously ponder the fleeting nature of modern world - SSL support was everywhere 15 years ago, and now I, as an expert, had great problems using it. What chance do we have in 100 years?
IMO that quality should be the default, and I would choose my OS and tech stacks accordingly.
I've upgraded my dokku install over 3-4 Ubuntu LTS so far and it's been problem free for my use case of hosting little side projects on a VPS.
It seems so elegant and I love the "it just works" attitude, and I do understand that docker can't be used everywhere due to its technical (and mental) overhead, but I love it because it allows to isolate everything, freeze everything in time so running a container 5 years for now "just works".
In my humble workflow, I'm using lazydocker to manage the containers, gitlab workflow (action?) for deployment on push and a small VPS to build and push the containers to gitlab registry and to run it, on the same VPS. It's a little bit overkill - I could use a combination of a Dockerfile and a compose.yml with docker compose build. Also, I didn't figure out scaling yet. Good thing I don't need it! Otherwise I would swap docker for k8s and lazydocker for k9s.
(I'm open to suggestions. I just got into devops, and I love it!)
My entire server is then managed declaratively, so if I want to add a new project, it’s like 3-5 lines of Nginx config and push, that’s all. Something goes wrong? Just revert the commit.
As far as the nixos config is concerned, there is nothing crazy in it. It is just a regular nix config with nginx (https://nixos.wiki/wiki/Nginx). You can see there that adding nginx is just four lines of code, ~eight with ssl. Use it to proxy to your applications that are setup as systemd services (https://wiki.nixos.org/wiki/Systemd/User_Services).
Edit: btw I'm a big fan of asciinema! ty for making it. :)
What this means is that you can now generate a docker image locally using similar build tooling to Heroku’s “git push” logic that detects language support and does the right thing TM. Here’s a tutorial for building a Rails app with the buildpack I maintain https://www.schneems.com/2024/05/01/build-a-ruby-on-rails-ap...
Would love some feedback, if you try it. Please consider posting about the experience in the linked discussion (good, bad, indifferent, or whatever I just want more feedback to improve the experience).
This is timely for me as well as I just open sourced (yesterday!) a project that is in the same space, but for Kubernetes (https://github.com/pier-oliviert/sequencer).
All of this to say, congrats! It looks great.
If you set up a server, you can create a git repo by just doing `git init --bare`, add the setting `git config receive.denyCurrentBranch updateInstead`.
After that you can use git hooks (more specifically push-to-checkout hook), to receive uploads, compile and launch. The hook will just be a simple shell script, the most basic version could be a variant of `compile && install && systemctl restart service`.
From there you'll be able to copy the repo locally and pushing your changes will now trigger the hook you've setup.
git clone root@yourserver.com:/path/to/git/folder
Why would I want to use Piku? Would it give me some benefits I currently don't have?
Spinning up a server and installing a repo on it is easy. Depends on your use case and on what you know/have.
I prefer ansible or jenkins+scp-build-to-server+run-deploy.script
I added it to my tools list in case i need sth quick'n working for a small team/to recommend when there's no ansible/sysadmin knowledge available.
(I haven't looked into piku but i guess you'll hit its limitation once you have more complex deployment schemes, privilege/access management, ...)
I wish I had known about this project ~18 months ago. I was specifically looking for a way to have a Heroku-like dev experience deploying to my Raspberry Pi, and this looks like it's trying to be exactly that.
Still, Chris did a public presentation on it near the beginning (video’s in the docs) and other folk did similar things, so…
https://cloudinit.readthedocs.io/en/latest/howto/rerun_cloud...
One thing it already does (optionally) is to kill off unused instances and idle, lazily starting them when a new connection comes in.
https://github.com/epinio/epinio/
https://github.com/kube-hetzner/terraform-hcloud-kube-hetzne...
So basically not at all the same? :D
The point of piku seems to be: Heroku experience without requiring docker, and with a really simple architecture, and that it works on ARM.
Kubernetes works on ARM, I give you that. But AFAIK, Kubernetes requires you to use some sort of containers (Docker or otherwise) and its architecture is anything but simple (for obvious reasons).
Besides that, I don't see how epinion enables the "git push" workflow, the quick start tutorial seems to tell you to run "epinio push manifest.yaml" or similar to deploy the application, so it doesn't fit with the "Heroku-like experience" either.
So really, the only things they have in common is that they handle deployments?
I should have said „I like Epinio, as well“ because I also like Piku, especially for its minimalistic approach and readable code, but when it comes to actually using it for deployments, I prefer Kubernetes.
There is also:
https://kamal-deploy.org/ https://github.com/basecamp/kamal
sftp user@host remoteFile localFile
Joking aside, I’m a bit surprised such a tool would be developed in Python given its dependency’s and runtime (which is not easy on the user).Also, Python is everywhere, on every OS and Linux system, so it was a natural choice. I also wanted it to be easily hackable and extensible, and few languages would make it simpler to understand or extend.
- piku deploys via git rather than scp/sftp, but authenticates via ssh like those tools
- piku supports a number of runtimes, including Python, Ruby, Node, Go, Clojure. The runtimes are implemented rather simply, you can add your own rather easily, see examples here in the code: https://github.com/piku/piku/blob/8777cc093a062c67d3bead9a5d...
- For each runtime, a mechanism is utilized to install and isolate package dependencies (requirements.txt in Python, Gemfile in Ruby, packages.json in Node, etc.)
- a Procfile and ENV file are used to declare your application entrypoints and envvars akin to Heroku / 12 Factor App ideas
- a CLI (ssh shim on dev client machine) is provided for checking status and logs from the client (as well as stop/start/restart)
- since all applications are managed via uwsgi on the remote, there is also support for worker/sidecar processes and cronjob-style scheduled tasks
- HTTPS via Let's Encrypt (acme.sh) is handled automagically for web apps
I describe more about how piku works in this tutorial:
https://github.com/piku/webapp-tutorial?tab=readme-ov-file#b...
You're right that PHP apps have a simple deployment story, and in a way piku brings something akin to this level of simplicity to other web programming runtimes.
That said I want to give this a go but don't immediately see how I can migrate my overengineered 8-10 container spaghetti of a docker-compose file to a state where I can use piku instead of manual 'git pull && docker compose up' on the remote
Currently hyping myself up to drastically simplify everything, which will be a joy onto itself
Another question is subdomain support: to have a catch all virtual host that will respond to anything.domain.tld and have wildcard letsenrypt enabled ssl with DNS challenge.
Those two problems make me think that my side gig has grown up enough to switch to ArgoCD/K8s, although there are many other problems that come with it (from my experience on the day job). For now I just do the certificate rotation manually, which is not much ideal but works with a couple make targets.
If you have to think about it, it isn't worth it. You'll know when it is time to refactor your infra.
Not quite the 'push deploy', but that was the way apps were developed back in the days, and for some reason I still prefer that approach. Commit, test, and at one point manually nominate and deploy stable version.
GitHub will call the webhook after a push to main and a successful test suite run. Snare runs a shell script on my server to git pull, build, deploy, and call a cronitor.io hook for monitoring deploy success.
I've been pretty happy with how relatively simple it is and how well it works.
Love the focus on being lightweight
Recently I wanted to create a super basic website, and discovered it’s actually pretty hard to create something simple
And then, even if you manage to create something actually simple, you usually end up having to manage some not so simple deployment process together with hopefully some sort of version control
Ended up settling for putting plain html/css/js files in a git repo, then configuring auto deploy to GitHub Pages on merge to master (via Actions)
Yes, ftp is pretty easy for static sites. However, given I want to have version control, it’s nice to have automated deploys happen after a git push
But uwsgi performance overhead is a concern. Altough last time I've done anything with uwsgi that was probably over a decade ago.
And last time I checked, Go required to import the uwsgi package, maybe not anymore? Or is uwsgi used only for Python here?
Also I wonder how to define nginx routes aka locations?
Also, what is the localdev UX like? With Docker Swarm I can easily run very similar setups in dev, test and prod, and it works with multi-node setups, has support for secrets etc. But the lack of work going into Docker Swarm becomes more concerning as the years pass by.
Also, had no idea systemd-proxy was a thing - is there anything systemd doesn't have its tentacles into? :)
It's not designed to work on local envs. When I wanted to debug infra I used to run it on Vagrant though
Looking at you sir mixalot:
This afaik is missing from most PaaS tools (CapRover excluded, but it has been illegally relicensed to non-open-source). Perhaps watchtower or something could replace the functionality?
"CapRover has built in anonymous usage analytics starting v1.11"
https://github.com/caprover/caprover/blob/master/TERMS_AND_C...
https://github.com/caprover/caprover/issues/1852
Was looking at CapRover to see if it has REST API
Looks shaddy
I’m thinking of forking it and adding all his dumb and easy table stakes features (2fa etc) that he is trying to gate as subscriptionware.
Off the top of my head I know of
coolify dokku kamal
and now piku
You can use docker run commands, but that’s not the main goal.
piku itself is neat and I like it.
I actually only install piku via cloud-init, but there are plenty more options: https://piku.github.io/install/index.html
Which leaves me the same number of questions.
So, what is Platform as a Service?
A "Platform," in the context of IT and software (and especially the internet), is some IT infrastructure, generally a server and the software installed on it, that you can host something on, such as an app or a website.
A "Platform as a Service" is when someone else sets up your platform for you so that you don't have to do it yourself—you get access to the platform and can use it for your own stuff, but don't have to configure or maintain most of it.
If the person setting it up is aware of the potential pitfalls and has a good explanation for the process - particularly if there is no build step involved and secrets are managed appropriately, then it can be fine.