8
9 Comments

Using docker-compose for your local dev setup can save you a lot of time

I am currently developing a Vue.js app with an server for API calls and such. For a long time I hd to open 3-4 terminals in order to get everything up and runnung (Vue.js instance, server and database). And I also often forgot to e.g. start the database so my productivity suffered.

I finally utilized docker-compose to create a setup that spins up all needed things with a single command and also (with the help of mounted volumes) restarts the Vue application (or the server) whenever I change something in the original source code

I hope it helps some of you! https://github.com/Junkern/vue-server-template/blob/master/docker/docker-compose.yml

  1. 1

    I know this is not an equivalent to docker, but I use Tmux and Tmuxinator on my terminal to do exactly what you want! I just need to open the terminal and run 'tmuxinator start my-project', and it opens 3 windows(what you can call terminals here) and each window runs a specific command, for example for my Rails projects, window 1 opens the vim editor, window 2 runs the Rails console and window 3 starts the server and tails logs.

    Here's the config I use for my Rails projects https://gist.github.com/borenho/416619d55227d686ba4f1a696372cca0

    1. 1

      Oh, nice! I have heard a few times about Tmux, but never took the time to try it out.

  2. 1

    I do the same, the best part is that this way you can create containers for common tasks and reuse them between projects

    for example I made a container to mock a graphql api to preview the frontend ui before actually having a running api and database, or a container to compose different api endpoints together, but the most useful so far is a container to automatically generate a graphql server for a Mongodb database

    You can use the same approach in production, you can call it micro services

    1. 1

      @Morse if you don't mind sharing your containers/code please?

      1. 1

        Graphql for mongodb: https://github.com/remorses/mongoke
        Graphql gateway: https://github.com/remorses/apollo-federation-gateway
        Graphql mocker: https://github.com/remorses/graphql-easy-mocks

        As you see I really like graphql
        There is other stuff on my github profile

        1. 1

          Thanks a ton! i also loooove GraphQL. I have some OSS work on it with Ruby too, you can have a look https://github.com/borenho/nipishe

    2. 1

      Definitely! Reusing containers is a must and saves you time/space/costs :)

  3. 1

    Thanks for sharing your experience with Docker.

    MAMP has been for me the most accessible local server to use. The big caveat, though, is having to install all the dependencies of new projects.

    Will try Docker someday.

    1. 1

      I also started out with XAMPP a looong time ago, so I can feel you. While working at companies, Docker has pretty much solved the "works on my machine" problems, which is awesome :)

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 49 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 16 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments