/bit-docker

A dockerfile setup to run your own Bit server.

Primary LanguageDockerfileOtherNOASSERTION

Bit-docker

This repo is only used for legacy (not harmony) scopes. for harmony please use https://github.com/teambit/bit/blob/master/scripts/docker-teambit-bit/README.md

A dockerfile setup to run your own Bit server.
If you want to setup a bare-bone Bit remote server without Docker, please refer to this guide.

Getting started

  1. Clone this repository.
  2. Build image and run server.
    $ docker build . -t bit
    $ docker run --rm --name bit -d -P  --volume ~/.ssh/id_rsa.pub:/tmp/id_rsa.pub bitcli/bit-docker
    $ docker port bit 22
  3. Configure workspace to use the server.
    $ bit remote add ssh://root@<hostname>:22:/tmp/scope -g
  4. Export components to a Bit server.
    $ bit export scope
  5. Import components from a Bit server.
    $ bit import scope.<component-name>
  6. Stop server
    $ docker kill bit

Troubleshooting

Unable to connect to server

  • See if container is running.
    $ docker ps --all | grep bit
  • Make the SSH port is configured correctly.
    $ docker port bit 22
  • See that your server is configured for your workspace.
    $ bit remote

Unable to import/export

Bit uses SSH for networking. This setup mounts your user account SSH keys.
To manually set up authentication, or authenticate another key:

  1. Copy a public key to the container.
    $ docker cp ~/.ssh/id_rsa bit:/root/.ssh/
  2. Run bash on the container.
    $ docker exec -it bit /bin/bash
  3. Configure the container's SSH daemon with the new key (run from container's bash).
    $ bit config ssh_key_file /root/.ssh/id_rsa

Run bash on the container

When you need to run any command on the Bit server, you first need to get bash on the container:

$ docker exec -it bit /bin/bash

Now each command you run, runs on the server.

Tail server logs

To run the tail command and get the server's logs, you should first get bash on the container. Then tail Bit's log:

$ tail -f /root/Library/Caches/Bit/logs/debug.log

For maintainers - Run server from a local build

After building Bit from source code, run this command:

$ docker run --rm --name bit -d -P  --volume <path to git-clone of bit>:/bit-bin  --volume ~/.ssh/id_rsa.pub:/tmp/id_rsa.pub --env 'DEVELOPMENT=true' bitcli/bit-docker

Contributing

Contributions are always welcome, no matter how large or small.

License

MIT License.