database
所属分类:微服务
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2023-08-06 09:59:50
上 传 者:
sh-1993
说明: HTTP Web套接字上的无服务器数据库服务器
(Serverless database server over HTTP websocket)
文件列表:
Dockerfile (253, 2023-12-09)
LICENSE (34523, 2023-12-09)
command.go (291, 2023-12-09)
command_test.go (210, 2023-12-09)
database.go (1511, 2023-12-09)
database_test.go (2596, 2023-12-09)
dump.go (1507, 2023-12-09)
dump_test.go (2178, 2023-12-09)
go.mod (214, 2023-12-09)
go.sum (644, 2023-12-09)
index.html (764, 2023-12-09)
query.go (1629, 2023-12-09)
query_test.go (745, 2023-12-09)
websocket.go (2918, 2023-12-09)
websocket_test.go (4711, 2023-12-09)
# database
Serverless database server over HTTP websocket
## Usage
### Docker compose
```
services:
web:
build: .
environment:
DATABASE_SOCKET: ws://db:8080/database
db:
image: "marekm43/database"
```
By default, it uses port `8080`, this can be changed by setting up `PORT` env. Dumps are stored at `/app/database.txt`.
See [websocket_test.go](https://github.com/marekm4/database/blob/master/websocket_test.go) for more examples.
### Queries
#### Get value
```
select username
```
#### Set or update value
```
update username john
```
#### Set or increment counter
```
increment money 100
```
#### Append element to collection
```
append orders pizza
```
## FAQ
### What is it?
It's a database server that is adapted to run as a low cost "stateless" web service in the cloud.
### Why does it exist?
Most cloud providers allow you to run HTTP stateless service for free, but database servers, even cheapest ones, are at least a few $ per month.
### How does it work?
1. On startup, it downloads database files from cost-efficient storage, like S3
2. Then it runs database engine on it
3. When service is going to be redeployed files are send back to S3
### Which cloud providers are supported?
For now it's GCP Cloud Run only, AWS and Azure are on the way.
### Is there any SDK?
Unfortunately not for now. However, it should be straightforward to implement a basic client.
### Should I use it in production?
No.
近期下载者:
相关文件:
收藏者: