Skip to content

Improve Codabench deployment documentation #1917

Closed

Description

@ihsaan-ullah

The Deployment Documentation is not very detailed and some points are missing or not explained well. I will list the problems here and then improve the documentations.

Generate Data Issue:

Storage URL issue

  • This is wrong: AWS_S3_ENDPOINT_URL=http://<IP ADDRESS>/, it should be AWS_S3_ENDPOINT_URL=http://<IP ADDRESS>:9000

Minio version issue

  • I had to make a small change in the docker-compose.yml file to configure minio --- change mc config host add minio_docker to mc alias set minio_docker

Using IP instead of domain issues

  • When you haven't connected a domain to the deployment, the activation emails have example.com instead of the IP.
    This could be fixed by updating the Site record manually from django shell
from django.contrib.sites.models import Site

site = Site.objects.get(id=1)
site.domain = "<IP>:8000" 
site.name = "Codabench"
site.save()
  • It is not clear from the current documentation that when you connect a domain, how the site settings change and uses domain instead of example.com. We should clarify this in the documentation and also add more details about connecting a domain.

Bring from email to .env

Improvements:

  • we should suggest to change the minio key and password because using testkey and testpassword seems risky
  • we should add documentation about configuring mail-server to the deployment documentation
  • we should create a readme file for Google Clound that documents each step in detail for Google Cloud only. Later on we can add such docs for other platforms too like Azure, Amazon etc

Configuring a mail server

To test email sending you can use this code in shell. This uses the email settings from the env

from django.core.mail import send_mail
send_mail(
    "Hostinger Email Test",
    "This is a test email sent from Django via Hostinger SMTP.",
    "[email protected]",
    ["[email protected]"],
)

To bypass the env setting and use new settings use the following code. This is useful when you want to check first the email configuration and then add to .env

from django.core.mail import get_connection, send_mail

connection = get_connection(
    backend='django.core.mail.backends.smtp.EmailBackend',
    host='smtp.titan.email',
    port=465,
    username='[email protected]',
    password='<PASSWORD>',
    use_ssl=True,
    use_tls=False
)

send_mail(
    subject="Test Email",
    message="This is a test from Django via Hostinger SMTP.",
    from_email="[email protected]",
    recipient_list=["[email protected]"],
    connection=connection
)

Activity

  1. added
    Setup
    on Jul 9, 2025
  2. ihsaan-ullah commented on Jul 10, 2025

    @ihsaan-ullah
    CollaboratorAuthor
    • Clearly explain how domain connection works
    • Explain how to enable SSL for the domain
  3. ihsaan-ullah commented on Jul 11, 2025

    @ihsaan-ullah
    CollaboratorAuthor

    @ObadaS for some reason the db is deleted from my deployment on Google Cloud. I had to run migrate command again to fix this. Do you know if there is any script/task that deletes the db for some reason or could this be a cloud VM problem?

  4. ObadaS commented on Jul 11, 2025

    @ObadaS
    Collaborator

    We have this file that resets the database, but it also runs migrate afterward. Since you had to run it again, I guess it's not possible that it was ran in the first place.

  5. curious-broccoli commented on Jul 11, 2025

    @curious-broccoli
    Contributor

    the wiki says that (if necessary) you should open the port 8000, but you actually want to open the caddy ports I think: 80, 443

  6. ObadaS commented on Jul 15, 2025

    @ObadaS
    Collaborator

    It is not clear from the current documentation that when you connect a domain, how the site settings change and uses domain instead of example.com. We should clarify this in the documentation and also add more details about connecting a domain.

    I tested it, example.com doesn't get changed to the site domain even if I put a different one. There must be a different setting that can be changed to change example.com into the actual site domain name.

  7. ObadaS commented on Jul 16, 2025

    @ObadaS
    Collaborator

    I did some more tests, it seems that instead of doing that :

    from django.contrib.sites.models import Site
    
    site = Site.objects.get(id=1)
    site.domain = "<IP>:8000" 
    site.name = "Codabench"
    site.save()
    

    We can just modify this file

    'domain': get_current_site(request).domain,

    to :

    'domain': settings.DOMAIN_NAME, 

    It will work for instances which uses domain names (localhost included) as well as IP addresses.
    I am not sure why the current implementation is showing example.com instead of the domain name.
    I'm also not sure if we need to change other files for other kind of emails that people could receive containing the link to the website.

  8. curious-broccoli commented on Jul 22, 2025

    @curious-broccoli
    Contributor
  9. curious-broccoli commented on Jul 22, 2025

    @curious-broccoli
    Contributor

    I did some more tests, it seems that instead of doing that :

    from django.contrib.sites.models import Site
    
    site = Site.objects.get(id=1)
    site.domain = "<IP>:8000" 
    site.name = "Codabench"
    site.save()
    

    We can just modify this file

    codabench/src/apps/profiles/views.py

    Line 99 in d98abf9
    'domain': get_current_site(request).domain,

    to :

    'domain': settings.DOMAIN_NAME,

    It will work for instances which uses domain names (localhost included) as well as IP addresses. I am not sure why the current implementation is showing example.com instead of the domain name. I'm also not sure if we need to change other files for other kind of emails that people could receive containing the link to the website.

    I also think that using settings.DOMAIN_NAME is better. it seems that the sites framework is meant for cases where django serves multiple domains

  10. ihsaan-ullah commented on Jul 22, 2025

    @ihsaan-ullah
    CollaboratorAuthor

    Very productive thread. Thanks a lot @curious-broccoli and @ObadaS for the contribution. We will improve the documentation soon and will incorporate all the points mentioned.

  11. Didayolo commented on Jul 23, 2025

    @Didayolo
    Member

    Hi all,

    I mention it because it is related, I updated Codabench installation and How to deploy Codabench pages. I mainly made them clearer (separating local setup and online deployment between these two), and added instructions and warning about SSL and about changing the default usernames and passwords.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationSetup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions