Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hiconvo/api
Convo's RESTful API
https://github.com/hiconvo/api
api docker golang
Last synced: 5 days ago
JSON representation
Convo's RESTful API
- Host: GitHub
- URL: https://github.com/hiconvo/api
- Owner: hiconvo
- Created: 2019-05-30T00:34:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-22T16:36:00.000Z (over 3 years ago)
- Last Synced: 2024-08-01T12:23:23.561Z (3 months ago)
- Topics: api, docker, golang
- Language: Go
- Homepage:
- Size: 843 KB
- Stars: 47
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - hiconvo/api - Convo's RESTful API (golang)
README
# Convo API
[![CircleCI](https://img.shields.io/circleci/build/github/hiconvo/api?label=circleci)](https://circleci.com/gh/hiconvo/api) [![codecov](https://img.shields.io/codecov/c/gh/hiconvo/api)](https://codecov.io/gh/hiconvo/api) [![goreportcard](https://goreportcard.com/badge/github.com/hiconvo/api)](https://goreportcard.com/badge/github.com/hiconvo/api)
The repo holds the source code for Convo's RESTful API. Learn more about Convo at [convo.events](https://convo.events).
## Development
We use docker based development. In order to run the project locally, you need to create an `.env` file and place it at the root of the project. The `.env` file should contain a Google Maps API key, Sendgrid API key, and a Stream API key and secret. It should look something like this:
```
GOOGLE_MAPS_API_KEY=
SENDGRID_API_KEY=
STREAM_API_KEY=
STREAM_API_SECRET=
```If you don't include this file, the app will panic during startup.
After your `.env` file is ready, all you need to do is run `docker-compose up`. The source code is shared between your machine and the docker container via a volume. The default command runs [`air`](https://github.com/cosmtrek/air), a file watcher that automatically compiles the code and restarts the server when the source changes. By default, the server listens on port `:8080`.
### Running Tests
Run `docker ps` to get the ID of the container running the API. Then run
```
docker exec -it go test ./...
```Be mindful that this command will *wipe everything from the database*. There is probably a better way of doing this, but I haven't taken the time to improve this yet.
## Maintenance Commands
```
# Update datastore indexes
gcloud datastore indexes create index.yaml# Delete unused indexes
gcloud datastore cleanup-indexes index.yaml# Update cron jobs
gcloud app deploy cron.yaml
```## One-Off Commands
```
# Get credentials to connect to the production database. [DANGEROUS]
gcloud auth application-default login# Run the command. Example:
go run cmd/migrate-message-timestamps-and-photos/main.go --dry-run# Clean up. [ALWAYS REMEMBER]
gcloud auth application-default revoke
```## Architecture
![Architecture](architecture.jpg)