A generator for easy setup/scaffolding of new services, written in bash.
A set of modules is combined to create a service based on your specific needs.
create-service
is extensible and new modules can be added and customized.
Simply make a fork and add/change it. See the modules section for details on each module.
Features in short:
- Generated README.md
- Koshu setup (taksrunner)
- Git setup
- Github setup
- Buildkite setup
- Docker setup
- jq (https://stedolan.github.io/jq/)
- sed
- grep
- curl (module)
- git (module)
Clone this repository and run:
./create-service <name>
You may specify a set of defaults to use when running create-service
by creating a config.json
in the create-service
repository root. This file is by default ignored (.gitignore) and not checked as it may contain secrets.
bash <(curl -s https://raw.githubusercontent.com/dotnetmentor/create-service/master/create-service-docker)
A good place to start is by looking at the existing modules. There is also a module-template located in the modules directory that can act as a base for new modules. To follow is a set of conventions/best practices to consider when creating/modifying a module.
- All modules should be idempotent to avoid side effects when running the script multiple times.
- Environment variables made available to other modules must be prefixed
CS_MODULENAME_
. - Environment variables made available to other modules must be defined in
<module>:init
usingcs_export
. - Environment variables set at runtime (in
module:exec
) must first be defined in<module>:init
usingcs_export
. - All functions in a module.sh must be prefixed with
<module>:
to avoid function collision (ie:koshu:internal_func
).
- Make it work on windows
- Ask, show, execute
- Add support for "dry-run" (A default value of indicates that the value will be set at runtime)
- Add support for verbose flag (print content of module readme files)
- Run in docker using mounted volumes (to handle pre-requisites like jq and envsubst)?
- Additional language specific features