Hello;

This is how I run the wolfballs backend codebase. To make UI changes more work is needed.

If someone wants I can make a tutorial on that next.

Copying the contents of the readme below.

Alternate Lemmy docker and vscode instructions

I like to be able to run a rust app with cargo run and not rebuild images. Even if it’s quick.

This alternate docker method mounts the lemmy code into a container that installs all your dependencies.

To get started you need a couple things installed on your machine;

  1. Docker

For the ui features;

  1. VSCode

  2. Remote Container Plugin

Instructions

Clone lemmy down,

git clone https://github.com/LemmyNet/lemmy.git lemmy

cd lemmy; # go into lemmy the directory

clone down this repo into the docker directory

git clone https://gitlab.com/wolfballs/lemmy-remote-development.git docker/debug

Build the image; builds a arch linux container with a suder user name developer

docker-compose -f docker/debug/docker-compose.yml build

Do house keeping stuff the same as other methods.

mkdir -p docker/debug/volumes/pictrs

sudo chown -R 991:991 docker/debug/volumes/pictrs

You can go ahead and test this with the terminal if you don’t want to use vscode. To do that,

docker-compose -f docker/debug/docker-compose.yml up -d

docker-compose -f docker/debug/docker-compose.yml exec lemmy /bin/bash

Might need to update rust;

rustup update

Ok now you can just run

cargo run

And you can visit the ui at,

0.0.0.0:1236

You can stop the container with;

docker-compose -f docker/debug/docker-compose.yml down

Run in VSCode

If you would like a whole development environment based on vscode with all plugins auto installed continue to the next section.

Bring down the containers

docker-compose -f docker/debug/docker-compose.yml down

From the root directory of the lemmy code base, copy the devcontainer and vscode directories from the debug section to the root.

cp -a docker/debug/devcontainer/ ./.devcontainer

cp -a docker/debug/vscode/ ./.vscode

Now you can open up the project from vscode. VSCode will actually be running inside a arch container.

Type F1 and select Reopen in container

Now you can click run in the debugger on the left. Break points aren’t yet working due to async await in the main function. I’m not yet sure how to fix that. If someonw knows of how to get that working please open a issue and let me know. However server starts and the terminal in vscode is inside of the container. You can make code changes and click the restart button and it will restart very quickly.

Thats is! You’ve got rust extensions auto installed in vscode for you.