πŸ“—
UpGrade Platform - Documentation
6.1
6.1
  • UpGrade Overview
  • Creating an Experiment
    • Unit of Assignment
    • Simple Experiment
    • Factorial Experiment
    • Inclusion and Exclusion
    • Schedule and Post-Rule
    • Exporting Experiment Data and Design
  • Creating a Feature Flag
  • How UpGrade Works
  • Researcher Guide
    • Working with segments
  • Developer Guide
    • ⚑Quick Start: Running UpGrade Locally with Docker
    • ⚑Quick Start: Running locally w/o Docker (on MacOS or Linux)
    • UpGrade + AdapComp (Mooclet) in Docker
    • πŸšΆβ€β™€οΈWalkthroughs
      • Your Application and UpGrade
      • Example 1: A Quiz Web App
      • Example 2: An Online Math Game
    • πŸ“šReference
      • API
      • Client Libraries
        • TypeScript / JS
          • Class: UpgradeClient
          • Class: Assignment
          • SDK Interfaces
            • Interface: IMetric
            • Interface: IExperimentUser
            • Interface: IExperimentUserAliases
            • Interface: ILog
            • Interface: IMarkExperimentPoint
            • Interface: IMetric
            • Interface: IRequestOptions
            • Interface: IResponse
            • Interface: IUser
            • Interface: IUserGroup
      • Environment Variables
        • Frontend Environment
        • Backend Environment
      • Context Metadata
      • Metrics
      • Setting up Google-Auth
      • API Authorization
      • Data Architecture
    • πŸ‘¨β€πŸ’»Contributing Code
      • Branching Workflow (Git-Flow)
      • Pull Request Expectations
    • πŸ˜…Troubleshooting
      • Relation β€˜experiment_condition’ already exists
      • User not found. Authorization error
      • Token is not present in the request header
      • nodemon exits without explanation
      • Unable to find New Relic module configuration
      • No email received for export data
      • Opening a new tab in UpGrade prompts for re-authorization
      • Error: Cannot find module 'upgrade_types' (or a type from 'upgrade_types' does not exist)
  • Glossary
Powered by GitBook
On this page
  • Local setup (w/o docker)
  • Requirements
  • Install and run postgres
  • Environment Setup
  • Launch
  1. Developer Guide

Quick Start: Running locally w/o Docker (on MacOS or Linux)

PreviousQuick Start: Running UpGrade Locally with DockerNextUpGrade + AdapComp (Mooclet) in Docker

Last updated 9 days ago

Local setup (w/o docker)

If the dockerized approach is a no go, or you want to run things manually, these instructions should help.

Requirements

Requires Node 18.18.2+ and a recent version of postgres.

UpGrade will also require Google account later in this setup in order to obtain authentication credentials from https://cloud.google.com/

Install and run postgres

  1. Download and install the latest release of Postgres from

  2. Open Postgres and click "Initialize".

  3. Click "Server Settings" and change the name to "dev".

  4. Download and install Datagrip from

  5. Open Datagrip and click "New Project".

  6. Enter "PostgreSQL" as a new project name and click "OK".

  7. Click "+" -> "Data Source" -> "PostGreSQL".

  8. Enter "postgres" for the "User" field and click "OK".

  • Install Postgres database in your system (version 11 or above. Link: ).

  • Install PostgreSQL client: sudo apt install postgresql-client

  • Install PostgreSQL server: sudo apt install postgresql-server

  • Steps to create a PostgreSQL database for upgrade user

    1. run sudo -u postgres psql(it will start postgress and show 'postgres#').

    2. run CREATE USER ${username} PASSWORD '${password}';

    3. run CREATE DATABASE ${DatabaseName};

    4. run GRANT ALL on DATABASE ${DatabaseName} to {username};

    5. run ALTER USER {username} with Superuser;

    6. run CREATE extension "uuid-ossp";

    7. \q to exit

  • Download and install Datagrip from

  • Open Datagrip and click "New Project".

  • Enter "PostgreSQL" as a new project name and click "OK".

  • Click "+" -> "Data Source" -> "PostGreSQL".

  • Enter "postgres" for the "User" field and click "OK".

Environment Setup

Backend:

Make a copy of env.example

cd ./UpGrade/backend/packages/Upgrade

# note that this is a dot file may look hidden on terminal, ls -a will reveal
cp .env.example .env

Launch

Start the backend

In your Terminal window, type cd ~/UpGrade/backend/packages/Upgrade/, then run the following command: npm run dev

Start the frontend

In your Terminal window, type cd ~/UpGrade/frontend/, then run the following command: npm run start

After the login, you should see the "Experiments" page with a welcome message, and two buttons to import or add an experiment.

Note:- After running both the frontend and backend, check DataGrip "{db-name} -> postgres -> public -> tables -> user" to verify whether your email has admin access.

After a few seconds, if you open in your browser, you should see something like the following on the page:{"name":"A/B Testing Backend","version":"6.1.0","description":"Backend for A/B Testing Project"}

After a few seconds, your default browser should automatically launch and display the login page. Or you can open in your browser and log in with your account.

⚑
https://postgresapp.com/downloads.html
https://www.jetbrains.com/datagrip/download/#section=mac
https://www.postgresql.org/download/linux/
https://www.jetbrains.com/datagrip/download/#section=linux
http://localhost:3030/api
http://localhost:4200

Install UpGrade

Get the code from https://github.com/CarnegieLearningWeb/UpGrade (monorepo contains all packages):

# https
git clone https://github.com/CarnegieLearningWeb/UpGrade.git

# ssh
git clone git@github.com:CarnegieLearningWeb/UpGrade.git

By default you'll be checked out to the "dev" branch, which is the latest code, but unstable and meant for developers. For most users, switch to "main" for the latest stable build, "dev" is not going to be guaranteed to work.

git checkout main

Nav into root of project and run these commands to install dependencies.

npm ci

cd ./types
npm ci
npm run build
# copy this folder into the backend as well, the build will want it there
cp -R . /backend/packages/Upgrade

cd ./backend
npm ci

cd ./backend/packages/Upgrade
npm ci

cd ./frontend
npm ci
GOOGLE_CLIENT_ID: xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com

This id will also need to be supplied in frontend/projects/upgrade/src/app/environments/environment.ts

cd ./UpGrade/frontend

# note that this one is not a dot file
cp environment.local.example.ts environment.example.ts

Put the google client id from about into the field: `googleClientId`

googleClientId: xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
# modify this line, note the syntax for adding multiple users and roles
ADMIN_USERS=user@email:admin/\user2@email:admin

# add yourself
ADMIN_USERS=you@yourcompany:admin

CORS whitelist

Ensure that this line is present in you env

CORS_WHITELIST=localhost

Google Client Id: Obtain a google client id and plunk it here ()

Note: There is a DOMAIN env variable below this. If you want to restrict your user logins to your org's email domain, replace the value here with that domain. Otherwise, it should be left blank. See other backend env option documentation . Frontend: Make a copy of environment.local.example.ts

See other frontend env option documentation . Admin User UpGrade will start up with certain users automatically added as admin roles. You will want to put your email address in so that after login, you will have all permissions for your user in the UI. You will know if this is set correctly if you are able to see the "Add Experiment" and "Import Experiment" buttons on startup. If they are missing, it means you are a "reader" role, check this env var.

See for other environment options.

follow this guide
here
here
this page