Skip to content

Add startup logs to build log UI #2957

Closed

Description

@ammario

I have a complex startup script:

resource "coder_agent" "dev" {
  arch           = "amd64"
  os             = "linux"
  startup_script = <<EOF
    #!/bin/sh
    # install and start code-server
    curl -fsSL https://code-server.dev/install.sh | sh
    code-server --auth none --port 13337
    sudo service docker start
    if [ -f ~/personalize ]; then ~/personalize 2>&1 | tee  ~/.personalize.log; fi
    EOF
}

And it's not clear to me where I could see its log output. It would also be nice to not have to redirect command execution to logs manually.

The natural place for me to find this is the build log on the dashboard, but I also expect some file in my workspace to contain the log.

While we're at it, we should include the agent logs (/var/log/coder-agent.log) in the dashboard build log.

Activity

  1. changed the title [-]Add startup script log to build log[/-] [+]Add startup logs to build log[/+] on Jul 31, 2022
  2. ammario commented on Jul 31, 2022

    @ammario
    MemberAuthor

    So, the log is in /var/log/coder-startup-script.log. I had to read the documentation to find that, so the issue still stands as a major usability improvement.

  3. ketang commented on Jul 31, 2022

    @ketang
  4. changed the title [-]Add startup logs to build log[/-] [+]Add startup logs to build log UI[/+] on Jul 31, 2022
  5. added this to the EE milestone on Aug 22, 2022
  6. self-assigned this
    on Sep 8, 2022
  7. assigned and unassigned on Sep 26, 2022
  8. ammario commented on Oct 17, 2022

    @ammario
    MemberAuthor

    Let's make sure we use a PrefixSuffixWriter (First N bytes + Last N bytes) to bound how much storage these logs can take. We also may need the same for the provisioner logs, but I haven't investigated the code.

  9. ammario commented on Oct 18, 2022

    @ammario
    MemberAuthor

    An implementation challenge is startup_script can block for an indeterminate amount of time. Some of our examples spin off code-server asynchronously, but others block.

  10. sreya commented on Oct 19, 2022

    @sreya
    Collaborator

    Let's make sure we use a PrefixSuffixWriter (First N bytes + Last N bytes) to bound how much storage these logs can take. We also may need the same for the provisioner logs, but I haven't investigated the code.

    The only issue is if we're expecting some sort of prompt to be written to the log (something I know @kylecarbs mentioned when we discussed this Monday) then it might get truncated by the PrefixSuffixWriter.

    We could potentially only keep the startup logs of the most recent build and maybe also use a PrefixSuffixWriter with a 1MB cap to prevent any maliciousness. That would more than likely solve 99% of cases and prevent us from ballooning over time.

    The startup logs of previous builds are not likely to be useful.

  11. ammario commented on Oct 20, 2022

    @ammario
    MemberAuthor

    Some kind of limiter is absolutely necessary to prevent DoS, e.g cat /dev/urandom.

    We could potentially only keep the startup logs of the most recent build and maybe also use a PrefixSuffixWriter with a 1MB cap to prevent any maliciousness. That would more than likely solve 99% of cases and prevent us from ballooning over time.

    This sounds good to me.

  12. 20 remaining items

  13. self-assigned this
    on Feb 27, 2023
  14. bpmct commented on Mar 28, 2023

    @bpmct
    Member

    Closing as completed by #6558.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions