The ecosystem contains 3 essential parts in Visual Knight.
- The database
- The web app
- The api backend
We use for our data handling Prisma 2. It is an excellent modern ORM which provides a lot of tools like
- Simplified & type-safe database access
- Declarative migrations & data modeling
- Powerful & visual data management
We use Postgres as database but you can use others too. Prisma supports following databases at the moment:
- PostgreSQL
- SQLite: unstable (photon releases required)
- Mysql
- MongoDB: coming soon (waiting for prisma2 photon support)
The web app is the graphical user interface in Visual Knight. Here you can manage your projects and users to handle all the test comfortably.
This backend returns all the information for the web app based on Graphql. This API also provides the possibility to create new tests and return there status. It is used for communication with the testing tools like CodeceptJS. The backend framework is written with NestJS
- create
docker-compose.yml
NOTE: latest version available on dockerhub
version: '3.7'
services:
api:
image: visualknight/api:1.0.0
ports:
- '${VK_API_PORT}:3333'
environment:
VK_APP_SECRET: SOME_APP_SECRET
VK_APP_DOMAIN: http://${VK_UI_DOMAIN}:${VK_UI_PORT}/
VK_GRAPHQL_SCHEMA_PATH: apps/api/schema.graphql
VK_DATABASE: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:${POSTGRES_PORT}/${VK_DB_NAME}
depends_on:
- postgres
ui:
image: visualknight/ui:1.0.0
ports:
- '${VK_UI_PORT}:8080'
postgres:
image: postgres
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- '${POSTGRES_PORT}:5432'
expose:
- '${POSTGRES_PORT}'
volumes:
- postgres:/var/lib/postgresql/data
migration:
image: visualknight/migration:1.0.0
depends_on:
- postgres
environment:
VK_DATABASE: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:${POSTGRES_PORT}/${VK_DB_NAME}
POSTGRES_SERVER: postgres
POSTGRES_PORT: ${POSTGRES_PORT}
volumes:
postgres:
- create
.env
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
VK_DB_NAME=visual_knight
VK_UI_DOMAIN=localhost
VK_UI_PORT=4200
VK_API_PORT=3333
-
run
docker-compose up
-
open url
VK_UI_DOMAIN:VK_UI_PORT
http://localhost:4200 -
login
visual-knight-community@example.com
/yourPassw0rd!
Clone the repository
Create .env
file based on .envtemplate
for:
- root derictory
- libs/api-interface
Fill your environment with your data!
npm install
NOTE: working database is required for mysql or postgres
- go into
libs/api-interface
- you can find a file with the name schema.prisma
- Setup your databse (Choose between Postgresql, Mysql and SQLite) NOTE: environments setup must be done!
- Lift up the database with the structure
npx prisma2 migrate up --experimental
- Create the first user
node postinstall.js
NOTE: You'll see credentials and API key in console
Everything is done and we can start the UI and API Server ;)
- Starting the api server:
npx ng run api:serve
NOTE: default http://localhost:3333/graphql - Starting the ui server:
npx ng run visual-knight:serve
NOTE: default http://localhost:4200
docker-compose up --build
NOTE: This is still experimental
- api server:
npx ng run api:build
- ui static files:
npx ng run visual-knight:build
You can find the files under the dist
folder.