Skip to content

Latest commit

 

History

History
167 lines (112 loc) · 4.99 KB

File metadata and controls

167 lines (112 loc) · 4.99 KB

← back

Quickstart

This is a quickstart guide on how to create a new Zendro project with default parameters. It uses pre-defined datamodels, database and environment variables.

If you want to know more about Zendro or a detailed explanation on how to set up Zendro from scratch, check this.


Project Requirements:


Step 1: Installation

Execute this commands to install Zendro:

$ git clone https://github.com/Zendro-dev/zendro.git
$ cd zendro
$ npm install
$ npm link

Step 2: Setup a new Zendro project

The easiest way to set up Zendro is using the Zendro CLI tool with minimal steps and configuration. Execute:

$ zendro set-up -d <name>

By default, three data models with associations will be used for this instance:

  • city
  • country
  • river

Also a default SQLite database will be used. You can find the database on graphql-server folder.

Step 3: Edit environment variables

Edit NEXTAUTH_SECRET to your expected secret word in the following files:

  • SPA in development mode: ./single-page-app/.env.development
  • SPA in production mode: ./single-page-app/.env.production
  • GraphiQL in development mode: ./graphiql-auth/.env.development
  • GraphiQL in production mode: ./graphiql-auth/.env.production

If you want to know more about the enviroment variables, you can check this.

Step 4: Start up your Zendro instance

Development mode

To start Zendro in development mode run

$ zendro dockerize -u

This will start Zendro in development mode. All servers are listening to live changes you make in the files. Especially the SPA and graphiql-auth web-services will be slow to use since they compile pages on demand when opening them. To avoid that either change the docker-compose-dev.yml to compile and deploy the webservices (see docker-compose-prod.yml) or start Zendro in production mode.

In development mode there is no reverse proxy to map the docker-services. Instead this is done by exposing the ports.

Note: We recommend to use Linux system for development mode.

Production mode

Execute this command to start Zendro in production mode.

$ zendro dockerize -u -p

This command will create docker containers for each Zendro component:

  • Keycloak: manage users and roles
  • Single Page App (SPA): graphical interface to send CRUD requests to a Zendro GraphQL endpoint
  • API: CRUD API that can be accessed through a GraphQL query language
  • GraphiQL interface: An implementation of the GraphQL IDE with Zendro login and advanced filter functionalities.
  • traefik reverse-proxy: A reverse-proxy using traefik that maps the above docker services.

You can check docker containers by:

$ docker ps

You can check docker logs by:

$ docker logs -f <container name>

Please wait until logs indicate the app is running on XXXX port to access Zendro services.

In default config, the running containers will be:

Also, for the default database you can install sqlite3 with:

$ sudo apt install sqlite3

Then, go to graphql-server folder and run:

$ sqlite3 data.db

You can see tables and do querys inside sqlite by:

sqlite> .tables
sqlite> SELECT * FROM <table>;
sqlite> .exit

Step 5: Stop your Zendro instance

Execute this command to stop Zendro and remove all volumes.

# Production
$ zendro dockerize -d -p -v

# Development
$ zendro dockerize -d -v

Note: If you want to persist your data, that includes user data as well as other data, remove the -v flag from the above command.