-
Notifications
You must be signed in to change notification settings - Fork 1
software.raspberrypi
- Install raspbian in the raspberry pi
- Download rasbpian os stretch lite
- Use etcher for install raspbian in sd card
pi@raspberrypi:~ $ sudo raspi-config
Select "Interfacing" options and enable:
- I2C
- SSH
Select "Update" for update OS
Save you sd card 😏 use log2ram (1)
pi@raspberrypi:~ $ curl -Lo log2ram.tar.gz https://github.com/azlux/log2ram/archive/master.tar.gz
pi@raspberrypi:~ $ tar xf log2ram.tar.gz
pi@raspberrypi:~ $ cd log2ram-master
pi@raspberrypi:~ $ chmod +x install.sh && sudo ./install.sh
pi@raspberrypi:~ $ cd ..
pi@raspberrypi:~ $ rm -r log2ram-master
pi@raspberrypi:~ $ nano /etc/systemd/system/log2ram.service
Install openbox (2)
pi@raspberrypi:~ $ sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox
pi@raspberrypi:~ $ sudo apt-get install firefox chromium-browser
pi@raspberrypi:~ $ sudo apt install supervisor
pi@raspberrypi:~ $ sudo apt install python3.5
pi@raspberrypi:~ $ sudo apt install rabbitmq-server
pi@raspberrypi:~ $ sudo apt install python3-virtualenv
pi@raspberrypi:~ $ sudo apt install nginx
pi@raspberrypi:~ $ git clone https://github.com/scwall/cocktail_engine.git
pi@raspberrypi:~ $ cd cocktail_engine
pi@raspberrypi:~/cocktail_engine $ pipenv install --ignore-pipfile
(cocktail_engine) pi@raspberrypi:~/cocktail_engine $ exit
Openbox Configuration (2)
pi@raspberrypi:~ $ sudo nano /etc/xdg/openbox/autostart
# Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms
# Start firefox
firefox
.bash_profile Configuration (2)
pi@raspberrypi:~ $ sudo nano .bash_profile
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor`
Add all modules in firefox to the folder firefox_addons, modify kiosk mod and add main page http://127.0.0.1:14050
pi@raspberrypi:~ $ sudo touch /etc/nginx/sites-available/cocktailengine
pi@raspberrypi:~ $ sudo nano /etc/nginx/sites-available/cocktailengine
server {
listen 14050; server_name ~^.*$;
root /home/pi/cocktail_engine/;
location /static {
alias /home/pi/cocktail_engine/static/;
}
location /media/ {
alias /home/pi/cocktail_engine/media/;
}
location / {
satisfy any;
allow 192.168.0.1/24;
allow 192.168.1.1/24;
allow 127.0.0.1;
deny all;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_pass http://127.0.0.1:8000;
}
}
Change the address ip "192.168.0.1" and "192.168.1.1 to your configuration router and the port at your convenience
pi@raspberrypi:~ $ sudo ln -s /etc/nginx/sites-available/cocktailengine /etc/nginx/sites-enabled/cocktailengine
Add user in nginx for external connection (4)
pi@raspberrypi:~ $ sudo sh -c "echo -n 'youname:' >> /etc/nginx/.htpasswd"
indicate your username in 'yourname'
Create pass for user (4)
pi@raspberrypi:~ $ sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
pi@raspberrypi:~ $ sudo touch cocktail-engine.conf
pi@raspberrypi:~ $ sudo nano cocktail-engine.conf
Change "/home/pi/cocktail_engine/venv/bin/celery" and "/home/pi/cocktail_engine/",for show where is located venv, use
pi@raspberrypi:~ $ cd cocktail_engine
pi@raspberrypi:~/cocktail_engine $ pipenv shell
(cocktail_engine) pi@raspberrypi:~/cocktail_engine $ pipenv --venv
(cocktail_engine) pi@raspberrypi:~/cocktail_engine $ exit
[program:cocktail-engine-celery]
command=/home/pi/cocktail_engine/venv/bin/celery -A cocktail_engine worker --loglevel=INFO
directory=/home/pi/cocktail_engine/
user=pi
numprocs=1
stdout_logfile=/var/log/celery-cocktail-engine.log
stderr_logfile=/var/log/celery-cocktail-engine.log
autostart=true
autorestart=true
startsecs=10
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600
stopasgroup=true
; Set Celery priority higher than default (999)
; so, if rabbitmq is supervised, it will start first.
priority=1000
[program:cocktail-engine-gunicorn]
command = /home/pi/cocktail_engine/venv/bin/gunicorn cocktail_engine.wsgi:application
user = pi
directory = /home/pi/cocktail_engine
autostart = true
autorestart = true
environment = ENV="PRODUCTION",SECRET_KEY="~CK$8u_\x0bo+S8O\x0b8[dCh*P@FF"
Change the secret key with the random key (https://www.miniwebtool.com/django-secret-key-generator/)
pi@raspberrypi:~/cocktail_engine $ pipenv shell
(venv) pi@raspberrypi:~/cocktail_engine $ ./manage.py migrate
(venv) pi@raspberrypi:~/cocktail_engine $ ./manage.py makemigrations engine
(venv) pi@raspberrypi:~/cocktail_engine $ ./manage.py migrate
(venv) pi@raspberrypi:~/cocktail_engine $ ./manage.py loaddata engine/solenoidvalve.json
(venv) pi@raspberrypi:~/cocktail_engine $ ./manage.py collectstatic
(venv) pi@raspberrypi:~/cocktail_engine $ sudo reboot
If everything has been respected the project should be displayed on the touch screen
- 1. Die-antwort: kiosk mode
- 2. Github : log2ram
- 3. Openclassrooms: deploy an application with django, use the server http nginx
- 4. Digital ocean : How To Set Up Password Authentication with Nginx on Ubuntu 14.04
- 5. Simple is better than complex : How to Use Celery and RabbitMQ with Django
- 6. Openclassrooms : deploy an application with django, Configure Gunicorn and Supervisor
Create for final project course openclassrooms