Skip to content

Commit

Permalink
install git; remove pioreactorui.log references; new config; new scri…
Browse files Browse the repository at this point in the history
…pt to publish pioreactor.local on all interfaces
  • Loading branch information
CamDavidsonPilon committed Aug 16, 2024
1 parent 9c18a0f commit 805188f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 26 deletions.
9 changes: 1 addition & 8 deletions workspace/scripts/07-install-logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@ install_cleanup_trap
sudo touch /var/log/pioreactor.log
sudo chown pioreactor:pioreactor /var/log/pioreactor.log
# give free conditions so anyone can write to it if needed, ie. www-data
sudo chmod 660 /var/log/pioreactor.log

# create pioreactorui logs
sudo touch /var/log/pioreactorui.log
sudo chown www-data:www-data /var/log/pioreactorui.log
# give free conditions so anyone can write to it if needed, ie. pioreactor
sudo chmod 660 /var/log/pioreactorui.log
sudo chmod 666 /var/log/pioreactor.log

# add a logrotate entry
sudo cp /files/system/logrotate/pioreactor /etc/logrotate.d/pioreactor
sudo cp /files/system/logrotate/pioreactorui /etc/logrotate.d/pioreactorui

27 changes: 21 additions & 6 deletions workspace/scripts/files/bash/avahi_aliases.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
#!/bin/bash

# Retrieve the domain alias from the configuration file
DOMAIN_ALIAS=$(crudini --get /home/pioreactor/.pioreactor/config.ini ui domain_alias)
IP=$(hostname -I | awk '{print $1}')

while [ "$IP" == "127.0.0.1" ]
do
# Function to publish mDNS for each IP
publish_mdns() {
local ip=$1
echo "Publishing mDNS for $DOMAIN_ALIAS at IP $ip"
/usr/bin/avahi-publish -a -R "$DOMAIN_ALIAS" "$ip" || true &
}

# Get all IP addresses, ignoring localhost
while :; do
IP_ADDRESSES=$(hostname -I | tr ' ' '\n' | grep -v '^127\.')

if [ -n "$IP_ADDRESSES" ]; then
break
fi

echo "Waiting for a valid network interface..."
sleep 2
IP=$(hostname -I | awk '{print $1}')
done


/usr/bin/avahi-publish -a -R "$DOMAIN_ALIAS" "$IP" || true &
# Iterate over each IP and publish mDNS
for IP in $IP_ADDRESSES; do
publish_mdns "$IP"
done
4 changes: 2 additions & 2 deletions workspace/scripts/files/bash/install_pioreactor_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ if [ "$am_i_leader" = true ]; then
rsync -a "$install_folder/ui/contrib/" /var/www/pioreactorui/contrib/
fi

# broadcast to cluster
pios sync-configs --shared
# broadcast to cluster, don't crap out if we can't sync to a worker.
pios sync-configs --shared || :
fi

# run a post install scripts.
Expand Down
5 changes: 4 additions & 1 deletion workspace/scripts/files/config.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ use_calibration=1
# apply a smoothing penalizer
smoothing_penalizer=700.0

# turn off the other LED channels during an OD reading snapshot.
turn_off_leds_during_reading=1

[od_config.photodiode_channel]
# Default IR photodiode channel(s) to use and its angle relative to the IR LED(s),
# OR choose the reference photodiode using the keyword REF.
Expand All @@ -71,8 +74,8 @@ number_of_backup_replicates_to_workers=2

[logging]
# where, on each Rpi, to store the logs
# note that UI logs go to /var/log/pioreactorui.log
log_file=/var/log/pioreactor.log
ui_log_file=/var/log/pioreactor.log

# See Python's logging module for possible values
# logs also appear in the UI
Expand Down
2 changes: 1 addition & 1 deletion workspace/scripts/files/system/logrotate/pioreactor
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
rotate 10
compress
notifempty
create 0660 pioreactor pioreactor
create 0666 pioreactor pioreactor
}
8 changes: 0 additions & 8 deletions workspace/scripts/files/system/logrotate/pioreactorui

This file was deleted.

13 changes: 13 additions & 0 deletions workspace/scripts/install-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -x
set -e

export LC_ALL=C


source /common.sh
install_cleanup_trap

sudo apt-get install git -y

0 comments on commit 805188f

Please sign in to comment.