This is a "boilerplate" go microservice with following example showcase features:
- CI/CD Setup
- Config Management
- Secrets Management
- Database Access
- Go Private Modules
- sre-go-logger
- idpadapter
- Create a new repo from the template sre-go-helloworld repo by clicking on the
Use this template
button on the upper right. - Clone the new repo to your local development environment.
git clone [email protected]:eti/<YOUR_APP_NAME>.git
cd
into the repo and run therunme.sh
to reconfigure the repo for your new application../runme.sh
- The previous step should have created a new branch (named
<your app name>-<random string>
). Create a PR from that branch and merge it. - Reach out to SRE team in the Ask ET&I SRE space to request a fully automated CI/CD pipeline for your new application
After the SRE creates the CI/CD pipeline and deploys your application, you can navigate to https://<YOUR_APP_NAME>.int.dev.eticloud.io/
to see your deployed application.
See the Troubleshooting page if you run into any issues.
How to retrieve artifactory encrypted password
export ARTIFACTORY_USER=<YOUR USERNAME>
export ARTIFACTORY_PASSWORD=<YOUR Encrypted Artifactory Password>
make
./build-docker.sh
docker run --name postgres -e POSTGRES_DB=helloworld -e POSTGRES_PASSWORD=strongpassword -d postgres
docker run -it -p 5000:5000 -e DB_CONNECTION_INFO=/tmp/dbconfig.json -e DB_NAME=helloworld -v $PWD/build/:/tmp/ --link postgres:postgre sre-go-helloworld
Skip this step if is not building on Lab VM (i.e. rcdn6-vmXX-YYY).
export DOCKER_BLD_ARGS="https_proxy=http://proxy.esl.cisco.com:80"
Create a credentials file for artifactory in ~/.nyota/credentials with content:
artifactory_user=yourCECID
artifactory_password=yourPASSWORD
and run after:
chmod 400 ~/.nyota/credentials
From the main directory, run:
ln -s $(pwd)/githooks/pre-commit .git/hooks/pre-commit`
This will contain the libraries internal to the app
If you need the swag tool, install it using command:
go get -u github.com/swaggo/swag/cmd/swag
This contains the rest api specifications in JSON/ yaml. This specifications would be used for api documentation. Generated from handler comments using command:
swag init --parseDependency --parseInternal
Then, if you want to play with the API, run the swagger docker container using:
docker run --name swagger_ui -p 8080:8080 -d swaggerapi/swagger-ui
Open a browser to the swagger UI http://localhost:8080/, put http://localhost:5000/docs in the input field and click on explore button.
This contains all the tests and dependent mock functions.
This contains system and container orchestration, deployment configurations and templates.
This will have git hooks e.g. go_fmt, staticcheck etc.
This is the main package for the microservice.