Skip to content

Commit

Permalink
Additional changes for successful move of install directory to /opt
Browse files Browse the repository at this point in the history
  • Loading branch information
kizniche committed Jan 15, 2024
1 parent f5846d4 commit 349a51e
Show file tree
Hide file tree
Showing 29 changed files with 151 additions and 93 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

This release updates several python packages that require Python >= 3.8. You can check your Python version prior to upgrading. If you do not have the required version, you should not upgrade, since this will likely break your system. To be able to use this and future Mycodo releases, ensure you are running an updated operating system that supports a modern Python version.

This release also changes the Desktop grid width from 20 to 24, enabling the use of 3 column layouts that are evenly-spaced. You will need to resize/rearrange Dashboard Widgets after this update to correct for the new width. The update of Gridstack to 10.0.1 also now allows the ability to drag Desktop widgets on mobile devices. If you don't like this behavior, you should lock the desktop from the Dashboard Configuration menu to prevent widgets from being dragged/rearranged.
This release changes the Desktop grid width from 20 to 24, enabling the use of 3 column layouts that are evenly-spaced. You will need to resize/rearrange Dashboard Widgets after this update to correct for the new width. The update of Gridstack to 10.0.1 also now allows the ability to drag Desktop widgets on mobile devices. If you don't like this behavior, you should lock the desktop from the Dashboard Configuration menu to prevent widgets from being dragged/rearranged.

This release changes the install directory from ~/Mycodo to /opt/Mycodo. This should occur automatically during the upgrade.

### Bugfixes

Expand All @@ -15,7 +17,7 @@ This release also changes the Desktop grid width from 20 to 24, enabling the use

### Miscellaneous

- Move install location to /opt/Mycodo
- Move install location from ~/Mycodo to /opt/Mycodo
- Change Dashboard grid width from 20 to 24
- Add endpoint option to RAM Input for when Mycodo is using a non-standard IP/port
- Update Gridstack to 10.0.1
Expand Down
31 changes: 31 additions & 0 deletions alembic_db/alembic/versions/4c77262f15ea_delete_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""delete env
Revision ID: 4c77262f15ea
Revises: 16b28ef31b5b
Create Date: 2024-01-14 19:18:37.767591
"""
import sys
import os

sys.path.append(os.path.abspath(os.path.join(__file__, "../../../..")))

from alembic_db.alembic_post_utils import write_revision_post_alembic

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4c77262f15ea'
down_revision = '16b28ef31b5b'
branch_labels = None
depends_on = None


def upgrade():
write_revision_post_alembic(revision)


def downgrade():
pass
14 changes: 14 additions & 0 deletions alembic_db/alembic_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ def upgrade_revision(error, revision):
# elif revision == 'REPLACE_WITH_ALEMBIC_REVISION_ID':
# pass # Code goes here

elif revision == '4c77262f15ea':
# Move Mycodo install directory
# This breaks the virtualenv, so it needs to be regenerated
import os
import shutil

from mycodo.config import INSTALL_DIRECTORY

try:
print("Deleting virtualenv...")
shutil.rmtree(os.path.join(INSTALL_DIRECTORY, 'env'))
except Exception as err:
print(f"Error removing env: {err}")

elif revision == 'b354722c9b8b':
import json
import os
Expand Down
6 changes: 3 additions & 3 deletions install/mycodo.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ StartLimitBurst=5
Restart=on-failure
RestartSec=20s
TimeoutSec=0
ExecStart=/var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/mycodo_daemon.py
ExecStop=/var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/mycodo_client.py -t
ExecReload=/var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/mycodo_client.py -t && /var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/mycodo_daemon.py
ExecStart=/opt/Mycodo/env/bin/python /opt/Mycodo/mycodo/mycodo_daemon.py
ExecStop=/opt/Mycodo/env/bin/python /opt/Mycodo/mycodo/mycodo_client.py -t
ExecReload=/opt/Mycodo/env/bin/python /opt/Mycodo/mycodo/mycodo_client.py -t && /opt/Mycodo/env/bin/python /opt/Mycodo/mycodo/mycodo_daemon.py

[Install]
WantedBy=multi-user.target
Expand Down
4 changes: 2 additions & 2 deletions install/mycodoflask.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ After=network.target
[Service]
User=root
Group=mycodo
WorkingDirectory=/var/mycodo-root/mycodo
ExecStart=/var/mycodo-root/env/bin/python -m gunicorn \
WorkingDirectory=/opt/Mycodo/mycodo
ExecStart=/opt/Mycodo/env/bin/python -m gunicorn \
--workers 1 \
--worker-class gthread \
--threads 2 \
Expand Down
6 changes: 3 additions & 3 deletions install/mycodoflask_nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ server {

client_max_body_size 30M;

ssl_certificate /var/mycodo-root/mycodo/mycodo_flask/ssl_certs/server.crt;
ssl_certificate_key /var/mycodo-root/mycodo/mycodo_flask/ssl_certs/server.key;
ssl_certificate /opt/Mycodo/mycodo/mycodo_flask/ssl_certs/server.crt;
ssl_certificate_key /opt/Mycodo/mycodo/mycodo_flask/ssl_certs/server.key;

location / {
include proxy_params;
Expand All @@ -20,6 +20,6 @@ server {

error_page 502 /502.html;
location = /502.html {
root /var/mycodo-root/mycodo/mycodo_flask/templates;
root /opt/Mycodo/mycodo/mycodo_flask/templates;
}
}
2 changes: 1 addition & 1 deletion mycodo/actions/input_action_execute_python_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def generate_code(input_id, python_code):
error = []
pre_statement_run = """import os
import sys
sys.path.append(os.path.abspath('/var/mycodo-root'))
sys.path.append(os.path.abspath('/opt/Mycodo'))
from mycodo.databases.models import Conversion
from mycodo.mycodo_client import DaemonControl
from mycodo.utils.database import db_retrieve_table_daemon
Expand Down
34 changes: 17 additions & 17 deletions mycodo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from config_translations import TRANSLATIONS as T

