Skip to content

Latest commit

 

History

History
93 lines (61 loc) · 3.07 KB

GETTING_STARTED.md

File metadata and controls

93 lines (61 loc) · 3.07 KB

Getting Started

Set up and run Linode's UI packages locally.

Preface

This repository uses Yarn Workspaces, a solution to transform JavaScript-based repositories into a single monorepo. This is useful because it allows us to maintain multiple projects in one place, with shared dependencies.

There are 3 package.json files: 1 for the root, and one for each folder in packages/. Running yarn will install everything, and "hoist" as much as possible into the root node_modules folder. There is a single yarn.lock in the root directory.

Most of the time you will directly use the commands from this documentation. If you have to run a specific command the rule is:

  • To run a command in both packages: yarn workspace <command>
  • To run a command in a single package yarn workspace @linode/api-v4 <command>, or yarn workspace linode-manager <command>

The workspace names are defined in the root package.json

  • @linode/api-v4: /packages/@linode/api-v4
  • linode-manager: /packages/linode-manager

Starting the App locally

  1. Fork or clone this repository.

  2. Log into cloud.linode.com and create an OAuth client.

  3. Create an .env file for Cloud Manager and place it in the packages/manager directory.

  4. Make sure you are using a supported version of Node.js (10.16 is recommended). Installing Node with Homebrew will result in a more recent version that can cause problems with our automation. We recommend using NVM:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/<NVM-LATEST-VERSION>/install.sh | bash
    ## Follow the instructions to add NVM to your .*rc file, or open a new terminal window
    nvm install 10.16
    nvm use 10.16
    node --version
    ## v10.16.0
  5. Make sure you have a recent version of Yarn (1.22+):

    yarn --version
    npm install -g yarn --upgrade
  6. Start Cloud Manager and the JS client with yarn up.

Testing

See this document

Helper Scripts and other commands

To learn more about the available commands read COMMANDS

Okay. I've got my development server running. So how do I contribute?

Please see our contributing and code conventions guides for instructions on how to get started with contributing to this project.

Serving a Build of Cloud Manager:

Using yarn build

Since Cloud Manager was generated using Create React App, yarn build can be used to generate an optimized production bundle:

yarn install:all
yarn workspace linode-manager build

You can then serve these files however you prefer, for example:

npm install -g http-server
cd packages/manager/build
http-server .

Docker

We also provide two ways to serve the build app using Docker:

Build a container based on the Dockerfile and starts the manager server (this operation is slow):

yarn docker:local

Start a small NGINX container to serve the files:

yarn start:nginx