What do you use to start your dev environment faster?
Hello there !
I was wondering what you all use to setup/start your dev envs (nodejs envs most of time for me) ? I used to run some vagrant with virtualbox, but there are a lot of problems with inotify so livereload is difficult to setup and/or not efficient enough depending on the solution you find.
Or maybe do you just /npm start|docker-compose up|rails server|.+/ all of your repos manually? This is what I actually do for small projects, but you always have to help people get your stack up and running.
Tell me how you ease onboarding on your projects! Thanks for your sharing :)
I have to move across a hand full of languages so having my environments all configured with docker files is pretty neat.
I am currently using the following combination:
- https://github.com/DarthSim/overmind for running whatever is needed inside a project which has multiple things (like rails and webpacker). It is great because it uses tmux.
- A custom file (.dev-start) I put in my parent folder /project which describes what to execute in child folders (like /project/fe and /project/backend). Possible what this files does could be done with overmind but this is a setup I had before discovering overmind
- A bashrc script (a combination of bash script and bash aliases) which is executed on “cd” command and searches for .dev-start and if exists will execute. In the same script I also search for .browser-wip which is just a simple file with all the URLs I think I need to be open in browser while working on current project. If this file exists then it will open in default browser all links from there.
I work with Docker and Kubernetes do my dev environment is actually in my cluster rather than locally. I use Okteto to manage this dev env so I can even switch computers and all I need is the source code of my app and one 'okteto up' command, and I'm ready to go
The "trick" that saved me a lot of time, and my laptop from overheating, is to work on one project at a time.
Need to change the API? Do that and deploy it. Need to change a React app that uses the API? run it locally and call a private instance of the server instead of running both in parallel..
Not a NodeJS dev, yet I rely a lot on boilerplates. Some developed by others, some built by me over the course of many years. For a few rather simple NodeJS projects that I worked on, https://github.com/sahat/hackathon-starter this one caught my attention and worked like a charm. For PHP / Laravel, I use https://spark.laravel.com/ . Not free but worth every penny.
Docker-compose is the best thing I've found for sharing dev environments so far. You do have to help people, but if you do a good job, they'll learn and then they can help other people too.
Aren’t node projects just npm i; npm start? Maybe clearer documentation would help. Like step by step what commands to run to build and run. It's weird I see some projects that expect contributors to figure that out themselves. Or maybe they don't want contributors.
docker and docker-compose with the project root mounted as /app usually does the trick for me.
We are using docker-compose with mounting your local files inside of the container. You can either switch do docker or mount your local folder in VM via vagrant. Not sure live reload will work with the latter solution, but works pretty well with docker.
Try to use script files with actual commands that does the work instead of typing in commands each time. Saves lot of time and effort.
> I used to run some vagrant with virtualbox, but there are a lot of problems with inotify so livereload is difficult to setup.
Which livereload tool do you use?
I'm a big fan of the idea that a build should be done with one command line. Mine is 'npm run d' for dev, 'npm run p' for production.
This is a nice chart: https://xkcd.com/1205/
If you're doing it daily and it takes half an hour, you could probably dedicate 5 weeks to optimizing this.
If you're doing builds like me, it's more like 20 builds a day, each taking an extra minute. That's about a month worth of optimizing.
In one vscode tab ‘cd client’ ‘npm start’ in another ‘cd server’ ‘npm run dev’
tmuxinator to open all of my panels, services etc for each project with a single command