Skip to content

Getting Started

Annastiina edited this page May 19, 2022 · 1 revision

Contents

  1. Requirements
  2. Forking
  3. Installation
  4. Deployment with Docker

Requirements

Note for Linux users: if your home directory is mounted from a network drive, using the Node Version Manager for installing Node.js highly recommended.

Forking

Unless you're forking into the same organization account, you can just use GitHub's forking functionality. Instructions for forking into the same organization account are below.

Forking into the same organization account

In GitHub it's not possible to fork an organization's repository to that same organization. If a new repository needs to be created using the SemanticComputing organization account, here is an alternative workflow for forking:

  1. Clone this repository: git clone [email protected]:SemanticComputing/sampo-ui.git

  2. Set up a new GitHub repository. Do not initialize it with anything. It needs to be an empty repository. You can name it how you like and you can rename your local folder to match that.

  3. Copy the url of your new repository.

  4. With terminal go to the folder with the clone of this repository (sampo-ui).

  5. Change remote origin from sampo-ui to your new repository: git remote set-url origin [your new github repo here]

  6. Check that the origin changed to your new repository: git remote -v

  7. Push your local clone of sampo-ui to your new repository: git push

  8. Set sampo-ui as the upstream of your new repository: git remote add upstream [email protected]:SemanticComputing/sampo-ui.git

  9. When new commits appear on the sampo-ui repository you can fetch them to your new repository. The example fetches only master branch: git fetch upstream master

  10. Go to the branch of your new repository where you want to merge the changes in upstream. Merge, solve conflicts and enjoy: git merge upstream/master

Installation

Local development

Install the dependencies specified in package.json (this command needs to be run only once, as long as you don't modify the dependencies):

npm install

Run client and server concurrently:

npm run dev

Deployment with Docker

These example commands can be used to deploy the server at http://localhost:3006/ in production mode. Production mode means in this case that the server listens for API requests at URLs beginning with http://localhost:3006/api/v1/... and additionally serves the client (React app) at http://localhost:3006/. The API docs can be found at http://localhost:3006/api-docs/.

Note that in development mode Webpack is used for serving the client, and the server is used only for handling API requests.

The build argument API_URL must be provided.

Build

docker build --build-arg API_URL=http://localhost:3006/api/v1 -t sampo-web-app-image .

Run

docker run -d -p 3006:3001 --name sampo-web-app sampo-web-app-image

Run with password protected endpoint

docker run -d -p 3006:3001 -e SPARQL_ENDPOINT_BASIC_AUTH=your_password --name sampo-web-app sampo-web-app-image

Upgrade

docker build --build-arg API_URL=http://localhost:3006/api/v1 -t sampo-web-app-image .
docker stop sampo-web-app
docker rm sampo-web-app
docker run -d -p 3006:3001 --name sampo-web-app sampo-web-app-image