Native binaryLink
Daptin is available as a native binary. You can download the binary for the following os from github releases
- Windows 32/64
- OS X 64
- Linux 32/64/arm/mips
https://github.com/daptin/daptin/releases
Execute ./daptin
to run daptin.
It will create a sqlite database on the disk and start listening on port 6336.
Arguments:
Argument | Definition |
---|---|
port | set the port to listen |
db_type | mysql/postgres/sqlite3 |
db_connection_string | SQLite: test.db MySql: <username>:<password>@tcp(<hostname>:<port>)/<db_name> Postgres: host=<hostname> port=<port> user=<username> password=<password> dbname=<db_name> sslmode=enable/disable |
Heroku deploymentLink
Heroku is the best way to test out a live instance of daptin. Daptin has a very low memory footprint and can run smoothly even on heroku's smallest instance.
Note: Heroku puts instances to sleep after 30 minutes of idleness, which will erase all the data. It will behave like a fresh instance when it wakes up. You can subscribe to their minimum paid plan to remove this sleep due to idleness.
Docker imageLink
Deploy the docker image
Start daptin
on your machine using docker
docker run -p 8080:8080 daptin/daptin
https://hub.docker.com/r/daptin/daptin/
Docker-composeLink
Docker compose is a great tool to bring up a mysql/postgres backed daptin instance
version: '3'
services:
web:
image: daptin/daptin
ports:
- "8090:8080"
restart: always
environment:
DAPTIN_PORT: '8080'
DAPTIN_DB_TYPE: 'mysql'
DAPTIN_DB_CONNECTION_STRING: 'dev:dev@tcp(mysqldb:3306)/daptin'
depends_on:
- mysqldb
mysqldb:
image: mysql
container_name: ${MYSQL_HOST}
restart: always
env_file:
- ".env"
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
ports:
- "8989:3306"
volumes:
- "./data/db/mysql:/var/lib/mysql"
Kubernetes deploymentLink
Daptin can be infinitely scaled on kubernetes
Example
apiVersion: v1
kind: Service
metadata:
name: daptin-instance
labels:
app: daptin
spec:
ports:
- port: 8080
selector:
app: daptin
tier: production
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: daptin-daptin
labels:
app: daptin
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: daptin
tier: testing
spec:
containers:
- image: daptin/daptin:latest
name: daptin
args: ['-db_type', 'mysql', '-db_connection_string', 'user:password@tcp(<mysql_service>:3306)/daptin']
ports:
- containerPort: 8080
name: daptin
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: daptin-test
spec:
rules:
- host: hello.website
http:
paths:
- backend:
serviceName: daptin-testing
servicePort: 8080
DatabaseLink
Daptin can use one of the following database for data persistence
- Mysql
- Postgres
- SQLite [Default]
If nothing specified, a sqlite database is created on the local file system and is used for all purposes. (uploads/blobs are not stored in database)
You can customise the database connection properties when starting daptin
MySQLLink
To use mysql, start daptin as follows
./daptin -db_type=mysql -db_connection_string='<username>:<password>@tcp(<hostname>:<port>)/<db_name>'
PostgreSQLLink
./daptin -db_type=postgres -db_connection_string='host=<hostname> port=<port> user=<username> password=<password> dbname=<db_name> sslmode=enable/disable'
SQLiteLink
By default a "daptin.db" file is created to store data
./daptin -db_type=sqlite -db_connection_string=db_file_name.db
Deploy and get startedLink
Deployment preference | Getting started |
---|---|
Heroku | |
Docker | docker run -p 8080:8080 daptin/daptin |
Kubernetes | Service & Deployment YAML |
Development | go get github.com/daptin/daptin |
Linux (386/amd64/arm5,6,7) | Download static linux builds |
Windows | go get github.com/daptin/daptin |
OS X | go get github.com/daptin/daptin |
Load testing | Docker compose |
Raspberry Pi | Linux arm 7 static build |
PortLink
Daptin will listen on port 6336 by default. You can change it by using the following argument
-port=8080
RestartLink
Daptin relies on self re-configuration
to configure new entities and APIs and changes to the other parts of the ststem. As soon as you upload a schema file, daptin will write the file to disk, and reconfigure
itself. When it starts it will read the schema file, make appropriate changes to the database and expose JSON apis for the entities and actions.
You can issue a daptin restart from the dashboard. Daptin takes about 15 seconds approx to start up and configure everything.