####Note One can use the installer here to install all the dependencies together with the micro-service by configuring using the provided installer links.
- A cockroachdb instance for persistance. A systemd installer can be found here: https://github.com/tomogoma/cockroach-installer
- consul for service discovery. A systemd installer can be found here: https://github.com/tomogoma/consul-installer
- micro as a gateway and load balancer. A systemd installer can be found here: https://github.com/tomogoma/micro-installer
The app can either be installed or run directly.
- install
make install
- uninstall
make uninstall
Edit the configuration file. It is located at
/etc/<name>/<name><version>.conf.yml
after installation, and is documented for required values.
run the app with --help
flag for options on custom configuration file and
other options.
This section will be managed by SystemD if the respective installers were used.
-
Make sure CockroachDB is running
- Lack or misconfiguration of this will not stop the micro-service from starting, but requests will yield internal server errors until a connection to the db is established.
-
Start consul
-
Recommended: Start micro api with the proxy handler for access to the http API.
micro api --handler=proxy
More here: https://github.com/micro/examples/tree/master/greeter/api/rest
You can set the systemd micro binary to use the proxy handler if installed using the systemd installer by following these steps:
- Open the unit file using your editor of choice
and append
nano /etc/systemd/system/microapi.service
--handler=proxy
to theExecStart=...micro api
entry to end up with something like:ExecStart=/usr/local/bin/micro api --handler=proxy
- Reload the SystemD daemon
systemctl daemon-reload
- Restart micro api
systemctl restart microapi
- Open the unit file using your editor of choice
-
Start the micro-service using one of the following methods:
- Using systemd after installation:
sudo systemctl start <name><version>
- Running directly from the repo folder
cd bin ./app
- Using the go toolchain e.g.
or
go build
...then executing the binarygo install
- Using systemd after installation:
The API docs for service access can be accessed on your browser:
-
Via
micro api
with proxy handlerhttp://localhost:8082/<version>/<name>/docs
NOTE The app has to be running for this option to work.
-
Static htm site in install/docs.