Debugging Indico remotely from Windows

Guys, I am struggling with setting up a nice dev environment for Indico.

I am a Windows guy, and would like to be able to (remotely?) debug Indico seamlessly.

I successfully installed Indico inside an Ubuntu Server VM, but can’t figure out how to debug the code there (stepping, breakpoints, etc.) from my Windows host. The built-in Flask console is no where near as powerful as I am used to (or perhaps I am missing something, and the “console” can be used for fully fledged debugging?), so it won’t cut it.

Please help!

print is enough in most cases - at least I rarely feel the need for a real debugger with stepping etc.

Anyway, there are various remote-capable debuggers like wdb or the debugger in VS code (its remote editing feature might be really useful for that as well).

I need a fully fledged debugging env, because I plan on building complex plugins for Indico, and ‘print’-bugging won’t be enough.

What do I do on Indico’s side (Ubuntu Server) to enable remote debugging?

with wdb you simply put import wdb; wdb.set_trace() at the place where you want to break

1 Like

@10caret100 if you’re on Windows and want to run Indico locally, you can always try using the WSL. I never ran Indico on it, but managed to do it with smaller apps.

:frowning: I feel desperate.

Can I install and run Indico on Ubuntu Desktop, so that I can debug “locally” this way inside Ubuntu?

yes sure, that’s actually what most people in our team do - linux desktop, and running indico locally

Any ready VM (Docker and similar) containers out there that I can pull so that I can save the hours I need to spend installing Indico from scratch on Ubuntu Desktop? Thanks

You do not need a VM or containers on a Linux desktop. Just follow the development setup guide and you’ll have everything ready in a few minutes.

I think I did follow the guide on an Ubuntu Desktop about a month ago, but gave up, cause it was complaining that I was missing some packages or similar. Don’t remember :frowning: Anyone with experience installing Indico on Ubuntu Desktop?

Sure, but even if someone says “yes” to that question it won’t help you with some error you have :wink:

Instead, simply post here when you have an error about a missing library (after trying a quick google search, in many cases searching for the error + ubuntu will find some stackoverflow etc. post about it, where someone already answered what you need to install). Someone here will most likely be able to help you when seeing the error you get.

Ok, will do. Thanks guys!

Hi Team.

I am trying to setup a development environment within Windows using Dev Containers. I can execute all the steps seamlessly until the database set up part:

The following command

# Database setup
sudo -su postgres createuser $USER --createdb

throws the following error

Sorry, user vscode is not allowed to execute '/usr/bin/createuser vscode --createdb' as postgres on 784f8b65581d.

If I switch to postgress using sudo su postgres and execute createuser $USER --createdb, I am able to create the databases as usual. However, during the final set up indico db prepare throws sqlalchemy.exc.ProgrammingError: (psycopg2.errors.InsufficientPrivilege) permission denied for database indico.

Anyone with sysadmin experience know how to get this right? Do I have to create a separate docker container for postgres and expose the socket?

@ThiefMaster, can we create a task-group to develop a documentation for setting up the environment using Dev Containers. I’ll help with writing documentation.

If indico is running as a different user (vscode?) than the one owning the postgresd db (indico), you need to set up a user mapping for postgres. This should work to allow the vscode system user connect as the indico Postgres user:

pg_ident.conf:

# MAPNAME       SYSTEM-USERNAME         PG-USERNAME
mapping         vscode                  indico

pg_hba.conf:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   all             all                                     peer map=mapping

You also need to adapt the DB URI though. You may need to tweak the SQLALCHEMY_DATABASE_URI a bit so it uses the correct username. Try postgresql://indico:@/indico.

An alternative to all this would be to NOT create a indico postgres user at all, but simply create and use a vscode postgres user. Or you could use standard postgres authentication (with a password or since it’s dev even trust where you can just connect w/o any authentication) and then specify the username as like in my previous paragraph.

IMHO this issue you have is more postgres-related rather than indico-related, and we usually assume that people using a non-standard setup (regardless of it’s for dev or prod) adapt the guides we provide to their environment. But if you have a blog, feel free to post there about setting up Indico in this particular environment and share the link in here! That way we avoid the extra maintenance burden for something none of us use. :slight_smile:

Nice timing. Thank you very much. Resolved this issue just 15 minutes ago by making vscode the superuser in postgres. Everything is sorted now.

And yes. I will certainly put out a blog article on setting up a local development environment using VS Code Dev Containers. I was too excited about it at the time of writing my query earlier, but I do get the point that every extra weight increases the maintenance burden on you all.

Finally, thank you for taking time to respond as usual.