forked from OctoPrint/CustoPiZer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path06-install-pioreactor.sh
129 lines (99 loc) · 4.75 KB
/
06-install-pioreactor.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
set -x
set -e
export LC_ALL=C
source /common.sh
install_cleanup_trap
USERNAME=pioreactor
PIO_DIR=/home/$USERNAME/.pioreactor
sudo -u $USERNAME mkdir -p $PIO_DIR
sudo -u $USERNAME mkdir -p $PIO_DIR/storage
sudo -u $USERNAME mkdir -p $PIO_DIR/plugins
sudo -u $USERNAME mkdir -p $PIO_DIR/plugins/ui/contrib/jobs
sudo -u $USERNAME mkdir -p $PIO_DIR/plugins/ui/contrib/automations/{dosing,led,temperature}
sudo -u $USERNAME mkdir -p $PIO_DIR/plugins/ui/contrib/charts
echo "Directory for adding Python code, see docs: https://docs.pioreactor.com/developer-guide/intro-plugins" | sudo -u $USERNAME tee $PIO_DIR/plugins/README.txt > /dev/null
echo "Directory for adding to the UI using yaml files, see docs: https://docs.pioreactor.com/developer-guide/adding-plugins-to-ui" | sudo -u $USERNAME tee $PIO_DIR/plugins/ui/README.txt > /dev/null
sudo -u $USERNAME mkdir -p $PIO_DIR/storage/calibrations/{stirring,od,media_pump,waste_pump,alt_media_pump}
chown -R $USERNAME:www-data $PIO_DIR/storage/calibrations/{stirring,od,media_pump,waste_pump,alt_media_pump}
chmod g+s $PIO_DIR/storage/calibrations/{stirring,od,media_pump,waste_pump,alt_media_pump}
sudo -u $USERNAME mkdir -p $PIO_DIR/experiment_profiles
chown -R $USERNAME:www-data $PIO_DIR/experiment_profiles
chmod g+s $PIO_DIR/experiment_profiles
echo "Directory for adding experiment profiles: https://docs.pioreactor.com/developer-guide/experiment-profiles" | sudo -u $USERNAME tee $PIO_DIR/experiment_profiles/README.txt > /dev/null
cat <<EOT >> $PIO_DIR/experiment_profiles/demo_logging_example.yaml
experiment_profile_name: Demo of logging real-time data
metadata:
author: Cam Davidson-Pilon
description: A profile to demonstrate logging real-time data, start stirring in your Pioreactor(s), update RPM, and log the value.
common:
jobs:
stirring:
actions:
- type: start
hours_elapsed: 0.0
options:
target_rpm: 400.0
- type: log
hours_elapsed: 0.001
options:
message: "\${{job_name()}} starting at target \${{::stirring:target_rpm}} RPM"
- type: log
hours_elapsed: 0.005
options:
message: "Increasing to 800 RPM in \${{unit()}}. Try changing the target RPM in the UI."
- type: update
hours_elapsed: 0.005
options:
target_rpm: 800.0
- type: log
hours_elapsed: 0.019
options:
message: "Value of target_rpm in \${{unit()}} is \${{::stirring:target_rpm}} RPM. Stopping."
- type: stop
hours_elapsed: 0.02
EOT
cat <<EOT >> $PIO_DIR/experiment_profiles/demo_stirring_example.yaml
experiment_profile_name: Demo stirring example
metadata:
author: Cam Davidson-Pilon
description: A simple profile to start stirring in your Pioreactor(s), update RPM at 90 seconds, and turn off after 180 seconds.
common:
jobs:
stirring:
actions:
- type: start
hours_elapsed: 0.0
options:
target_rpm: 400.0
- type: update
hours_elapsed: 0.025
options:
target_rpm: 800.0
- type: stop
hours_elapsed: 0.05
EOT
sudo -u $USERNAME touch $PIO_DIR/unit_config.ini
if [ "$LEADER" == "1" ]; then
sudo apt-get install sshpass
sudo -u $USERNAME cp /files/pioreactor/config.example.ini $PIO_DIR/config.ini
sudo -u $USERNAME mkdir -p $PIO_DIR/exportable_datasets
sudo -u $USERNAME cp /files/pioreactor/exportable_datasets/*.yaml $PIO_DIR/exportable_datasets/
if [ "$PIO_VERSION" == "develop" ]; then
sudo pip3 install "pioreactor[leader_worker] @ https://github.com/pioreactor/pioreactor/archive/develop.zip" --index-url https://piwheels.org/simple --extra-index-url https://pypi.org/simple
else
sudo pip3 install "pioreactor[leader] @ https://github.com/Pioreactor/pioreactor/releases/download/$PIO_VERSION/pioreactor-$PIO_VERSION-py3-none-any.whl" --index-url https://piwheels.org/simple --extra-index-url https://pypi.org/simple
fi
fi
if [ "$WORKER" == "1" ]; then
sudo apt-get install -y python3-numpy
if [ "$PIO_VERSION" == "develop" ]; then
sudo pip3 install "pioreactor[leader_worker] @ https://github.com/pioreactor/pioreactor/archive/develop.zip" --index-url https://piwheels.org/simple --extra-index-url https://pypi.org/simple
else
sudo pip3 install "pioreactor[worker] @ https://github.com/Pioreactor/pioreactor/releases/download/$PIO_VERSION/pioreactor-$PIO_VERSION-py3-none-any.whl" --index-url https://piwheels.org/simple --extra-index-url https://pypi.org/simple
fi
fi
# useful libs
sudo apt-get install -y jq
sudo apt-get install -y rsyslog
sudo apt-get install libwebpmux3 liblcms2-2 libwebpdemux2 libopenjp2-7 -y # used for Pillow