Skip to main content

Debugging SciNote in Docker with VS Code

More details on the development process, refer to Jira Issues Peg-2 and Peg-3.

Debugging Steps

1. Setup Docker Compose in VS Code

Step 1 to get this working is to run the docker compose through VS Code How to use Docker containers for Ruby on Rails development in Visual Studio Code. The rough steps are outlined below:

  1. Kill all docker processes (docker stop __)
  2. docker system prune
  3. Open the root scinote directory in VS Code
  4. Add a folder called .devcontainer
  5. Create a file .devcontainer/devcontainer.json with the following content:
    {
    "name": "Existing Docker Compose",
    // Override the first configuration with a second docker-compose.yml
    "dockerComposeFile": [
    "../docker-compose.yml"
    ],
    // Specify the service name and Rails service to be started as described in docker-compose.yml
    "service": "web",
    //The directory to connect to at startup
    "workspaceFolder": "/usr/src/app"
    }
  6. Create a file .devcontainer/docker-compose.yml with the following content:
    version: '2'
    services:
    web:
    # Prevent Rails from starting when docker starts
    command: /bin/sh -c "while sleep 1000; do :; done"
  7. Open the command palette by pressing ctrl + shift + p
  8. Type in Rebuild and Reopen in container and select that option from the Dev Containers extension.
  9. Wait for the process to finish. It may take a few minutes.
  10. Once the containers finish building and you can see the explorer in VS Code, then the app should be running. Navigate to localhost:3000 and verify the site is running.

The next step will be to set up debugging, the second of the two articles. How to debug Rails running on Ruby 3.1 using VSCode and Dev Containers

2. Debug

TODO

I will finish setting this section up the next time I do SciNote work.