Skip to content

codescalers/cloud4students

Repository files navigation

cloud4students

Codacy Badge gopherbadger-tag-do-not-edit Testing Testing Testing

cloud4students aims to help students deploy their projects on Threefold Grid.

Requirements

  • docker-compose

Build

  • First create config.json check configuration

  • Change VITE_API_ENDPOINT in docker-compose.yml to server api url for example http://localhost:3000/v1

To build backend and frontend images

docker-compose build

Run

First create config.json check configuration

To run backend and frontend:

docker-compose up
  • your backend will run at http://localhost:3000/v1
  • your frontend will run at http://localhost:8080

If your machine has a public ip or a domain you can route your backend and frontend urls using caddy.

  • example Caddyfile for a domain example.com
example.com {
  route /* {
    uri strip_prefix /*
    reverse_proxy localhost:8080
  }
  route /v1/* {
    uri strip_prefix /*
    reverse_proxy localhost:3000
  }
}

Configuration

Before building or running docker compose, create config.json in the current directory.

example config.json:

{
    "server": {
        "host": "localhost, required",
        "port": ":3000, required",
        "redisHost": "redis-db, make sure to change it in docker compose if you have other redis configurations, required",
        "redisPort": "6379, make sure to change it in docker compose if you have other redis configurations, required",
        "redisPass": "pass, make sure to change it in docker compose if you have other redis configurations, required" 
    },
    "mailSender": {
        "email": "your sendgrid account sender, required",
        "sendgrid_key": "<sendgrid-key>, required",
        "timeout": "<the timeout for app mail verification codes in seconds, required>"
    },
    "database": {
        "file": "<the path of the database file you have or you want to create, default is `database.sql`>"
    },
    "token": {
        "secret": "<your secret for the jwt tokens, required>",
        "timeout": "<the timeout of the jwt token in seconds, required>"
    },
    "account": {
        "mnemonics": "<your account mnemonic to be used for the deployments, required>",
        "network": "<grid-network, It can be main, qa, test, dev only, required>"
    },
    "version": "the version of your api like `v1`, required",
    "admins": ["<a set of the user emails you want to make admins>"],
    "notifyAdminsIntervalHours": "<the interval between admins notifications in hours, optional>",
    "adminSSHKey": "<an ssh key to be put with every deployment to prevent losing the vm if the user changed his ssh keys. optional>"
}

Frontend

check frontend README

Backend

check backend README