Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steps to Set Up drunc-ui and Create a Superuser on Windows #178

Open
cvzbynek opened this issue Oct 23, 2024 · 3 comments
Open

Steps to Set Up drunc-ui and Create a Superuser on Windows #178

cvzbynek opened this issue Oct 23, 2024 · 3 comments

Comments

@cvzbynek
Copy link
Collaborator

cvzbynek commented Oct 23, 2024

Issue: Steps to Set Up drunc-ui and Create a Superuser on Windows

Description

While setting up the drunc-ui application, I encountered a few challenges, especially around creating a Django superuser and ensuring the correct permissions for Docker. I’ve documented the exact steps I followed and where I encountered issues, which might help in improving the developer documentation.

Steps Tried So Far

  1. Cloning the Repository

    • Cloned the drunc-ui repository from GitHub to a directory in Windows:
      git clone https://github.com/ImperialCollegeLondon/drunc_ui.git
      cd drunc_ui
  2. Setting Up Docker with WSL

    • I am using WSL 2 with Ubuntu as my distribution. Initially, Docker wasn’t properly integrated with WSL, so I had to enable the WSL integration in Docker Desktop.
    • After enabling integration, I ensured Docker was running in the WSL environment:
      docker --version
  3. Running Docker Compose

    • From within the project directory, I started the Docker services using Docker Compose:

      docker compose up
    • The app launched successfully, but when accessing the app at http://localhost:8000, I was prompted for a username and password, which I didn’t have yet.

  4. Creating a Superuser (Missing from Documentation)

    • To create the superuser, I followed these steps:

      • First, I ensured Docker containers were running in one terminal:

        docker compose up
      • In a new terminal, I entered the container that runs the Django app:

        docker compose exec app bash
      • Once inside the container, I ran the following command to create the superuser:

        python manage.py createsuperuser
      • I followed the prompts to set up a username, email, and password for the superuser.

      • After exiting the container, I was able to log into the app at http://localhost:8000 using the superuser credentials.

  5. Docker Permissions Issue

    • Initially, I encountered a permissions issue when running docker compose up, which resulted in the following error:

      permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
      
    • To resolve this, I had to add my user to the docker group:

      sudo usermod -aG docker $USER
    • After restarting my session (or running newgrp docker), I could run Docker commands without needing sudo.

Suggestions for Documentation

  1. Create a Superuser

    • Add a section explaining that after starting the Docker containers, users must create a Django superuser by entering the app container and running the createsuperuser command. The documentation should highlight that this step is necessary to log in to the application.
  2. Docker Permissions

    • Mention that users might need to add themselves to the docker group to avoid permission errors when running Docker commands. This step is common when working with Docker in WSL or Linux environments.
  3. WSL Setup

    • It might be helpful to include a brief guide on how to set up Docker with WSL 2, especially for users on Windows, as WSL integration can sometimes be tricky to configure.
@cc-a
Copy link
Contributor

cc-a commented Oct 23, 2024

Hi @cvzbynek. Thanks for this. Happy to link to some resources on getting Docker setup on different platforms. The user creation in docker is covered in the getting started with the process manager ui section, so maybe we need to highlight this a little better?

@cvzbynek
Copy link
Collaborator Author

cvzbynek commented Oct 23, 2024

@cc-a I see now. I haven't gone to that part very thoroughly, since I didn't get to Process Manager itself. I would restructuralize to stress the need to make a superuser to actually access anything. Not just the Process Manager.

@cc-a cc-a mentioned this issue Oct 23, 2024
@cc-a
Copy link
Contributor

cc-a commented Oct 23, 2024

Ok, we have an issue to create some more extensive documentation so I'll link this under that and take a pass when I look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants