Skip to content

Setting up a development environment

Shomy edited this page Apr 9, 2024 · 49 revisions

Step 1: Get Docker & Friends

OSX / Windows

If you are on Mac, check out Docker for Mac
If you are on Windows, check out Docker for Windows

These will install docker, docker compose, and docker-machine on your machine.

Linux

Use your distribution's package manager to install docker and docker-compose-plugin.

Step 2: Get your own Kitsu

Fork the client and server repository on GitHub, so you can work on feature branches from your own fork. Then clone the Kitsu Tools repository from GitHub from [email protected]:hummingbird-me/kitsu-tools.git

Make sure to navigate to the repository directory cd kitsu-tools

Step 3: Run the setup!

In order to pull, build and run, just run bin/setup and follow the instructions

If you get the following error message:

ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.

You should confirm that you've ran 'Docker Quickstart Terminal' and if so - attempt the command again in a new terminal window.

If you get the following error message:

gzcat: command not found

You can change line 67 of bin/seed script with this:

-  gzcat "$DB_FILE_NAME" | psql "$DB_TARGET_ID"
+  gunzip -c  "$DB_FILE_NAME" | psql "$DB_TARGET_ID"

If you continue having problems try this:

-  gzcat "$DB_FILE_NAME" | psql "$DB_TARGET_ID"
+  zcat  "$DB_FILE_NAME" | psql "$DB_TARGET_ID"

Step 4: Test if it's flying

Find the address and port for the application and open it in your browser. You can do this running bin/open-browser or manually

  • On Linux with local docker: xdg-open "http://localhost:3000"
  • OSX / Windows with Docker Toolbox/Machine: open "http://$(docker-machine ip default):${$(docker-compose port nginx 80)//0[.:]/}"
  • OSX / Windows with Docker for Mac/Windows: open "http://localhost:${$(docker-compose port nginx 80)//0[.:]/}"

If the dependencies change you will need to rebuild the container with ./bin/rebuild [container], but otherwise your changes should propagate instantly. If you find that changes aren't propagating, try an rsync-based solution such as Dinghy (OS X)

=====

ProTips

* Make sure to keep the `$ docker-compose up web` running
  1. Debugging (read this if you have any errors or just want to check everything installed correctly)

    • Type this in terminal:
    echo $DOCKER_HOST

    The output should be something like this: tcp://192.168.99.100:2376 (yours might be diffrent numbers)

    • Type this in terminal next:
    echo $SHELL

    The output should say: /bin/bash

    • Lastly type this:
    docker-machine ls

    The output should look something like this:

    NAME ACTIVE DRIVER STATE URL SWARM

    docker-machine-dev virtualbox Running tcp://192.168.99.100:2376

    • What is important is that your name is the same (and there might be a little '.' to show its active)