Indico 3.3.2 indico db prepare syntax error

Hello,

I’m setting up Indico 3.3.2 on a Debian 12 VM on Proxmox for the first time, following this documentation: https://docs.getindico.io/en/stable/installation/production/deb/apache/. I have very little experience with either Python or Linux/bash, so maybe this is easy to solve, but I don’t know how.

I’m stuck at the “7. Create database schema”, with the command “indico db prepare”, since it tells me that I have a syntax error in the first line of my /etc/apache2/sites-available/indico.conf document:

The .conf documents that the guide tells me to write are these:

  1. /etc/apache2/sites-available/indico-sslredir.conf
<VirtualHost *:80>
    ServerName localhost
    RewriteEngine On
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
  1. /etc/apache2/sites-available/indico.conf
<VirtualHost *:443>
    ServerName localhost
    DocumentRoot "/var/empty/apache"
    Protocols h2 http/1.1

    SSLEngine             on
    SSLCertificateFile    /etc/ssl/indico/indico.crt
    SSLCertificateKeyFile /etc/ssl/indico/indico.key

    SSLProtocol           all -SSLv3 -TLSv1 -TLSv1.1
    SSLCipherSuite        ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-S>
    SSLHonorCipherOrder   off
    SSLSessionTickets     off

    XSendFile on
    XSendFilePath /opt/indico
    CustomLog /opt/indico/log/apache/access.log combined
    ErrorLog /opt/indico/log/apache/error.log
    LogLevel error
    ServerSignature Off

    <If "%{HTTP_HOST} != 'localhost'">
        Redirect 301 / https://localhost/
    </If>

    AliasMatch "^/(images|fonts)(.*)/(.+?)(__v[0-9a-f]+)?\.([^.]+)$" "/opt/indico/web/static/$1$2/$3.$5"
    AliasMatch "^/(css|dist|images|fonts)/(.*)$" "/opt/indico/web/static/$1/$2"
    Alias /robots.txt /opt/indico/web/static/robots.txt

    SetEnv UWSGI_SCHEME https
    ProxyPass / unix:/opt/indico/web/uwsgi.sock|uwsgi://localhost/

    <Directory /opt/indico>
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

Thanks in advance for any help.

Best,

J

I don’t know how this is happening for you but for some reason indico is trying to load your Apache config as the Indico config which of course fails.

  • are you running the command as the indico user?
  • what does ls -l /opt/indico output?
  • does echo $INDICO_CONFIG show anything?

Hello!

  1. Yes:

imagen

  1. This:
total 24
drwx--x--- 2 indico  www-data 4096 may 16 10:10 archive
drwx--x--- 2 indico  www-data 4096 may 16 10:10 cache
drwx------ 2 indico  www-data 4096 may 16 10:10 etc
drwx--x--- 3 root    root     4096 may 15 13:34 log
drwx--x--- 2 indico  www-data 4096 may 16 10:10 tmp
drwxr-x--- 2 manager manager  4096 may 16 09:42 web
  1. Nothing at all.

Sorry, I meant ls -al /opt/indico.

Here:

total 56
drwxrwxrwx 12 manager manager  4096 may 16 10:59 .
drwxr-xr-x  3 root    root     4096 may 15 13:33 ..
drwx--x---  2 indico  www-data 4096 may 16 10:10 archive
-rw-------  1 indico  www-data 1567 may 16 12:47 .bash_history
-rw-------  1 root    root      132 may 16 09:32 .bashrc
drwx------  3 indico  www-data 4096 may 16 09:28 .cache
drwx--x---  2 indico  www-data 4096 may 16 10:10 cache
drwx------  2 indico  www-data 4096 may 16 10:10 etc
drwxr-xr-x  3 indico  www-data 4096 may 16 10:59 .local
drwx--x---  3 root    root     4096 may 15 13:34 log
drwx------ 14 indico  www-data 4096 may 16 09:27 .pyenv
drwx--x---  2 indico  www-data 4096 may 16 10:10 tmp
drwxr-x---  6 indico  www-data 4096 may 16 09:35 .venv
drwxr-x---  2 manager manager  4096 may 16 09:42 web

Did you answer the question about creating a symlink at the end of indico setup wizard with “no” by any chance?

Fix it by running ln -s etc/indico.conf .indico.conf in /opt/indico, then try again.

I think I did so, yeah… It’s giving me the same syntax error again. Maybe I need to rerun the setup wizard?

Have you tried running my command? Also, check the contents of /opt/indico/etc/indico.conf where the symlink should point to. It should look like a Python file defining a bunch of variables, like WHATEVER = 'something'.

Sorry, I haven’t been clear. Yes, I tried running your command, then I tried “indico db prepare” again, and it showed the same syntax error as before.

Here’s what’s inside /opt/indico/etc/indico.conf:

# General settings
SQLALCHEMY_DATABASE_URI = 'postgresql:///indico' # I don't know if those three '///' are correct or not...
SECRET_KEY = # a long bunch of letters, numbers and symbols, I don't know if it must be shared online
BASE_URL = 'https://D12-INDICO.prueba.com'
CELERY_BROKER = 'redis://127.0.0.1:6379/0'
REDIS_CACHE_URL = 'redis://127.0.0.1:6379/1'
DEFAULT_TIMEZONE = 'Europe/Madrid'
DEFAULT_LOCALE = 'en_GB'
ENABLE_ROOMBOOKING = True
CACHE_DIR = '/opt/indico/cache'
TEMP_DIR = '/opt/indico/tmp'
LOG_DIR = '/opt/indico/log'
STORAGE_BACKENDS = {'default': 'fs:/opt/indico/archive'}
ATTACHMENT_STORAGE = 'default'

