Last active
December 22, 2018 18:05
-
-
Save jaredkipe/ffc78108f43b09fad4c507591fb4e30c to your computer and use it in GitHub Desktop.
ShipBox provision -- WIP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# or run the script as root. | |
sudo -s | |
mount -o remount,rw / && mount -o remount,rw /root_bypass_ramdisks/ \ | |
&& mount --bind /root_bypass_ramdisks/etc /etc \ | |
&& mount --bind /root_bypass_ramdisks/var /var | |
# Installs. | |
apt-get update && apt-get install -y cups nginx | |
# CUPS | |
sed -i 's/Order deny,allow/Order allow,deny/' /etc/cups/cupsd.conf | |
sed -i 's/Listen localhost:631/Port 631/' /etc/cups/cupsd.conf | |
sed -i $'s_</Location>_ Allow all\\\n</Location>_' /etc/cups/cupsd.conf | |
usermod -a -G lpadmin pi | |
# Nginx | |
sed -i 's/worker_processes 4;/worker_processes 1;/' /etc/nginx/nginx.conf | |
sed -i 's/access_log .*;/access_log off;/' /etc/nginx/nginx.conf | |
mkdir /etc/nginx/ssl | |
cat > /etc/nginx/ssl/server.crt << EndOfMessage | |
# | |
EndOfMessage | |
cat > /etc/nginx/ssl/server.key << EndOfMessage | |
# | |
EndOfMessage | |
cat > /etc/nginx/sites-enabled/default << EndOfMessage | |
upstream odoo { | |
server 127.0.0.1:8069; | |
} | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
# SSL configuration | |
# | |
listen 443 ssl default_server; | |
listen [::]:443 ssl default_server; | |
# | |
# Self signed certs generated by the ssl-cert package | |
# Don't use them in a production server! | |
# | |
include snippets/snakeoil.conf; | |
# | |
# Or place your certs in the following locations, and uncomment. | |
# | |
# ssl_certificate /etc/nginx/ssl/server.crt; | |
# ssl_certificate_key /etc/nginx/ssl/server.key; | |
root /var/www/html; | |
# Add index.php to the list if you are using PHP | |
index index.html index.htm index.nginx-debian.html; | |
server_name _; | |
include proxy_params; | |
location / { | |
proxy_pass http://odoo; | |
} | |
location /web/static/ { | |
proxy_cache_valid 100 60m; | |
proxy_buffering on; | |
expires 86400; | |
proxy_pass http://odoo; | |
} | |
} | |
EndOfMessage | |
# GIT | |
cd /home/pi | |
git clone https://github.com/hibou-io/shipbox.git -b master ./shipbox | |
cd /home/pi/odoo/addons/ | |
find ../../shipbox/ -name 'hw_*' -type d -exec ln -s {} . \; | |
# Odoo configuration. | |
# Currently if no USB scale is found, it can mess up the status page. | |
# sed -i 's/,hw_scale,/,hw_scale_usb,hw_cups,/' /etc/init.d/odoo | |
sed -i 's/,hw_scale,/,hw_scale,hw_cups,/' /etc/init.d/odoo | |
rm -rf /var/cache/* | |
sync && sleep 10 && reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment