- Bash
- Docker
- Git
To start working with bootstrap simply clone bootstrap repository with our repository upstream renamed to upstream. It will help you get the updates from our repository while keeping your changes for your project.
git clone git@github.com:SwingDev/bootstrap-bootstrap.git . -o upstream
Script updates itself automatically on a daily basis.
The repository consists of three main components:
modules.txt
- which points to all dependent repositoriesdocker-compose.yml
- which describes how the components should build and interactboostrap.sh
- main script for managing and running the project
To fetch all dependencies simply run:
./bootstrap.sh
To run the project simply use up command:
./bootstrap.sh up
Optionally you can pass a list of services to be rebuilt:
./bootstrap.sh up api web
You can just build the services without starting them up:
./bootstrap build
As with other commands you can specify which services to build
./bootstrap build api
To see the logs use the logs
command:
./bootstrap.sh logs
To see logs from only a couple of services, pass their names as arguments:
./bootstrap.sh logs api web
You can run arbitrary commands within running containers via:
./bootstrap.sh exec api /bin/sh
The above example will start a shell on the api service.
To stop the project simply use down command:
./bootstrap.sh down
Stopping will delete all containers and all network leftovers, so make sure to mount everything you need persisted.
To check on which branch each of the modules is, simply use the following command:
./bootstrap.sh branch
# Example of the output
frontend: master
backend: feature/#54
pdf-generator: master
To check status of all the modules, use the following command:
./boostrap.sh status
# Example of the output
frontend:
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
backend:
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
new-file.txt
nothing added to commit but untracked files present (use "git add" to track)
pdf-generator:
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
It is possible to specify custom docker-compose.yml location. It might be useful if you have few configurations with different settings - for example configuration with frontend live-reload, backend live-reload or verbose output or different configuration for your CI with different ports binding. To do that, use -c
parameter for any command:
./bootstrap.sh -c docker-compose.frontend.yml up
To add new dependency, simply use:
./bootstrap.sh add-module <repository-url> <directory>
This will add new line to modules.txt
, fetch the repository and add its directory to bootstrap's .gitignore
.
If fetched repository constains .docker-compose.template.yml
, it will be appended to your docker-compose.yml
file.
In future versions we plan to extend this with templating mechanism, for now it is just pasting the content with the proper indentation (name of the container is set to the name of the directory you provide for the command).
In the template, you can use <PROJECT_DIR>
template string which will be replaced with a directory name where the project will be fetched. You can use it to setup docker volumes correctly for example.
The tool is an Open Sourced version of the tool we are using internally in SwingDev.
We are open to your pull requests! If you want to improve the project, simply create a new pull request describing in detail new functionality, including update to this readme.
This software is provided under MIT license.