Upgrade via apt issue

Dear all, we just performed our first upgrade via apt on our Ubuntu and now we get Server Error 500 on almost all pages.

I hope we didn’t lose everything.

Here the last part of ralph.log

https://xsnippet.org/363996

I’m not an expert on ralph, just starting to use it myself… looking at your log, it looks like the database migration scripts need to be run since the error talks about a missing column…

django.db.utils.OperationalError: (1054, “Unknown column ‘assets_asset.start_usage’ in ‘field list’”)

Looks like there is a ralph cli command (flush and migrate)

https://ralph-ng.readthedocs.io/en/stable/installation/data_migration/

Hope that helps.

Hi,
Unfortunately this is not the case.

The original installation was already with Ralph 3. So there is no migration from Ralph 2 to Ralph 3.

I made an initial installation manually (no repo) then a subsequent upgrade via apt upgrade (after configuring the repo).

After this upgrade I got the above error.

This is worrisome as it seems like the consistency check on the installation scripts are not working properly.

Right now I just need to put back at work Ralph, then I can help in troubleshooting the upgrade process.

If it can be of further help:

root@ralphng : ~ # /opt/ralph/ralph-core/bin/ralph check
System check identified no issues (0 silenced).

Think for a moment.

You upgraded to a new version of ralph 3.
The error is that there is a column missing in the database.
So, that means that the new version of ralph 3 added a column.
Therefore, you need to migrate the database to add the new column.

I put ‘start_usage’ into the github search and found the file where it was added on Feb 7th.

Here is the migration:

Hi Jon, that’s super cool. Thank you.

Now, last mile:

a. shall I put your code in a migration.py file,
b. copy this file into /opt/ralph/ralph-core/bin/python then
c. run /opt/ralph/ralph-core/bin/python/ralph migration.py

or

d. Shall I put your code within another file in ralph distribution, then
e. run ralph migrate

Last, will this migration destroy anything of the data currently stored in the database?

Thank you so much for your feedback, I’m learning python in real time with you.

Of course, make a backup of your database.

Also shut down the server when you do this stuff so nobody is modifying the site.

systemctl stop ralph

what happens when you run sudo ralphctl migrate?

For the records, this is what happened after executing ralphctl migrate:

~# ralphctl migrate
Operations to perform:
  Synchronize unmigrated apps: ralph_admin, django_rq, humanize, dc_view, messages, rest_framework, foundation, table, hooks, taggit_serializer, notifications, permissions, import_export, mptt, staticfiles
  Apply all migrations: external_services, accounts, back_office, custom_fields, data_importer, authtoken, transitions, operations, reversion, security, dhcp, licences, configuration_management, admin, attachments, sim_cards, networks, domains, ssl_certificates, trade_marks, auth, reports, supports, sessions, contenttypes, dashboards, taggit, assets, deployment, virtual, data_center, sitetree
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying assets.0029_asset_start_usage... OK
  Applying back_office.0010_backofficeasset_imei2... OK
  Applying back_office.0011_auto_20190517_1115... OK
  Applying licences.0005_licence_start_usage... OK
  Applying sim_cards.0003_auto_20181212_1254... OK
  Applying trade_marks.0004_auto_20190221_0923... OK
  Applying trade_marks.0005_auto_20190312_0931... OK

And now the server is back to normal.

Thank you so much for your advice, if it makes sense, I would suggest the developers to add the execution of this command at the end of the installation scripts of every release, just to make sure all the checks are done.

Thank you again Jon, have a great day.
Rosario

Jon, do you happen to know a company that could provide service support for Ralph?

Sorry man. I actually just tried out Ralph on an instance for a few days and realized that it doesn’t quite do what I need. It is also a bit of a headache since it isn’t well documented, as you are discovering. So I’m switching to just using Airtable. Simple and easy and scratches my itches. You might want to take a look at it yourself. Cheers.

Airtable collaboration tool as CMDB?

I was hoping for more of a DCIM product. I don’t need CMDB.

Have you looked at OpenDCIM?

Yes, I’ve looked at everything. They all seem to be built in the 1980’s and have clunky difficult to use UI’s. What I need is something far simpler and easier to use, is modern and ‘fun’.

At the end of the day, I just need to quickly and easily track a whole bunch of hardware in a data center.

Airtable is perfect… doesn’t require programmers to write code for the most part, doesn’t require installation or maintenance, is easily extended (with and without programming).

We’re using qrcodes to scan everything and sadly airtable doesn’t have good scanning support… so I’m building a simple scanning app that runs in the browser on any modern phone and uploads the data to airtable. fast easy simple…

Hi there!

ralphctl migrate must be run after every upgrade. We will make it more clear in documentation https://github.com/allegro/ralph/issues/3463

1 Like