Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amirhnajafiz-university/s7cc02
Second project of Cloud Computing course.
https://github.com/amirhnajafiz-university/s7cc02
cryptocurrency cryptomarket deployment docker dockerfile fiber-framework go golang kubernetes
Last synced: 3 days ago
JSON representation
Second project of Cloud Computing course.
- Host: GitHub
- URL: https://github.com/amirhnajafiz-university/s7cc02
- Owner: amirhnajafiz-university
- License: mit
- Created: 2022-11-27T15:08:25.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T06:11:54.000Z (almost 2 years ago)
- Last Synced: 2024-11-06T22:24:58.734Z (about 2 months ago)
- Topics: cryptocurrency, cryptomarket, deployment, docker, dockerfile, fiber-framework, go, golang, kubernetes
- Language: Go
- Homepage:
- Size: 54.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
S7CC02
Cloud Computing second project. Create, Dockerise, and Deploy an entire cryptometer service
with Golang, Docker, and Kubernetes. In this
project I build a Golang service with _Fiber_ framework to get crypto market values and cache them into a Redis database.## How to run?
Run the application without any configs on your local.
```shell
go build -o main
./main
```Make a copy of config file:
```shell
cp config.example.yml config.yml
```Update config values:
```yaml
port: 6030crypto:
name: "bitcoin"
value: "usd"storage:
host: "cryptometer-redis-cluster:6379"
password: ""
timeout: 5
```## Endpoints
```json
[
{
"endpoint": "/api",
"method": "get",
"response": [
{
"code": "200",
"body": {
"name": "bitcoin",
"value": 98.202
}
},
{
"code": "500",
"body": "Error"
}
]
},
{
"endpoint": "/hlz",
"method": "get",
"response": [
{
"code": "200",
"body": "OK [time]"
},
{
"code": "500",
"body": "Error"
}
]
}
]
```## Docker
Use the following image:
```shell
docker pull amirhossein21/cryptometer:v0.2
```Execute on container:
```shell
docker run --network=cryptonet --name cryptometer -d -p 6030:6030 --mount type=bind,source="$(pwd)"/config.yml,target=/app/config.yml amirhossein21/cryptometer:v0.2
```## Kubernetes
Configmap:
```yaml
apiVersion: v1
kind: ConfigMapmetadata:
name: cryptometer-configmapdata:
config.yml: |+
port: 6030
crypto:
name: "bitcoin"
value: "usd"
storage:
host: "redis-service:6379"
password: "12345678"
timeout: 5
```Deployment:
```yaml
apiVersion: apps/v1
kind: Deploymentmetadata:
name: cryptometerspec:
replicas: 2
selector:
matchLabels:
app: cryptometer
template:
metadata:
labels:
app: cryptometer
spec:
containers:
- name: cryptometer
image: amirhossein21/cryptometer:v0.2
ports:
- containerPort: 6030
name: cryptometer
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
volumeMounts:
- name: config
mountPath: /app/config.yml
subPath: config.yml
volumes:
- name: config
configMap:
name: cryptometer-configmap
```Service:
```yaml
apiVersion: v1
kind: Servicemetadata:
name: cryptometerspec:
selector:
app: cryptometer
ports:
- protocol: TCP
port: 6030
targetPort: 6030
```