Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to host a general-purpose express app #68

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions builder/chroot-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ apt-get -o Dpkg::Options::=--force-confdef \
pi-bluetooth \
lsb-release \
gettext \
unzip \
zip \
libav-tools \
gstreamer1.0-tools \
motion \
gpac \
cloud-init


Expand Down Expand Up @@ -205,10 +211,47 @@ lighttpd-enable-mod fastcgi-php
systemctl disable dhcpcd
systemctl disable hciuart

echo "Installing infragram"

# install npm/node:
curl -o node-v9.7.1-linux-armv6l.tar.gz https://nodejs.org/dist/v9.7.1/node-v9.7.1-linux-armv6l.tar.gz
tar -xzf node-v9.7.1-linux-armv6l.tar.gz
sudo cp -r node-v9.7.1-linux-armv6l/* /usr/local/
sudo apt-get install git

cd /var/www/

# install infragram in the web public folder:
echo "Installing infragram"
git clone https://github.com/publiclab/infragram.git
cd infragram
npm install
cd /var/www/

echo "Installing image-sequencer"
# install image-sequencer in the web public folder:
git clone https://github.com/publiclab/image-sequencer.git
cd image-sequencer
npm install
cd /

echo "Booting Express at /script/app.js"
cd script
node app.js &
cd /

echo "Installing rpi-serial-console script"
wget -q https://raw.githubusercontent.com/lurch/rpi-serial-console/master/rpi-serial-console -O usr/local/bin/rpi-serial-console
chmod +x usr/local/bin/rpi-serial-console

echo "Installing RPi Cam Web Interface"
wget -q https://github.com/silvanmelchior/RPi_Cam_Web_Interface/archive/master.zip -O /tmp/rpicam.zip
cd /tmp/
unzip rpicam.zip
cd RPi_Cam_Web_Interface-master
cp /etc/rpicam_config.txt config.txt
bash ./install.sh q

# fix eth0 interface name
ln -s /dev/null /etc/systemd/network/99-default.link

Expand Down
20 changes: 20 additions & 0 deletions builder/files/var/www/script/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var path = require('path');
var express = require('express');

var app = express();

// expose root www at /files
var staticPath = path.join(__dirname, '../');
app.use('/files', express.static(staticPath));

// just this dir
app.use('/', express.static(__dirname));

// here, let's test changing the WiFi network name...
app.get('/test/:param', function (req, res) {
res.send(req.params)
})

app.listen(3000, function() {
console.log('listening');
});