MYCODO_VERSION = '8.15.13'
ALEMBIC_VERSION = 'c7942284b74e'
ALEMBIC_VERSION = '4c77262f15ea'

# FORCE UPGRADE MASTER
# Set True to enable upgrading to the master branch of the Mycodo repository.
Expand Down Expand Up @@ -224,12 +224,12 @@

METHOD_DEP_BASE = [
('bash-commands',
['/var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highcharts-9.1.2.js'],
['/opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highcharts-9.1.2.js'],
[
'wget --no-clobber https://code.highcharts.com/zips/Highcharts-9.1.2.zip',
'unzip Highcharts-9.1.2.zip -d Highcharts-9.1.2',
'cp -rf Highcharts-9.1.2/code/highcharts.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highcharts-9.1.2.js',
'cp -rf Highcharts-9.1.2/code/highcharts.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highcharts.js.map',
'cp -rf Highcharts-9.1.2/code/highcharts.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highcharts-9.1.2.js',
'cp -rf Highcharts-9.1.2/code/highcharts.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highcharts.js.map',
'rm -rf Highcharts-9.1.2'
])
]
Expand Down Expand Up @@ -339,23 +339,23 @@
'dependencies_module': [
('bash-commands',
[
'/var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highstock-9.1.2.js',
'/var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highcharts-more-9.1.2.js',
'/var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/data-9.1.2.js',
'/var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/exporting-9.1.2.js',
'/var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/export-data-9.1.2.js',
'/var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/offline-exporting-9.1.2.js'
'/opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highstock-9.1.2.js',
'/opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highcharts-more-9.1.2.js',
'/opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/data-9.1.2.js',
'/opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/exporting-9.1.2.js',
'/opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/export-data-9.1.2.js',
'/opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/offline-exporting-9.1.2.js'
],
[
'wget --no-clobber https://code.highcharts.com/zips/Highcharts-Stock-9.1.2.zip',
'unzip Highcharts-Stock-9.1.2.zip -d Highcharts-Stock-9.1.2',
'cp -rf Highcharts-Stock-9.1.2/code/highstock.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highstock-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/highstock.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highstock.js.map',
'cp -rf Highcharts-Stock-9.1.2/code/highcharts-more.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highcharts-more-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/highcharts-more.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/highcharts-more.js.map',
'cp -rf Highcharts-Stock-9.1.2/code/modules/data.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/data-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/modules/data.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/data.js.map',
'cp -rf Highcharts-Stock-9.1.2/code/modules/exporting.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/exporting-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/highstock.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highstock-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/highstock.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highstock.js.map',
'cp -rf Highcharts-Stock-9.1.2/code/highcharts-more.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highcharts-more-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/highcharts-more.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/highcharts-more.js.map',
'cp -rf Highcharts-Stock-9.1.2/code/modules/data.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/data-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/modules/data.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/data.js.map',
'cp -rf Highcharts-Stock-9.1.2/code/modules/exporting.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/exporting-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/modules/exporting.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/exporting.js.map',
'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/export-data-9.1.2.js',
'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/export-data.js.map',
Expand Down
8 changes: 4 additions & 4 deletions mycodo/inputs/python_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def generate_code(new_input):
error = []
pre_statement_run = """import os
import sys
sys.path.append(os.path.abspath('/var/mycodo-root'))
sys.path.append(os.path.abspath('/opt/Mycodo'))
from mycodo.databases.models import Conversion
from mycodo.mycodo_client import DaemonControl
from mycodo.utils.actions import run_input_actions
Expand Down Expand Up @@ -148,9 +148,9 @@ def execute_at_modification(
ln=line_num,
line=each_line)

cmd_test = 'mkdir -p /var/mycodo-root/.pylint.d && ' \
'export PYTHONPATH=$PYTHONPATH:/var/mycodo-root && ' \
'export PYLINTHOME=/var/mycodo-root/.pylint.d && ' \
cmd_test = 'mkdir -p /opt/Mycodo/.pylint.d && ' \
'export PYTHONPATH=$PYTHONPATH:/opt/Mycodo && ' \
'export PYLINTHOME=/opt/Mycodo/.pylint.d && ' \
'{dir}/env/bin/python -m pylint -d I,W0621,C0103,C0111,C0301,C0327,C0410,C0413 {path}'.format(
dir=INSTALL_DIRECTORY, path=file_run)
cmd_out, cmd_error, cmd_status = cmd_output(cmd_test, user='root')
Expand Down
8 changes: 4 additions & 4 deletions mycodo/inputs/python_code_v_2_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def generate_code(input_id, python_code):
error = []
pre_statement_run = """import os
import sys
sys.path.append(os.path.abspath('/var/mycodo-root'))
sys.path.append(os.path.abspath('/opt/Mycodo'))
from mycodo.mycodo_client import DaemonControl
control = DaemonControl()
Expand Down Expand Up @@ -123,9 +123,9 @@ def execute_at_modification(
ln=line_num,
line=each_line)

cmd_test = 'mkdir -p /var/mycodo-root/.pylint.d && ' \
'export PYTHONPATH=$PYTHONPATH:/var/mycodo-root && ' \
'export PYLINTHOME=/var/mycodo-root/.pylint.d && ' \
cmd_test = 'mkdir -p /opt/Mycodo/.pylint.d && ' \
'export PYTHONPATH=$PYTHONPATH:/opt/Mycodo && ' \
'export PYLINTHOME=/opt/Mycodo/.pylint.d && ' \
'{dir}/env/bin/python -m pylint -d I,W0621,C0103,C0111,C0301,C0327,C0410,C0413 {path}'.format(
dir=INSTALL_DIRECTORY, path=file_run)
cmd_out, cmd_error, cmd_status = cmd_output(cmd_test, user='root')
Expand Down
4 changes: 2 additions & 2 deletions mycodo/inputs/ruuvitag.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def get_measurement(self):
if lf.lock_acquire(self.lock_file, timeout=3600):
self.logger.debug("Starting measurement")
try:
cmd = 'timeout -k 11 10 /var/mycodo-root/env/bin/python ' \
'/var/mycodo-root/mycodo/inputs/scripts/ruuvitag_values.py ' \
cmd = 'timeout -k 11 10 /opt/Mycodo/env/bin/python ' \
'/opt/Mycodo/mycodo/inputs/scripts/ruuvitag_values.py ' \
'--mac_address {mac} --bt_adapter {bta}'.format(
mac=self.location, bta=self.bt_adapter)
cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
Expand Down
4 changes: 2 additions & 2 deletions mycodo/inputs/sense_hat.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@
('apt', 'git', 'git'),
('bash-commands',
[
'/var/mycodo-root/env/RTIMULib_installed',
'/opt/Mycodo/env/RTIMULib_installed',
],
[
'cd /tmp',
'git clone https://github.com/RPi-Distro/RTIMULib',
'cd ./RTIMULib/Linux/python/',
'/opt/Mycodo/env/bin/python setup.py build',
'/opt/Mycodo/env/bin/python setup.py install',
'touch /var/mycodo-root/env/RTIMULib_installed'
'touch /opt/Mycodo/env/RTIMULib_installed'
]),
('pip-pypi', 'sense_hat', 'sense-hat==2.2.0')
],
Expand Down
2 changes: 1 addition & 1 deletion mycodo/mycodo_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/var/mycodo-root/env/bin/python
#!/opt/Mycodo/env/bin/python
# -*- coding: utf-8 -*-
#
# mycodo_client.py - Client to communicate with the Mycodo daemon.
Expand Down
2 changes: 1 addition & 1 deletion mycodo/mycodo_daemon.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/var/mycodo-root/env/bin/python
#!/opt/Mycodo/env/bin/python
# -*- coding: utf-8 -*-
#
# mycodo_daemon.py - Daemon for managing Mycodo controllers, such as sensors,
Expand Down
2 changes: 1 addition & 1 deletion mycodo/mycodo_flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def extension_session(app):
# try:
# # Remove flask_session directory every time flask starts
# import shutil
# shutil.rmtree('/var/mycodo-root/mycodo/flask_session')
# shutil.rmtree('/opt/Mycodo/mycodo/flask_session')
# except:
# pass

Expand Down
2 changes: 1 addition & 1 deletion mycodo/mycodo_flask/routes_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def newremote():
if User().check_password(
pass_word, user.password_hash) == user.password_hash:
try:
with open('/var/mycodo-root/mycodo/mycodo_flask/ssl_certs/cert.pem', 'r') as cert:
with open('/opt/Mycodo/mycodo/mycodo_flask/ssl_certs/cert.pem', 'r') as cert:
certificate_data = cert.read()
except Exception:
certificate_data = None
Expand Down
2 changes: 1 addition & 1 deletion mycodo/mycodo_flask/utils/utils_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ def settings_diagnostic_delete_settings_database():

if not error:
try:
os.remove('/var/mycodo-root/databases/mycodo.db')
os.remove('/opt/Mycodo/databases/mycodo.db')
cmd = "{pth}/mycodo/scripts/mycodo_wrapper frontend_reload" \
" | ts '[%Y-%m-%d %H:%M:%S]'" \
" >> {log} 2>&1".format(pth=INSTALL_DIRECTORY,
Expand Down
8 changes: 4 additions & 4 deletions mycodo/outputs/on_off_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
def generate_code(code_on, code_off, unique_id):
pre_statement_run = f"""import os
import sys
sys.path.append(os.path.abspath('/var/mycodo-root'))
sys.path.append(os.path.abspath('/opt/Mycodo'))
from mycodo.mycodo_client import DaemonControl
control = DaemonControl()
output_id = '{unique_id}'
Expand Down Expand Up @@ -117,9 +117,9 @@ def execute_at_modification(
ln=line_num,
line=each_line)

cmd_test = 'mkdir -p /var/mycodo-root/.pylint.d && ' \
'export PYTHONPATH=$PYTHONPATH:/var/mycodo-root && ' \
'export PYLINTHOME=/var/mycodo-root/.pylint.d && ' \
cmd_test = 'mkdir -p /opt/Mycodo/.pylint.d && ' \
'export PYTHONPATH=$PYTHONPATH:/opt/Mycodo && ' \
'export PYLINTHOME=/opt/Mycodo/.pylint.d && ' \
'{dir}/env/bin/python -m pylint -d I,W0621,C0103,C0111,C0301,C0327,C0410,C0413 {path}'.format(
dir=INSTALL_DIRECTORY, path=file_run)
cmd_out, cmd_error, cmd_status = cmd_output(cmd_test, user='root')
Expand Down
8 changes: 4 additions & 4 deletions mycodo/outputs/pwm_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
def generate_code(code_pwm, unique_id):
pre_statement_run = f"""import os
import sys
sys.path.append(os.path.abspath('/var/mycodo-root'))
sys.path.append(os.path.abspath('/opt/Mycodo'))
from mycodo.mycodo_client import DaemonControl
control = DaemonControl()
output_id = '{unique_id}'
Expand Down Expand Up @@ -116,9 +116,9 @@ def execute_at_modification(
ln=line_num,
line=each_line)

cmd_test = 'mkdir -p /var/mycodo-root/.pylint.d && ' \
'export PYTHONPATH=$PYTHONPATH:/var/mycodo-root && ' \
'export PYLINTHOME=/var/mycodo-root/.pylint.d && ' \
cmd_test = 'mkdir -p /opt/Mycodo/.pylint.d && ' \
'export PYTHONPATH=$PYTHONPATH:/opt/Mycodo && ' \
'export PYLINTHOME=/opt/Mycodo/.pylint.d && ' \
'{dir}/env/bin/python -m pylint -d I,W0621,C0103,C0111,C0301,C0327,C0410,C0413 {path}'.format(
dir=INSTALL_DIRECTORY, path=file_run)
cmd_out, cmd_error, cmd_status = cmd_output(cmd_test, user='root')
Expand Down
2 changes: 1 addition & 1 deletion mycodo/scripts/mycodo_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
sprintf(cmd, "service mycodo stop");
system(cmd);
} else if (strcmp(argv[1], "delete_upload_dir") == 0) {
sprintf(cmd, "rm -rf /var/mycodo-root/upload");
sprintf(cmd, "rm -rf /opt/Mycodo/upload");
system(cmd);
} else if (strcmp(argv[1], "frontend_reload") == 0) {
sprintf(cmd, "service mycodoflask reload");
Expand Down
2 changes: 1 addition & 1 deletion mycodo/scripts/upgrade_commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ case "${1:-''}" in
chown -LR mycodo:mycodo "${MYCODO_PATH}"
chown -R mycodo:mycodo /var/log/mycodo
chown -R mycodo:mycodo /var/Mycodo-backups
chown -R mycodo:mycodo /var/mycodo-root
chown -R mycodo:mycodo /opt/Mycodo

find "${MYCODO_PATH}" -type d -exec chmod u+wx,g+wx {} +
find "${MYCODO_PATH}" -type f -exec chmod u+w,g+w,o+r {} +
Expand Down
2 changes: 2 additions & 0 deletions mycodo/scripts/upgrade_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ runSelfUpgrade() {
fi
printf "Done.\n"

mkdir -p /opt

printf "Moving downloaded Mycodo version from %s to /opt/Mycodo..." "${THIS_MYCODO_DIRECTORY}"
if ! mv "${THIS_MYCODO_DIRECTORY}" /opt/Mycodo ; then
printf "Failed: Error while trying to move new Mycodo install from %s to /opt/Mycodo.\n" "${THIS_MYCODO_DIRECTORY}"
Expand Down
9 changes: 9 additions & 0 deletions mycodo/scripts/upgrade_post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ elif [ "$INFLUXDB_INSTALLED" == "true" ] && [[ ${INFLUXDB_VERSION} == 2* ]]; the
TIMER_TOTAL_update_influxdb=$((SECONDS - TIMER_START_update_influxdb))
fi

# If virtualenv was deleted by alembic upgrade script, regenerate virtualenv
TIMER_START_update_pip3=$SECONDS
${INSTALL_CMD} update-pip3
TIMER_TOTAL_update_pip3=$((SECONDS - TIMER_START_update_pip3))

TIMER_START_update_pip3_packages=$SECONDS
${INSTALL_CMD} update-pip3-packages
TIMER_TOTAL_update_pip3_packages=$((SECONDS - TIMER_START_update_pip3_packages))

TIMER_START_update_dependencies=$SECONDS
${INSTALL_CMD} update-dependencies
TIMER_TOTAL_update_dependencies=$((SECONDS - TIMER_START_update_dependencies))
Expand Down
Loading

0 comments on commit 349a51e

Please sign in to comment.