How to reset license after it has expired

Question:

My license has expired and Lenses keeps restarting. How do i reset license to use a new one?

Answer

Lenses allows 1 month to be run with an expired license, after that it will stop working and depending on the deployment method enter a restart loop. During this restart loop it’s impossible to update the license using the UI or the REST endpoint. In this edge-case, the only solution is to remove the existing license from Lenses db. Here is how to do it for both H2 (default) and PostgreSQL.

# H2 example where db file `lensesdb.mv.db` can be found under '/data/storage/' folder (docker) 
# (or './storage' when using archive installation) 
# The following command should be run from within $LENSES_PATH/lib folder, e.g. /opt/lenses/lib
$ java -cp h2-*.jar org.h2.tools.Shell \
   -url 'jdbc:h2:file:/data/storage/lensesdb' \
   -sql "DELETE FROM lenses_settings WHERE KEY='license';"

# PostgreSQL example with psql CLI tool that comes with PostgreSQL installation
psql -U postgres -h localhost lenses
> DELETE FROM lenses_settings WHERE key='license';