This project contains service that provides API to run bash scrips.
Project has configured swagger API documentation, that can be accessed by endpoint GET /swagger/
The project is in ready for deployment.
To download use:
git clone https://github.com/Bazhenator/bashExecAPI.git
Warning
You should use Manual deployment if you want to run application without Docker/make etc.
Important
Follow this instruction to install PostgreSQL on (Linux).
sudo apt update
sudo apt install postgresql postgresql-contrib
Check PostgreSQL status:
service postgresql status
Important
To install pgAdmin4 (web/desktop) version on Linux follow this link:
Create new server bash with database, user and password specified in configs/config.yaml
Create new table 'commands', or put schema from init.sql in query of bash_db.
Warning
If your server's host or port differs from data in ./configs/config.yaml, please, replace it with actual. (postgres:5432 -> localhost:5432)
Important
To run application:
cd cmd
go run server.go
You can use docker deployment, to prepare docker images use:
Important
You should have installed Docker and docker-compose on your machine
Caution
This will prune all unused images in the end of build to free up space after multistage Docker image build
make build-images
Then you can simply run
make start-dev
to run docker container using docker-compose, and
make stop-dev
to stop docker container
This will run unit tests and update link for coverage bage in README
make unit-test
You can regenerate mocks with
make gogen
You can build executable files with
make build-bash
Executables will be in /bin folder
Important
Project uses swaggo, so you should install it
To update swagger documentation after adding new endpoints use:
make swag-bash