This application is for operating messages based on rest api with simple user authentication, registration and login. It is easy to deploy application on aws with only 2 steps.
- If you want to deploy application on aws, just need to run deploy script in terraform.
- If you want to test and build the project locally, you can just run go build.
Please refer steps below for details.
What things you need to install the software and how to install them
1. You need to install terraform locally and you can download from (https://www.terraform.io/downloads.html). Download corresponding package based on your local system.
2. You must have a ssh key pair for deployment.
3. You must have a aws account associated with deployment.
4. You must have golang and go dep package installed for build this project.
- Deploy application
-
Have your aws access key and access secret key ready and use them to change the default value in /terraform/userVariables.tf file. Also specify your ssh private key location for default value of variable 'privateKeyFilename' in the same file. (note you can also change the openshift username and password as you want.)
-
Go to /terraform and run deploy.sh script without passing any arguments.
-
The installation will take about 30 mins for deploying everything(including provisioning aws resources, installing openshift, configuring openshift, creating database pod, creating application pod and so on.)
-
After installation and seeing the message "You have successfully deployed application on aws in openshift cluster.", then you are ready to go. You can check your master public dns in aws or you can just run:
terraform output master-public_dns
-
The openshift management console url is (https://:8443), username and password are provided by you in userVariables.tf file.
-
The application accessing url is (http://). You can only create, view or delete message after you have register an account or login.
- Build from the source
- Download project into your GOPATH by running
git clone [email protected]:xqianwang/micro-message.git
- Install necessary dependencies by running command in project base directory:
dep ensure -vendor-only
- If you can see vendor folder in project base already, then you don't need to run previous step.
Go to project base folder and run command below:
go test -v ./...
Micro-Message application allows users to interact with application by REST API or UI. In terms of REST API:
- You can get all messages by running:
curl -X GET -H "Accept: application/json" http://<public-dns>/messages
- You can get query 1 message by running:
curl -X GET -H "Accept: application/json" http://<public-dns>/messages/view/<:messageid>
- You can delete a message by running:
curl -X DELETE -H "Accept: application/json" http://<public-dns>/messages/<:messageid>
- You can create a new message by running:
curl -X POST -d "title=8&content=8" -H "Accept: application/json" http://<public-dns>/messages/create
Also you can absolutely interact with application through UI!
Micro-Message's infrastructure has a few parts:
- Backend database: Postgresql 9.6
- REST API: golang
- Template handler: golang template
- Deployment and aws resource provisioning: terraform
- Dockerization: docker
- Container management platform: Openshift origin 3.9
- UI: Bootstrap
- Framework: golang gin openshift-aws
You can refer previous steps for deployment.
For the versions available, see the tags on this repository.
- Xueqian Wang - Initial work - You can contact with me by email: [email protected]
See also the list of contributors. There are 2 contributors, both of them are my accounts because I have 1 working account in my company computer and 1 private account in my private computer.
This project is licensed under the MIT License - see the LICENSE.md file for details