kopia lustrzana https://github.com/piku/piku
refactor: replace incron with systemd.path
rodzic
547d3b3dae
commit
2a6a8b7de6
|
@ -18,7 +18,6 @@ RUN apt-get update \
|
||||||
git \
|
git \
|
||||||
build-essential \
|
build-essential \
|
||||||
git \
|
git \
|
||||||
incron \
|
|
||||||
nginx \
|
nginx \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3-click \
|
python3-click \
|
||||||
|
|
|
@ -18,7 +18,6 @@ RUN apt-get update \
|
||||||
git \
|
git \
|
||||||
build-essential \
|
build-essential \
|
||||||
git \
|
git \
|
||||||
incron \
|
|
||||||
nginx \
|
nginx \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3-click \
|
python3-click \
|
||||||
|
|
|
@ -18,7 +18,6 @@ RUN apt-get update \
|
||||||
git \
|
git \
|
||||||
build-essential \
|
build-essential \
|
||||||
git \
|
git \
|
||||||
incron \
|
|
||||||
nginx \
|
nginx \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3-click \
|
python3-click \
|
||||||
|
|
|
@ -18,7 +18,6 @@ RUN apt-get update \
|
||||||
git \
|
git \
|
||||||
build-essential \
|
build-essential \
|
||||||
git \
|
git \
|
||||||
incron \
|
|
||||||
nginx \
|
nginx \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3-click \
|
python3-click \
|
||||||
|
|
|
@ -16,8 +16,6 @@ The tiniest Heroku/CloudFoundry-like PaaS you've ever seen.
|
||||||
|
|
||||||
The current plan is to throw up a warning for older runtimes and do regression testing for 3.7, 3.8, 3.9 and 3.10 (replacing the current bracket of tests from 3.5 to 3.8)
|
The current plan is to throw up a warning for older runtimes and do regression testing for 3.7, 3.8, 3.9 and 3.10 (replacing the current bracket of tests from 3.5 to 3.8)
|
||||||
|
|
||||||
> **Note:** `piku` currently does not run on Debian 11 (`bullseye`) since the `incron` package has been removed from the distro. We are evaluating using [a custom `systemd.path` unit](https://www.freedesktop.org/software/systemd/man/systemd.path.html) (and accepting contributions for it).
|
|
||||||
|
|
||||||
## Goals and Motivation
|
## Goals and Motivation
|
||||||
|
|
||||||
I kept finding myself wanting an Heroku/CloudFoundry-like way to deploy stuff on a few remote ARM boards and [my Raspberry Pi cluster][raspi-cluster], but since [dokku][dokku] didn't work on ARM at the time and even `docker` can be overkill sometimes, I decided to roll my own.
|
I kept finding myself wanting an Heroku/CloudFoundry-like way to deploy stuff on a few remote ARM boards and [my Raspberry Pi cluster][raspi-cluster], but since [dokku][dokku] didn't work on ARM at the time and even `docker` can be overkill sometimes, I decided to roll my own.
|
||||||
|
|
|
@ -227,12 +227,15 @@ sudo service uwsgi-piku start
|
||||||
*PLEASE NOTE:* There is a bug in `nginx` 1.6.2 under Raspbian 8 that causes it to try to allocate around a gigabyte of RAM when using SSL with SPDY. I seriously recommend using Ubuntu instead, if you can, or disabling SSL altogether.
|
*PLEASE NOTE:* There is a bug in `nginx` 1.6.2 under Raspbian 8 that causes it to try to allocate around a gigabyte of RAM when using SSL with SPDY. I seriously recommend using Ubuntu instead, if you can, or disabling SSL altogether.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt-get install nginx incron
|
|
||||||
# Set up nginx to pick up our config files
|
# Set up nginx to pick up our config files
|
||||||
sudo cp /tmp/nginx.default.dist /etc/nginx/sites-available/default
|
sudo cp /tmp/nginx.default.dist /etc/nginx/sites-available/default
|
||||||
# Set up incron to reload nginx upon config changes
|
# Set up systemd.path to reload nginx upon config changes
|
||||||
sudo cp /tmp/incron.dist /etc/incron.d/piku
|
sudo cp ./piku-nginx.{path, service} /etc/systemd/system/
|
||||||
sudo systemctl restart incron
|
sudo systemctl enable piku-nginx.{path,service}
|
||||||
|
sudo systemctl start piku-nginx.path
|
||||||
|
# Check the status of piku-nginx.service
|
||||||
|
systemctl status piku-nginx.path # should return `Active: active (waiting)`
|
||||||
|
# Restart NGINX
|
||||||
sudo systemctl restart nginx
|
sudo systemctl restart nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ As of April 2016, the shipping versions with Raspbian are recent enough to run `
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# as 'pi' user
|
# as 'pi' user
|
||||||
sudo apt install -y python-virtualenv python-pip git uwsgi uwsgi-plugin-python incron nginx
|
sudo apt install -y python-virtualenv python-pip git uwsgi uwsgi-plugin-python nginx
|
||||||
sudo pip install -U click
|
sudo pip install -U click
|
||||||
sudo reboot
|
sudo reboot
|
||||||
```
|
```
|
||||||
|
@ -61,7 +61,7 @@ Clone the [piku repo](https://github.com/piku/piku) somewhere and copy files to
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# as yourself in your desktop/laptop computer
|
# as yourself in your desktop/laptop computer
|
||||||
scp piku.py uwsgi-piku.service nginx.default.dist incron.dist pi@your_machine:/tmp
|
scp piku.py uwsgi-piku.service nginx.default.dist pi@your_machine:/tmp
|
||||||
scp your_public_ssh_key.pub pi@your_machine:/tmp
|
scp your_public_ssh_key.pub pi@your_machine:/tmp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -80,12 +80,16 @@ sudo systemctl enable uwsgi-piku
|
||||||
Prepare nginx:
|
Prepare nginx:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt-get install nginx incron
|
sudo apt-get install nginx
|
||||||
# Set up nginx to pick up our config files
|
# Set up nginx to pick up our config files
|
||||||
sudo cp /tmp/nginx.default.dist /etc/nginx/sites-available/default
|
sudo cp /tmp/nginx.default.dist /etc/nginx/sites-available/default
|
||||||
# Set up incron to reload nginx upon config changes
|
# Set up systemd.path to reload nginx upon config changes
|
||||||
sudo cp /tmp/incron.dist /etc/incron.d/piku
|
sudo cp ./piku-nginx.{path, service} /etc/systemd/system/
|
||||||
sudo systemctl restart incron
|
sudo systemctl enable piku-nginx.{path,service}
|
||||||
|
sudo systemctl start piku-nginx.path
|
||||||
|
# Check the status of piku-nginx.service
|
||||||
|
systemctl status piku-nginx.path # should return `Active: active (waiting)`
|
||||||
|
# Restart NGINX
|
||||||
sudo systemctl restart nginx
|
sudo systemctl restart nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -6,21 +6,24 @@ Full installation sequence on a blank Ubuntu 16.04 machine:
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y dist-upgrade
|
sudo apt-get -y dist-upgrade
|
||||||
sudo apt-get -y autoremove
|
sudo apt-get -y autoremove
|
||||||
sudo apt-get install -y tmux vim htop fail2ban uwsgi uwsgi-plugin-python uwsgi-plugin-python3 uwsgi-plugin-asyncio-python3 uwsgi-plugin-gevent-python uwsgi-plugin-tornado-python nginx incron libxml2-dev libxslt1-dev python-dev zlib1g-dev build-essential git python3-virtualenv python3-pip python3-click
|
sudo apt-get install -y tmux vim htop fail2ban uwsgi uwsgi-plugin-python uwsgi-plugin-python3 uwsgi-plugin-asyncio-python3 uwsgi-plugin-gevent-python uwsgi-plugin-tornado-python nginx libxml2-dev libxslt1-dev python-dev zlib1g-dev build-essential git python3-virtualenv python3-pip python3-click
|
||||||
sudo pip3 install -U click pip
|
sudo pip3 install -U click pip
|
||||||
sudo adduser --disabled-password --gecos 'PaaS access' --ingroup www-data piku
|
sudo adduser --disabled-password --gecos 'PaaS access' --ingroup www-data piku
|
||||||
|
|
||||||
# move to /tmp and grab our distribution files
|
# move to /tmp and grab our distribution files
|
||||||
cd /tmp
|
cd /tmp
|
||||||
wget https://raw.githubusercontent.com/piku/piku/master/piku.py
|
wget https://raw.githubusercontent.com/piku/piku/master/piku.py
|
||||||
wget https://raw.githubusercontent.com/piku/piku/master/incron.dist
|
wget https://raw.githubusercontent.com/piku/piku/master/piku-nginx.path
|
||||||
|
wget https://raw.githubusercontent.com/piku/piku/master/piku-nginx.service
|
||||||
wget https://raw.githubusercontent.com/piku/piku/master/nginx.default.dist
|
wget https://raw.githubusercontent.com/piku/piku/master/nginx.default.dist
|
||||||
wget https://raw.githubusercontent.com/piku/piku/master/uwsgi-piku.service
|
wget https://raw.githubusercontent.com/piku/piku/master/uwsgi-piku.service
|
||||||
# Set up nginx to pick up our config files
|
# Set up nginx to pick up our config files
|
||||||
sudo cp /tmp/nginx.default.dist /etc/nginx/sites-available/default
|
sudo cp /tmp/nginx.default.dist /etc/nginx/sites-available/default
|
||||||
# Set up incron to reload nginx upon config changes
|
# Set up systemd.path to reload nginx upon config changes
|
||||||
sudo cp /tmp/incron.dist /etc/incron.d/piku
|
sudo cp ./piku-nginx.{path, service} /etc/systemd/system/
|
||||||
sudo systemctl restart incron
|
sudo systemctl enable piku-nginx.{path,service}
|
||||||
|
sudo systemctl start piku-nginx.path
|
||||||
|
# Restart NGINX
|
||||||
sudo systemctl restart nginx
|
sudo systemctl restart nginx
|
||||||
sudo cp /tmp/uwsgi-piku.service /etc/systemd/system/
|
sudo cp /tmp/uwsgi-piku.service /etc/systemd/system/
|
||||||
# refer to our executable using a link, in case there are more versions installed
|
# refer to our executable using a link, in case there are more versions installed
|
||||||
|
|
|
@ -31,7 +31,7 @@ At this point it is a good idea to `sudo shutdown -h now` and make a backup imag
|
||||||
Before installing `piku`, you need to install the following packages:
|
Before installing `piku`, you need to install the following packages:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt-get install -y build-essential certbot git incron \
|
sudo apt-get install -y build-essential certbot git \
|
||||||
libjpeg-dev libxml2-dev libxslt1-dev zlib1g-dev nginx \
|
libjpeg-dev libxml2-dev libxslt1-dev zlib1g-dev nginx \
|
||||||
python-certbot-nginx python-dev python-pip python-virtualenv \
|
python-certbot-nginx python-dev python-pip python-virtualenv \
|
||||||
python3-dev python3-pip python3-click python3-virtualenv \
|
python3-dev python3-pip python3-click python3-virtualenv \
|
||||||
|
@ -103,15 +103,18 @@ server {
|
||||||
include /home/PAAS_USERNAME/.piku/nginx/*.conf;
|
include /home/PAAS_USERNAME/.piku/nginx/*.conf;
|
||||||
```
|
```
|
||||||
|
|
||||||
## `incron` Configuration
|
## Set up systemd.path to reload nginx upon config changes
|
||||||
|
|
||||||
To detect configuration changes and tell `nginx` to activate new `piku` sites, we use `incron`. Create `/etc/incron.d/paas` with the following contents:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# replace `PAAS_USERNAME` with the username you created.
|
# Set up systemd.path to reload nginx upon config changes
|
||||||
/home/PAAS_USERNAME/.piku/nginx IN_MODIFY,IN_NO_LOOP /bin/systemctl reload nginx
|
sudo cp ./piku-nginx.{path, service} /etc/systemd/system/
|
||||||
|
sudo systemctl enable piku-nginx.{path,service}
|
||||||
|
sudo systemctl start piku-nginx.path
|
||||||
|
# Check the status of piku-nginx.service
|
||||||
|
systemctl status piku-nginx.path # should return `Active: active (waiting)`
|
||||||
|
# Restart NGINX
|
||||||
|
sudo systemctl restart nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
> This file was last updated on June 2019
|
> This file was last updated on June 2019
|
||||||
|
|
|
@ -10,7 +10,7 @@ Before installing `piku`, you need to install the following packages:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y build-essential certbot git incron \
|
sudo apt-get install -y build-essential certbot git \
|
||||||
libjpeg-dev libxml2-dev libxslt1-dev zlib1g-dev nginx \
|
libjpeg-dev libxml2-dev libxslt1-dev zlib1g-dev nginx \
|
||||||
python-certbot-nginx python-dev python-pip python-virtualenv \
|
python-certbot-nginx python-dev python-pip python-virtualenv \
|
||||||
python3-dev python3-pip python3-click python3-virtualenv \
|
python3-dev python3-pip python3-click python3-virtualenv \
|
||||||
|
@ -79,13 +79,17 @@ server {
|
||||||
include /home/PAAS_USERNAME/.piku/nginx/*.conf;
|
include /home/PAAS_USERNAME/.piku/nginx/*.conf;
|
||||||
```
|
```
|
||||||
|
|
||||||
## `incron` Configuration
|
## Set up systemd.path to reload nginx upon config changes
|
||||||
|
|
||||||
To detect configuration changes and tell `nginx` to activate new `piku` sites, we use `incron`. Create `/etc/incron.d/paas` with the following contents:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# replace `PAAS_USERNAME` with the username you created.
|
# Set up systemd.path to reload nginx upon config changes
|
||||||
/home/PAAS_USERNAME/.piku/nginx IN_MODIFY,IN_NO_LOOP /bin/systemctl reload nginx
|
sudo cp ./piku-nginx.{path, service} /etc/systemd/system/
|
||||||
|
sudo systemctl enable piku-nginx.{path,service}
|
||||||
|
sudo systemctl start piku-nginx.path
|
||||||
|
# Check the status of piku-nginx.service
|
||||||
|
systemctl status piku-nginx.path # should return `Active: active (waiting)`
|
||||||
|
# Restart NGINX
|
||||||
|
sudo systemctl restart nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
|
@ -3,7 +3,7 @@ digraph G {
|
||||||
graph [ dpi = 300 ];
|
graph [ dpi = 300 ];
|
||||||
bgcolor=transparent;
|
bgcolor=transparent;
|
||||||
truecolor=true;
|
truecolor=true;
|
||||||
{rank=same;sshd;uwsgie;nginx;incron;}
|
{rank=same;sshd;uwsgie;nginx;}
|
||||||
//rankdir=LR;
|
//rankdir=LR;
|
||||||
subgraph uwsgi_tree {
|
subgraph uwsgi_tree {
|
||||||
uwsgie [label="uwsgi" style=filled fillcolor=white fontname="Arial"];
|
uwsgie [label="uwsgi" style=filled fillcolor=white fontname="Arial"];
|
||||||
|
@ -46,10 +46,4 @@ digraph G {
|
||||||
nginx->nginx_confd [arrowhead=none style=dashed];
|
nginx->nginx_confd [arrowhead=none style=dashed];
|
||||||
nginx_confd->nginx_conf [arrowhead=none style=dashed];
|
nginx_confd->nginx_conf [arrowhead=none style=dashed];
|
||||||
}
|
}
|
||||||
subgraph incron_tree {
|
|
||||||
incron [fontname="Arial" style=filled fillcolor=white];
|
|
||||||
nginx_conf -> incron [label="watch", style="dotted", fontname="Arial" weight=0];
|
|
||||||
incron -> nginx [label="reload" style="dotted" fontname="Arial" weight=0];
|
|
||||||
incron->nginx_conf [style=invis];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/home/piku/.piku/nginx IN_MODIFY,IN_NO_LOOP /bin/systemctl reload nginx
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Monitor .piku/nginx for changes
|
||||||
|
|
||||||
|
[Path]
|
||||||
|
PathChanged=/home/piku/.piku/nginx
|
||||||
|
Unit=piku-nginx.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Restarts NGINX when .piku/nginx changes.
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/bin/systemctl reload nginx
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Ładowanie…
Reference in New Issue