Skip to content

Linux WSL2 Local Development Setup

Alexandar83 edited this page Feb 25, 2025 · 2 revisions

This page provides detailed instructions for setting up a local development environment for The Wall API on Linux (installed on WSL2). It walks through configuring dependencies, managing services, and running the application to streamline development and testing workflows.

Step-by-step instructions

1. Clone the repository in a folder of your choice:

git clone https://github.com/Alexandar83/the-wall-api.git
cd the-wall-api

2. Set up the DEV environment configuration:

  • Ensure the following files are set up in the repository folder:

    • config/envs/common/redis.conf
    • config/envs/dev/postgres_dev.env
    • config/envs/dev/the_wall_api_dev.env

    💡 Check the *.example files in the relevant folders of the repository for example configuration values.

📝 All subsequent console commands in this section must be executed from the project's root folder (the-wall-api).

3. Install system dependencies:

config/scripts/linux/linux_install_prerequisites.sh

💡 Restart your shell to apply the Poetry changes to PATH.

4. Install app dependencies:

poetry install

5. Workflow to start and manage the application:

  • 5.1 Start a virtual environment:

    source config/scripts/common/poetry_shell.sh
    

  • 5.2 Start all dockerized services:

    config/scripts/docker/docker-compose-dev+migrations.sh
    

  • 5.3 Start a local Django development server:

    config/scripts/linux/refresh_allowed_hosts_wsl2.sh --deployment_mode=dev
    python manage.py runserver 0.0.0.0:8000
    

  • 5.4 Send requests to the API endpoints, using the current WSL2 IP address:

    • http://WSL2 IP:8000/api/v2/
    • http://WSL2 IP:8000/api/v2/swagger-ui/

    💡 Refer to the description of the refresh_allowed_hosts_wsl2.sh script for WSL2 IP details.

  • 5.5 Create a super user:

    python manage.py createsuperuser
    
  • 5.6 Access the built-in Django admin panel:

    • http://WSL2 IP:8000/admin/

    💡 The local Django development server must be running.

  • 5.7 To stop the app:

    docker compose -p the-wall-api-dev -f config/docker/docker-compose-dev.yml down
    

6. To remove the virtual environment:

poetry env remove python

📌 Action required: To use the other setups, remove all images and volumes, related to the app and the Celery services:

docker volume rm the_wall_api_redis_data_dev
docker volume rm the_wall_api_postgres_data_dev
docker volume rm the_wall_api_celery_beat_schedule_dev
docker rmi ghcr.io/alexandar83/the-wall-api
docker rmi ghcr.io/alexandar83/celery-lightweight

🗒️ Note: The images for the Redis, PostgreSQL, and Busybox services can be reused in all setups.

💡 Verify that the volumes and images are removed:

docker volume ls
docker images

💡 If either of the images becomes untagged, it has to be removed by its image id:

docker rmi <image_id>

Return to Top
Installation Instructions Index
Home Page


Clone this wiki locally