2

A friend and I started working on a project together, and we wanted to try using a single remote dev environment for it.

I created a VM on Oracle's Cloud Infrastructure, and created a user for my friend.

We have a single repository for the project on github.

The project uses docker-compose for a traefik proxy, a mariadb database, and a django project.

Each of us clone the repo to our home folder on the vm, and each have our own docker-compose file (complete duplicates, zero differences between them)

We use VSCode's Remote-SSH extension to remote into the machine and open our working dir as a workspace in vscode.

Example, we're both working at the same time, but not currently communicating via discord call or some other method. I run docker-compose up -d to do some testing and error checking, ports get bound, then he tries to run docker-compose up -d for the same reason, but the ports are already bound and his containers terminate. Therefore until I run docker-compose down, he won't be able to test his working branch.

I figured we could have a shared folder for the local repo, but i noticed any modifications I made to the filesystem would reflect in his editor in realtime, and realized that switching branches could cause major data loss, which is why we opted for separate working directories.

We could each use different machines but that would require separate domains for access, and differently configured docker-compose.yml files, which would constantly have to be edited given that it's in the github repository.

I've thought about a dedicated directory that has the "development" branch checked out and updated via ci/cd with pull requests but that wouldn't allow quick testing without merging PRs and reverting changes if there are problems.

We use the remote machine because our actual computers don't have a ton of processing power, and the VM provides us with 4 cpus and 24GB mem, which is plenty.

Is there a realistic way we can both work on the same machine with the same project, and do testing without conflicting with each other's "runs" of docker-compose up -d or our working directories? Any suggestions on how we can make this work, or better alternatives?

2
  • This approach with environment variables (and optional defaults) might work. This would let each of you bind to different combinations of ports and IPs by adjusting environment variables, while keeping the docker-compose.yml file static in the repository itself. Commented Apr 6, 2022 at 6:55
  • I see, so the following setup may work: Both in our own working dirs with our own .env files, a central "production" docker-compose.yml that has the proxy, db, and the app, then each with our own "dev" docker-compose.yml that only runs the app and connects to external docker networks and connects on the .env configured ports/subdomains for the proxy, then another docker-compose.yml for the proxy and the database that are exposed on those external networks Commented Apr 6, 2022 at 17:43

0

You must log in to answer this question.

Browse other questions tagged .