https://github.com/olegakbarov/go-web-app
Core API and Docker entry point repo
https://github.com/olegakbarov/go-web-app
docker go golang nginx postgresql
Last synced: 3 months ago
JSON representation
Core API and Docker entry point repo
- Host: GitHub
- URL: https://github.com/olegakbarov/go-web-app
- Owner: olegakbarov
- Created: 2017-03-05T13:57:04.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-17T17:40:43.000Z (about 9 years ago)
- Last Synced: 2025-03-22T00:27:26.596Z (over 1 year ago)
- Topics: docker, go, golang, nginx, postgresql
- Language: Go
- Homepage:
- Size: 65.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
### io.confs.core
Dockerized API service
### Prerequisites
- Go
- Docker
### Start
### Develop
TODO
ORM: https://upper.io/db.v2/examples
### Ports cheatsheet
Inside containers:
```
1337 — frontend
3000 — grafana
6666 — postgres
8086, 8083 — influxdb
8080 — cadvisor
9999 — api
```
Exposed:
### Linking containers caveats
```yaml
links:
- api:api
```
This creates environment variables in proxy container, with ip and port info for go container, also creates entries in /etc/hosts with ip info [other container]:[alias in this container]
```yaml
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
```
- Conntect host's `./nginx.conf` with container's `nginx.conf`
- `:ro` means read only perms in container
### Docker tips
Run Docker image with port-forwarding: `docker run -it -p 8080:8080 confsio_img`
Inspect container's ENV variables: `docker inspect -f "{{ .Config.Env }}" container-id`
Copy file from container to host: `docker cp :/file/path/within/container /host/path/target`
### Docker Monitoring
https://www.brianchristner.io/how-to-setup-docker-monitoring/
### $ Curls
#### edit :id & :user-id
```
curl -H "Content-Type: application/json" -X PUT -d '{ "name": "UPDATED CONF", "start_date": "2017-10-19T08:00:00Z", "end_date": "2017-10-22T08:00:00Z", "description": "yolo", "picture": null, "country": "USA", "city": "SF", "address": "Rodeo drive 1", "category": "big data", "tickets_available": false, "discount_program": false, "min_price": 0, "max_price": 100, "facebook": "", "youtube": "", "twitter": "", "details": {}, "id": :id, "added_by": :user-id}' http://localhost:9999/api/v1/conf/:id
```
#### create
```
curl -H "Content-Type: application/json" -X POST -d '{ "name": "CREATED!CONF", "start_date": "2017-10-19T08:00:00Z", "end_date": "2017-10-22T08:00:00Z", "description": "yolo", "picture": null, "country": "USA", "city": "SF", "address": "Rodeo drive 1", "category": "big data", "tickets_available": false, "discount_program": false, "min_price": 0, "max_price": 100, "facebook": null, "youtube": null, "twitter": null, "details": {}}' http://localhost:9999/api/v1/conf
```