question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade script fails with invalid SemVer string

See original GitHub issue

Issue Summary

Inside the docker image redash/redash:1.0.0.b2588, I downloaded the upgrade script as explained on https://redash.io/help-onpremise/maintenance/how-to-upgrade-redash.html. When running the script with the REDASH_DATABASE_URL pointing to a database on 0.12, I got:

Starting Redash upgrade:
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Found version: 0.12.0
Traceback (most recent call last):
  File "./upgrade", line 237, in <module>
    deploy_release(args.channel)
  File "./upgrade", line 217, in deploy_release
    verify_newer_version(release)
  File "./upgrade", line 203, in verify_newer_version
    if not release.is_newer(current_version()):
  File "./upgrade", line 69, in is_newer
    return semver.compare(self.version, version) > 0
  File "/usr/local/lib/python2.7/dist-packages/semver.py", line 54, in compare
    v1, v2 = parse(ver1), parse(ver2)
  File "/usr/local/lib/python2.7/dist-packages/semver.py", line 21, in parse
    raise ValueError('%s is not valid SemVer string' % version)
ValueError: current is not valid SemVer string

On the upgrade script, the CURRENT_VERSION_PATH is defined as ${REDASH_HOME}/current. Then, on the same script, you have the current_version() method defined as:

# https://github.com/getredash/redash/blob/01a8075a6796653f046901a6d302caec17affdb1/bin/upgrade#L179-L181
def current_version():
    real_current_path = os.path.realpath(CURRENT_VERSION_PATH).replace('.b', '+b')
    # real_current_path == '/opt/redash/current'
    return real_current_path.replace(REDASH_HOME + '/', '').replace('redash.', '')
    # the returned value is 'current'

The problem is that current isn’t a valid SemVer version, so as far as I can see this code will always fail.

Steps to Reproduce

  1. docker run --name redash -e ‘REDASH_DATABASE_URL=postgresql://redash@postgres/redash’ -d redash/redash:1.0.0.b2588
  2. docker exec -it redash bash
  3. wget https://raw.githubusercontent.com/getredash/redash/master/bin/upgrade
  4. chmod +x upgrade
  5. ./upgrade

Technical details:

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
vitorbaptistacommented, Apr 10, 2017

@sadavarti I ended up having a lot of issues running the migrations. My guess was that as previously redash was using a DIY migration tool that didn’t guarantee that migrations wouldn’t be run twice (AFAIK), I ended up messing the DB. I ended up having to check the migration files, analyzing what I had applied already, and fixing the errors as we went. All too manual and error-prone. Gladly, as redash now uses a good migration tool, this shouldn’t happen anymore.

3reactions
vitorbaptistacommented, Feb 9, 2017

@arikfr I was using re:dash 0.12 and now would like to upgrade to 1.0.0. As I’m using a Docker container, my thought was that I needed to get into the container and run the upgrade script. If that’s not the case, what would be the recommended way of migrating?

Edit: Answering myself, I’d need to run the migrations via sudo -u redash bin/run ./manage.py db upgrade

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm error invalid semver - node.js - Stack Overflow
To forcefully reinstall npm without using npm, try using the shell script curl https://npmjs.org/install.sh | sh.
Read more >
Semantic Versioning 2.0.0 | Semantic Versioning
Semantic Versioning 2.0.0. Summary. Given a version number MAJOR.MINOR.PATCH, increment the: MAJOR version when you make incompatible API changes ...
Read more >
Invalid version breaks registry for composer - GitLab.org
Taking a look at the package validation code, we validate the Composer version against Gitlab::Regex.semver_regex , which is too strict for some ...
Read more >
semantic-version - PyPI
A library implementing the 'SemVer' scheme. ... If the provided version string is invalid, a ValueError will be raised: ... Open an issue...
Read more >
Node.js v19.3.0 Documentation
Enabling the feature; Configuring a package; Upgrading the global versions ... Settings object; Error handling; Invalid character handling in header names ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found