# Email settings
SMTP_SERVER = ('[our SMTP server]', 25)
SMTP_USE_TLS = False
SMTP_LOGIN = ''
SMTP_PASSWORD = ''
SUPPORT_EMAIL = 'jgromero@ifae.es'
PUBLIC_SUPPORT_EMAIL = 'jgromero@ifae.es'
NO_REPLY_EMAIL = '[some no reply address]'

STATIC_FILE_METHOD = 'xsendfile'

STATIC_FILE_METHOD = 'xsendfile'

STATIC_FILE_METHOD = 'xsendfile'
export INDICO_CONFIG=/opt/indico/etc/indico.conf
indico db prepare

Does this work?

Also, what does echo $HOME give you? and id indico?

After the export command, the result of the ‘indico db prepare’ command is different:

Traceback (most recent call last):
  File "/opt/indico/.pyenv/versions/3.12.3/lib/python3.12/logging/config.py", line 581, in configure
    handler = self.configure_handler(handlers[name])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.pyenv/versions/3.12.3/lib/python3.12/logging/config.py", line 848, in configure_handler
    result = factory(**kwargs)
             ^^^^^^^^^^^^^^^^^
  File "/opt/indico/.pyenv/versions/3.12.3/lib/python3.12/logging/__init__.py", line 1231, in __init__
    StreamHandler.__init__(self, self._open())
                                 ^^^^^^^^^^^^
  File "/opt/indico/.pyenv/versions/3.12.3/lib/python3.12/logging/__init__.py", line 1263, in _open
    return open_func(self.baseFilename, self.mode,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/opt/indico/log/celery.log'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/indico/.venv/bin/indico", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/indico/cli/util.py", line 108, in invoke
    return self._impl.invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/click/core.py", line 1685, in invoke
    super().invoke(ctx)
  File "/opt/indico/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/flask/cli.py", line 383, in decorator
    app = ctx.ensure_object(ScriptInfo).load_app()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/flask/cli.py", line 328, in load_app
    app: Flask | None = self.create_app()
                        ^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/indico/cli/util.py", line 26, in _create_app
    return make_app()
           ^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/indico/web/flask/app.py", line 415, in make_app
    Logger.init(app)
  File "/opt/indico/.venv/lib/python3.12/site-packages/indico/core/logger.py", line 109, in init
    logging.config.dictConfig(data)
  File "/opt/indico/.pyenv/versions/3.12.3/lib/python3.12/logging/config.py", line 914, in dictConfig
    dictConfigClass(config).configure()
  File "/opt/indico/.pyenv/versions/3.12.3/lib/python3.12/logging/config.py", line 588, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'celery'

Also:

‘echo $HOME’ gives me ‘/opt/indico’
‘id indico’ gives me ‘uid=999(indico) gid=33(www-data) grupos=33(www-data),27(sudo)’

The log folder ownership is not correct. chown indico:www-data /opt/indico/log should fix it, but did you by any chance run indico setup wizard as root initially, or (re)start Apache between adding the apache config for indico and running the setup wizard?

PS: Unrelated, but your indico user should probably not have sudo access.

It seems that the ownership change made it! I had to run the chown command as root from another terminal (you’ll see ‘Operación no permitida’ (‘not allowed’ in Spanish) as indico user), but after that the ‘indico db prepare’ worked:

I ran through some problems with previous steps that I managed to solve, primarily restarting Apache and giving higher permissions to indico and manager users to some folders. So yes, if I didn’t run the indico setup wizard as root, I surely (re)started Apache between configurations… Finally, I removed indico from sudoers.

I’ll see if I can continue with the guide from here on. Thanks a lot!

Hello again,

It seems I have problems restarting the services at “8. Launch Indico”:

The next command (systemctl enable apache2.service…) doesn’t give me any error, but I guess I can’t continue if the last one fails.

Most likely it’s the same error as you had earlier. If looking up the config using the symlink does not work (I still wonder why that’s the case for you!), then you need to set the INDICO_CONFIG=/opt/indico/etc/indico.conf env var explicitly, also in the systemd unit files for indico-uwsgi and indico-celery.

IIRC you need to add this to the unit file:

Environment="INDICO_CONFIG=/opt/indico/etc/indico.conf"

Note: It would be much better to try to figure out why you have all these problems, since nobody else has them, and ignoring them now and/or using workarounds will just haunt you at some point in the future…

Hello,

In the end, we’re reinstalling it on a Debian 12 container in Proxmox. But we have a doubt:

In the step “3. Configure uWSGI & Apache”, when asked to change “YOURHOSTNAME” in the /etc/apache2/sites-available/indico-sslredir.conf and /etc/apache2/sites-available/indico.conf files, can we write “localhost/indico”? Or it should work with just “localhost”, which is what we were doing before?

Thanks.

Why would you use localhost there? It must be the hostname under which Indico will be accessed later, so e.g. indico.yourdomain.tld.

Using a /indico subpath is highly unsupported and discouraged, use a subdomain instead!

Thanks. It is a test environment, so we thought there should be no problem using ‘localhost’ (which in this case is ‘indico’). We’ll try with a subdomain.

We’ve reached the ‘indico db prepare’ step again, but now this is the problem. This didn’t happen in our past attempts:

You need to use whatever hostname you use to access your instance, regardless of whether it’s testing or production. So localhost works if you actually plan to access it via https://localhost.