behoof4mind / myservice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Myservice

Overview

This is simple app to add and get "users"
Backend: Golang with few frameworks: go-macaron, sirupsen/logrus, jmoiron/sqlx
Frontend: Bootstrap 4.3.1 + jquery 3.6.0
Build: Go binary / Docker
CI/CD: GitHub actions
Environment: EC2 instances with ELB + Mysql-RDS (Infrastructure diagram) test

How to start

  1. Specify environment variables - APP_VERSION, DB_URL, DB_USERNAME, DB_PASSWORD, DOCKER_REGISTRY_URL
#example values:
APP_VERSION=0.2.0
DB_URL=localhost:3306
DB_USERNAME=root
DB_PASSWORD=supersecret
  1. Start mysql instance
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=${DB_PASSWORD} -v ${PWD}:/var/lib/mysql -p 3306:3306 mysql:5.7.33 --innodb_rollback_on_timeout=1
  1. Build and run
docker build -t myservice:${APP_VERSION} .
docker run --name myservice -p 80:4000 myservice:${APP_VERSION}
  1. Send GET / POST requests to check
# create user example
curl -XPOST http://localhost/api/v1/users -H "Content-Type: application/json" -d '{"name":"test2","email":"test@mail.com"}'
# get user by name example
curl -XGET http://localhost/api/v1/users?name=test2

Contributing

Thanks for considering contributing! There’s information about how to get started with Myservice here.

When PR will be created - new AWS test environment will be ready in around 20 minutes. You will get link to test web service from github-bot in PR comments.

After closing PR by any reason - test environment will be destroyed

License

The MIT License (MIT)

Copyright © 2021 Denis Lavrushko

About

License:MIT License


Languages

Language:HTML 53.0%Language:Go 27.1%Language:JavaScript 9.6%Language:Dockerfile 4.4%Language:HCL 4.3%Language:Makefile 1.6%