cleanup config files and messages.
|
@ -4,4 +4,22 @@ cd frontend
|
|||
npm run dist
|
||||
go mod vendor
|
||||
go run backend/cmd/fasten/fasten.go start --config ./config.example.yaml --debug
|
||||
|
||||
docker build -t fasten-couchdb -f docker/couchdb/Dockerfile .
|
||||
docker run --rm -it -p 5984:5984 -v './.couchdb/data:/opt/couchdb/data' fasten-couchdb
|
||||
```
|
||||
|
||||
# Docker
|
||||
``
|
||||
|
||||
- http://localhost:9090/web/dashboard - WebUI
|
||||
- http://localhost:9090/database - CouchDB proxy
|
||||
- http://localhost:5984/_utils/ - CouchDB admin UI
|
||||
|
||||
# Credentials
|
||||
- Couchdb:
|
||||
- username: `admin`
|
||||
- password: `mysecretpassword`
|
||||
- WebUI:
|
||||
- username: `testuser`
|
||||
- password: `testuser`
|
||||
|
|
|
@ -25,7 +25,6 @@ func (c *configuration) Init() error {
|
|||
c.SetDefault("web.listen.host", "0.0.0.0")
|
||||
c.SetDefault("web.listen.basepath", "")
|
||||
c.SetDefault("web.src.frontend.path", "/opt/fasten/web")
|
||||
c.SetDefault("web.database.location", "/opt/fasten/db/fasten.db") //TODO: should be /opt/fasten/fasten.db
|
||||
|
||||
c.SetDefault("web.couchdb.scheme", "http")
|
||||
c.SetDefault("web.couchdb.host", "localhost")
|
||||
|
|
|
@ -12,24 +12,13 @@ import (
|
|||
)
|
||||
|
||||
func NewRepository(appConfig config.Interface, globalLogger logrus.FieldLogger) (DatabaseRepository, error) {
|
||||
//backgroundContext := context.Background()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Gorm/SQLite setup
|
||||
// Couchdb setup
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
globalLogger.Infof("Trying to connect to sqlite db: %s\n", appConfig.GetString("web.database.location"))
|
||||
|
||||
// When a transaction cannot lock the database, because it is already locked by another one,
|
||||
// SQLite by default throws an error: database is locked. This behavior is usually not appropriate when
|
||||
// concurrent access is needed, typically when multiple processes write to the same database.
|
||||
// PRAGMA busy_timeout lets you set a timeout or a handler for these events. When setting a timeout,
|
||||
// SQLite will try the transaction multiple times within this timeout.
|
||||
// fixes #341
|
||||
// https://rsqlite.r-dbi.org/reference/sqlitesetbusyhandler
|
||||
// retrying for 30000 milliseconds, 30seconds - this would be unreasonable for a distributed multi-tenant application,
|
||||
// but should be fine for local usage.
|
||||
|
||||
couchdbUrl := fmt.Sprintf("%s://%s:%s", appConfig.GetString("web.couchdb.scheme"), appConfig.GetString("web.couchdb.host"), appConfig.GetString("web.couchdb.port"))
|
||||
|
||||
globalLogger.Infof("Trying to connect to couchdb: %s\n", couchdbUrl)
|
||||
|
||||
database, err := kivik.New("couch", couchdbUrl)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to connect to database! - %v", err)
|
||||
|
@ -44,7 +33,7 @@ func NewRepository(appConfig config.Interface, globalLogger logrus.FieldLogger)
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to authenticate to database! - %v", err)
|
||||
}
|
||||
globalLogger.Infof("Successfully connected to coubdb: %s\n", couchdbUrl)
|
||||
globalLogger.Infof("Successfully connected to couchdb: %s\n", couchdbUrl)
|
||||
|
||||
deviceRepo := couchdbRepository{
|
||||
appConfig: appConfig,
|
||||
|
|
|
@ -32,6 +32,8 @@ func CouchDBProxy(c *gin.Context) {
|
|||
req.URL.Host = remote.Host
|
||||
log.Printf(c.Param("proxyPath"))
|
||||
req.URL.Path = strings.TrimPrefix(c.Param("proxyPath"), "/database")
|
||||
|
||||
//todo: throw an error if not a user DB.
|
||||
}
|
||||
|
||||
proxy.ServeHTTP(c.Writer, c.Request)
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
version: 1
|
||||
|
||||
web:
|
||||
jwt:
|
||||
# used to encrypt/validate JWT session key (used for authentication)
|
||||
encryptionkey: 'changethissupersecretkey'
|
||||
listen:
|
||||
port: 8080
|
||||
host: 0.0.0.0
|
||||
|
|
|
@ -11,5 +11,6 @@ RUN curl https://github.com/just-containers/s6-overlay/releases/download/v1.21.8
|
|||
|
||||
COPY /docker/couchdb/local.ini /opt/couchdb/etc/
|
||||
COPY /docker/rootfs /
|
||||
RUN rm -rf /etc/services/fasten #delete the fasten app from the couchdbase container.
|
||||
|
||||
ENTRYPOINT ["/init"]
|
||||
|
|
Before Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 198 KiB |
Before Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 226 KiB |
Before Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 187 KiB |
Before Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 194 KiB |
Before Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 140 KiB |
Before Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 206 KiB |
Before Width: | Height: | Size: 171 KiB |
Before Width: | Height: | Size: 137 KiB |
Before Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 173 KiB |
Before Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 175 KiB |
Before Width: | Height: | Size: 207 KiB |
Before Width: | Height: | Size: 172 KiB |
Before Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 172 KiB |
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="152" height="152" viewBox="0 0 152 152"><g fill-rule="evenodd"><g id="temple" fill="#efebf5" fill-opacity="0.2"><path d="M152 150v2H0v-2h28v-8H8v-20H0v-2h8V80h42v20h20v42H30v8h90v-8H80v-42h20V80h42v40h8V30h-8v40h-42V50H80V8h40V0h2v8h20v20h8V0h2v150zm-2 0v-28h-8v20h-20v8h28zM82 30v18h18V30H82zm20 18h20v20h18V30h-20V10H82v18h20v20zm0 2v18h18V50h-18zm20-22h18V10h-18v18zm-54 92v-18H50v18h18zm-20-18H28V82H10v38h20v20h38v-18H48v-20zm0-2V82H30v18h18zm-20 22H10v18h18v-18zm54 0v18h38v-20h20V82h-18v20h-20v20H82zm18-20H82v18h18v-18zm2-2h18V82h-18v18zm20 40v-18h18v18h-18zM30 0h-2v8H8v20H0v2h8v40h42V50h20V8H30V0zm20 48h18V30H50v18zm18-20H48v20H28v20H10V30h20V10h38v18zM30 50h18v18H30V50zm-2-40H10v18h18V10z"/></g></g></svg>
|
Before Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 241 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 172 KiB |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 1.7 KiB |