
Ask HN: What do you use to start your dev environment faster? - closingin
Hello there !<p>I was wondering what you all use to setup&#x2F;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&#x2F;or not efficient enough depending on the solution you find.<p>Or maybe do you just &#x2F;npm start|docker-compose up|rails server|.+&#x2F; 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.<p>Tell me how you ease onboarding on your projects! Thanks for your sharing :)
======
1ba9115454
I'm using Visual Studio Code dev containers.
[https://code.visualstudio.com/docs/remote/containers](https://code.visualstudio.com/docs/remote/containers)

I have to move across a hand full of languages so having my environments all
configured with docker files is pretty neat.

~~~
closingin
Interesting! I don't use vscode that much, but I might have a look at this!

------
gls2ro
I am currently using the following combination:

\-
[https://github.com/DarthSim/overmind](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.

~~~
closingin
Ah this looks interesting! Gonna take a look at this, thx!

------
SkyLinx
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

~~~
Ramiro
I'm one of the creators of Okteto, thanks for the shout out!

We recently wrote a post on how to integrate Okteto with NodeJS apps, in case
anybody wants to try it out: [https://okteto.com/blog/how-to-develop-node-
apps-in-kubernet...](https://okteto.com/blog/how-to-develop-node-apps-in-
kubernetes/)

------
Raed667
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..

~~~
closingin
I get what you mean, but my question is more about how you can run your dev
environment when your "project" requires you to have multiple things running
(a react spa, a rails backend, three microservices, two databases, ...).
Understand "do you have one single command to run all of your resources or do
you start them one by one?".

Thanks for your reply though ! Your solution might fit people who have
dedicated instances for projects.

------
wprapido
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](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/](https://spark.laravel.com/) . Not free but worth
every penny.

------
potta_coffee
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.

------
haecceity
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.

~~~
closingin
I'm more asking about how you start an entire dev environment, like when you
have your front 1, front 2, api 1, microservice 1-2-3-4, ... that all need to
be running in order for you to start working.

For example: using pm2 to start your entire stack in one command (only when
it's all nodejs obviously)

It's not really related to the tech you use for every project :)

~~~
ldoughty
We use docker compose to stand up our micro services. If there's an order you
really need, and you can't get around it, try netcat (nc) to knock on the port
in a loop until it gets a successful response.

------
hauxir
docker and docker-compose with the project root mounted as /app usually does
the trick for me.

------
dvaletin
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.

------
bg117
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.

------
t_m_
> 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?

~~~
closingin
Whatever the livereload tool is (in this case it was a webpack watcher on
osx), the problem is that a change on the host isn't forwarded to the guest
correctly when using shared folders, so the socket server doesn't send the
update notification to the browser. :/

You have three options to work around this : \- use a polling based approach
\- use a plugin like [https://github.com/adrienkohlbecker/vagrant-
fsnotify](https://github.com/adrienkohlbecker/vagrant-fsnotify) which
internally uses `touch` (this is the one i used to choose) \- use an ssh mount
(not sure about this one, it's been a long time)

All of these workarounds have their downsides, so I'm wondering if someone has
another great approach to get a stack up and running when you have a lot of
dependencies (not speaking about packages, but different sub-projects)

------
muzani
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/](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.

------
kyle_v
In one vscode tab ‘cd client’ ‘npm start’ in another ‘cd server’ ‘npm run dev’

------
ydnaclementine
tmuxinator to open all of my panels, services etc for each project with a
single command

