Explicitly include click, just in case

pull/17/head
Rui Carmo 2018-07-24 21:11:51 +01:00
rodzic 21b7162b93
commit 6fb6d12795
3 zmienionych plików z 6 dodań i 196 usunięć

Wyświetl plik

@ -1,153 +0,0 @@
# Setting up a Raspberry Pi Piku Server from Scratch
## DISCLAIMER!
### These instructions are correct as of April 1st 2016
Start by flashing a SD card with [the latest Raspbian Jessie Lite image](https://www.raspberrypi.org/downloads/raspbian/).
# Do this in your Raspberry Pi as 'pi' user
Boot it, launch *raspi-config* to perform (at least) the following configuration:
```bash
# as 'pi' user
sudo raspi-config
```
* 1) expand filesystem
* 2) change default user password
* 3) set up memory split as you wish (for a headless server, 16MB for GPU)
Optionally:
* 4) set up over-clocking.
# Secure your install
Delete the existing SSH keys and recreate them (why? [read this](https://www.raspberrypi.org/forums/viewtopic.php?t=126892)).
```bash
# as 'pi' user
sudo rm -v /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server
sudo reboot
```
This will recreate the server keys. Next, update your system:
```bash
# as 'pi' user
sudo apt update
sudo apt upgrade
```
# Install required packages
As of April 2016, the shipping versions with Raspbian are recent enough to run `piku`:
```bash
# as 'pi' user
sudo apt install -y python-virtualenv python-pip git uwsgi uwsgi-plugin-python incron nginx
sudo pip install -U click
sudo reboot
```
# Meanwhile, go get the goodies while Raspberry Pi is rebooting
(We assume you know about ssh keys and have one "at hand", you'll need to copy it)
Clone the [piku repo](https://github.com/rcarmo/piku) somewhere and copy files to your Raspberry Pi
```bash
# as yourself in your desktop/laptop computer
scp piku.py uwsgi-piku.service nginx.default.dist incron.dist pi@your_machine:/tmp
scp your_public_ssh_key.pub pi@your_machine:/tmp
```
# Back to the Pi
Prepare uWSGI (part one):
```bash
# as 'pi' user
sudo ln -s `which uwsgi` /usr/local/bin/uwsgi-piku
sudo systemctl disable uwsgi
sudo cp /tmp/uwsgi-piku.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable uwsgi-piku
```
Prepare nginx:
```bash
sudo apt-get install nginx incron
# Set up nginx to pick up our config files
sudo cp /tmp/nginx.default.dist /etc/nginx/sites-available/default
# Set up incron to reload nginx upon config changes
sudo cp /tmp/incron.dist /etc/incron.d/piku
sudo systemctl restart incron
sudo systemctl restart nginx
```
Create 'piku' user and set it up
```bash
# as 'pi' user
sudo adduser --disabled-password --gecos 'PaaS access' --ingroup www-data piku
sudo su - piku
# this is now done as 'piku' user
mkdir ~/.ssh
chmod 700 ~/.ssh
cp /tmp/piku.py ~/piku.py
python piku.py setup
python piku.py setup:ssh /tmp/id_rsa.pub
# return to 'pi' user
exit
```
Prepare uWSGI (part two):
```bash
# as 'pi' user
sudo systemctl start uwsgi-piku
sudo systemctl status uwsgi-piku.service
```
# If you're still here, odds are your Pi is ready for work
Go back to your machine and try these commands:
```bash
# as yourself in your desktop/laptop computer
ssh piku@your_machine
Usage: piku.py [OPTIONS] COMMAND [ARGS]...
The smallest PaaS you've ever seen
Options:
--help Show this message and exit.
Commands:
apps List applications
config Show application configuration
config:get Retrieve a configuration setting
config:live Show live configuration settings
config:set Set a configuration setting
deploy Deploy an application
destroy Destroy an application
disable Disable an application
enable Enable an application
git-hook INTERNAL: Post-receive git hook
git-receive-pack INTERNAL: Handle git pushes for an app
logs Tail an application log
ps Show application worker count
ps:scale Show application configuration
restart Restart an application
setup Initialize paths
setup:ssh Set up a new SSH key
Connection to your_machine closed.
```
If you find any bugs with this quickstart guide, please let [Luis Correia](http://twitter.com/luisfcorreia) know ;)

Wyświetl plik

@ -1,40 +0,0 @@
# Ubuntu 16.04
Full installation sequence on a blank Ubuntu 16.04 machine:
```bash
sudo apt-get update
sudo apt-get -y dist-upgrade
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 python-virtualenv python-pip
sudo pip install -U click pip
sudo adduser --disabled-password --gecos 'PaaS access' --ingroup www-data piku
# move to /tmp and grab our distribution files
cd /tmp
wget https://raw.githubusercontent.com/rcarmo/piku/master/piku.py
wget https://raw.githubusercontent.com/rcarmo/piku/master/incron.dist
wget https://raw.githubusercontent.com/rcarmo/piku/master/nginx.default.dist
wget https://raw.githubusercontent.com/rcarmo/piku/master/uwsgi-piku.service
# Set up nginx to pick up our config files
sudo cp /tmp/nginx.default.dist /etc/nginx/sites-available/default
# Set up incron to reload nginx upon config changes
sudo cp /tmp/incron.dist /etc/incron.d/piku
sudo systemctl restart incron
sudo systemctl restart nginx
sudo cp /tmp/uwsgi-piku.service /etc/systemd/system/
# refer to our executable using a link, in case there are more versions installed
sudo ln -s `which uwsgi` /usr/local/bin/uwsgi-piku
# disable the standard uwsgi startup script
sudo systemctl disable uwsgi
sudo systemctl enable uwsgi-piku
sudo su - piku
mkdir ~/.ssh
chmod 700 ~/.ssh
# now copy the piku script to this user account
cp /tmp/piku.py ~/piku.py
python piku.py setup
# Now import your SSH key using setup:ssh
sudo systemctl start uwsgi-piku
```

Wyświetl plik

@ -12,8 +12,8 @@ Before installing `piku`, you need to install the following packages:
# this also installs python3-click as a dependency
sudo apt-get install -y build-essential certbot git incron \
libjpeg-dev libxml2-dev libxslt1-dev zlib1g-dev nginx \
python-certbot-nginx python-dev python-pip \
python-virtualenv python3-dev python3-pip python3-virtualenv \
python-certbot-nginx python-dev python-pip python-virtualenv \
python3-dev python3-pip python3-click python3-virtualenv \
uwsgi uwsgi-plugin-asyncio-python3 uwsgi-plugin-gevent-python \
uwsgi-plugin-python uwsgi-plugin-python3 uwsgi-plugin-tornado-python
```
@ -87,6 +87,9 @@ To detect configuration changes and tell `nginx` to activate new `piku` sites, w
# replace `PAAS_USERNAME` with the username you created.
/home/PAAS_USERNAME/.piku/nginx IN_MODIFY,IN_NO_LOOP /bin/systemctl reload nginx
```
> This file was last updated on June 2018
## Notes
> This file was last updated on July 2018
[uwsgi]: https://github.com/unbit/uwsgi