Skip to content

Commit

Permalink
these on multilines would create sections without any newlines...
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Aug 21, 2024
1 parent 805188f commit 1f71af7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions workspace/scripts/files/bash/firstboot_leader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ sudo -u $USERNAME ssh-keygen -q -t rsa -N '' -f $SSH_DIR/id_rsa
sudo -u $USERNAME cat $SSH_DIR/id_rsa.pub > $SSH_DIR/authorized_keys
sudo -u $USERNAME ssh-keyscan "$(hostname)".local >> $SSH_DIR/known_hosts

crudini --set --ini-options=nospace $PIO_DIR/config.ini cluster.topology leader_hostname "$(hostname)" /
$PIO_DIR/config.ini cluster.topology leader_address "$(hostname)".local /
$PIO_DIR/config.ini mqtt broker_address "$(hostname)".local
crudini --ini-options=nospace --set $PIO_DIR/config.ini cluster.topology leader_hostname "$(hostname)"
crudini --ini-options=nospace --set $PIO_DIR/config.ini cluster.topology leader_address "$(hostname)".local
crudini --ini-options=nospace --set $PIO_DIR/config.ini mqtt broker_address "$(hostname)".local

sqlite3 $DB_LOC "INSERT OR IGNORE INTO experiments (created_at, experiment, description) VALUES (STRFTIME('%Y-%m-%dT%H:%M:%f000Z', 'NOW'), 'Demo experiment', 'This is a demo experiment. Feel free to click around. When you are ready, create a new experiment in the dropdown to the left.');"

Expand All @@ -31,7 +31,7 @@ sqlite3 $DB_LOC "INSERT OR IGNORE INTO experiments (created_at, experiment, desc
sudo -u $USERNAME touch "$PIO_DIR/config_$HOSTNAME.ini" # set with the correct read/write permissions
printf '# Any settings here are specific to %s, the leader, and override the settings in config.ini\n\n' "$HOSTNAME" >> "$PIO_DIR/config_$HOSTNAME.ini"

crudini --ini-options=nospace --set "$PIO_DIR/config_$HOSTNAME.ini" cluster.topology leader_address 127.0.0.1 \
--set "$PIO_DIR/config_$HOSTNAME.ini" mqtt broker_address 127.0.0.1
crudini --ini-options=nospace --set "$PIO_DIR/config_$HOSTNAME.ini" cluster.topology leader_address 127.0.0.1
crudini --ini-options=nospace --set "$PIO_DIR/config_$HOSTNAME.ini" mqtt broker_address 127.0.0.1

cp "$PIO_DIR/config_$HOSTNAME.ini" "$PIO_DIR/unit_config.ini"
14 changes: 7 additions & 7 deletions workspace/scripts/files/bash/firstboot_leader_and_worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ sudo -u $USERNAME ssh-keygen -q -t rsa -N '' -f $SSH_DIR/id_rsa
sudo -u $USERNAME cat $SSH_DIR/id_rsa.pub > $SSH_DIR/authorized_keys
sudo -u $USERNAME ssh-keyscan "$HOSTNAME".local >> $SSH_DIR/known_hosts

crudini --ini-options=nospace --set $PIO_DIR/config.ini cluster.topology leader_hostname "$HOSTNAME" \
--set $PIO_DIR/config.ini cluster.topology leader_address "$HOSTNAME".local \
--set $PIO_DIR/config.ini mqtt broker_address "$HOSTNAME".local
crudini --ini-options=nospace --set $PIO_DIR/config.ini cluster.topology leader_hostname "$HOSTNAME"
crudini --ini-options=nospace --set $PIO_DIR/config.ini cluster.topology leader_address "$HOSTNAME".local
crudini --ini-options=nospace --set $PIO_DIR/config.ini mqtt broker_address "$HOSTNAME".local

sqlite3 "$DB_LOC" "INSERT OR IGNORE INTO experiments (created_at, experiment, description) VALUES (STRFTIME('%Y-%m-%dT%H:%M:%f000Z', 'NOW'), 'Demo experiment', 'This is a demo experiment. Feel free to click around. When you are ready, create a new experiment in the dropdown to the left.');"
sqlite3 "$DB_LOC" "INSERT OR IGNORE INTO workers (pioreactor_unit, added_at, is_active) VALUES ('$HOSTNAME', STRFTIME('%Y-%m-%dT%H:%M:%f000Z', 'NOW'), 1);"
Expand All @@ -33,9 +33,9 @@ sqlite3 "$DB_LOC" "INSERT OR IGNORE INTO experiment_worker_assignments (pioreact
sudo -u $USERNAME touch $PIO_DIR/config_"$HOSTNAME".ini # set with the correct read/write permissions
printf '# Any settings here are specific to %s, the leader, and override the settings in config.ini\n\n' "$HOSTNAME" >> $PIO_DIR/config_"$HOSTNAME".ini

crudini --ini-options=nospace --set $PIO_DIR/config_"$HOSTNAME".ini cluster.topology leader_address 127.0.0.1 \
--set $PIO_DIR/config_"$HOSTNAME".ini mqtt broker_address 127.0.0.1 \
--set $PIO_DIR/config_"$HOSTNAME".ini pioreactor model pioreactor_20ml \
--set $PIO_DIR/config_"$HOSTNAME".ini pioreactor version 1.1
crudini --ini-options=nospace --set $PIO_DIR/config_"$HOSTNAME".ini cluster.topology leader_address 127.0.0.1
crudini --ini-options=nospace --set $PIO_DIR/config_"$HOSTNAME".ini mqtt broker_address 127.0.0.1
crudini --ini-options=nospace --set $PIO_DIR/config_"$HOSTNAME".ini pioreactor model pioreactor_20ml
crudini --ini-options=nospace --set $PIO_DIR/config_"$HOSTNAME".ini pioreactor version 1.1

cp "$PIO_DIR/config_$HOSTNAME.ini" "$PIO_DIR/unit_config.ini"

0 comments on commit 1f71af7

Please sign in to comment.