Skip to content

Commit

Permalink
Initial documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
isaidnocookies committed Mar 19, 2020
1 parent ac22a0f commit d99fa90
Show file tree
Hide file tree
Showing 15 changed files with 209 additions and 1 deletion.
Empty file added .nojekyll
Empty file.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
primitive-io.github.io
# Headline

> An awesome project.
11 changes: 11 additions & 0 deletions _coverpage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<p>
<img src="/_media/primitive_logo.png" style="width: 40%;">
</p>

<span style="color: white; font-size: 3vh;">
Primitive Documentation and Information
</span>

[Get Started](/home)

![color](#000000)
Binary file added _media/primitive_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
* Home
* [Home](/home.md)

* Github Browser
* [Setup](/docs/primitive-setup.md)

* Private Git Scraper
* [Requirements](/docs/private/requirements.md)
* [Setup](/docs/private/private-setup.md)
* [Docker Setup](/docs/private/docker-setup.md)
* [Running Scraper in Docker](/docs/private/docker-usage.md)
* [Environment File](/docs/private/environment-file.md)
* [Volume](docs/private/volume.md)
1 change: 1 addition & 0 deletions docs/hello.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Hello!
1 change: 1 addition & 0 deletions docs/primitive-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Coming Soon
23 changes: 23 additions & 0 deletions docs/private/docker-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Docker Installation

## Windows

Docker CE is available through Docker Hub [Here](https://hub.docker.com/editions/community/docker-ce-desktop-windows/). This will run on Windows 10 Pro or Enterprise 64-bit as it requires Hyper-V.

## Linux (Ubuntu / Debian)

For *experimentation* and trials, installing Docker can be as easy as:

```
sudo apt update
sudo apt install
sudo apt install docker.io
```

#### Official Documenation from Docker (Recommended)

For more in-depth installation on production systems, please see [Docker's Official Documentation](https://docs.docker.com/install/linux/docker-ce/ubuntu/). This will walk you through the process of installing and setting up the Docker Engine on an Ubuntu/Debian based system.

## MacOS

Docker CE is also available for MacOS. This download is available at [Docker Hub](https://hub.docker.com/editions/community/docker-ce-desktop-mac/) and will provide the information necessary for installing Docker. MacOS installs require versions 10.13 or newer (i.e. High Sierra (10.13), Mojave (10.14) or Catalina (10.15). Mac hardware must be a 2010 or a newer model). For odler versions, please see [Docker Toolbox](https://docs.docker.com/toolbox/overview/) for more information.
88 changes: 88 additions & 0 deletions docs/private/docker-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Running Scraper in Docker Container

The private scraper is best run inside of Docker. This allows for consistency across platforms and removes potential dependency issues when deploying across different platforms.

# Required Configuration

The private scraper relies on two main elements to run properly: a location to store the internal database and an environment file.
- See information related to environment file [here](/docs/private/environment-file.md)
- See information for required volume [here](/docs/private/volume.md)

# Running Container

Once the scraper container is pulled and available to the local machine, the container can be ran. Below is an example of the command required for the scraper to execute properly.

```
docker run -d -p 80:3000 --env-file="env.file" -v /tmp/primitive/data:/srv/primitive/data --name primitive_2.0 primitive:latest
```

See below for explaination of run command flags and options:
- **'-d'** - Run the process as a daemon. Without this command, the container will execute and bind to the console. This can be removed for testing if something is failing with the run command.
- **'-p'** - Publish or expose a specific port. In the example, port 80 is being bound to port 3000 within the container. Since our scraper listens on port 3000, the first value in the port flag can be changed to accomodate different environments (e.g., 8083:3000).
- **--env-file** - This is an important one. This injects the variables found in the env file into the environment within the container. This will include environment specific information and git service credentials.
- **-v** - Mount a volume to the container. Because the scraper pulls data from your git service and saves assets to be served to the Primitive client, data persistence is important. In the example above, we are mounting a local directory (/tmp/primitive/data) to a folder inside the container(/srv/primitive/data). By doing this, the database and scraped assets will be stored outside the container and available on the local machine. Make sure that the local directory is present when running the container.
- **-name** - This will be the name of the running container. It is best to name this something that represents the function and includes the versioning.
- The last value is the image name. This will be the name of the image pulled from the registry and include the specific version being used (the example shows :latest but this may very well me a specific version.)

# Monitoring Containers

To see what container are running or available, run docker ps. The '-a' flag can be used to show all containers and not just running ones. If a container crashes, you will have to use the '-a' flag to view it.

```
docker ps
docker ps -a
```

# Stopping Container

Stopping a container can be done through the 'docker stop' command. The container name can be found through the 'docker ps' command.

```
docker stop primitive_2.0
```

# Starting Container

Starting a container can be done through the 'docker start' command. The container name can be found through the 'docker ps' command.

```
docker start primitive_2.0
```

# Updating Container

Updating the scraper consists of stopping the current container, pulling a new version, and running the new one. Stopped containers can be maintained in case there were bugs introduced in the updates. For example:

```
docker stop primitive_1.0
docker pull <new container name>
docker run <new container name>
```

If older version of the container are no longer needed, they can be deleted.

```
docker rm primitive_1.0
```

Old images can also be viewed and removed through the 'docker image' command.

```
docker image ls
docker image rm primitive_1.0
```

# Accessing Running Process

Once the container is running you can see it with the 'docker ps' command. To access the internal process, the 'exec' command can be used.

```
docker exec -it primitive_1.0 /bin/bash
```

This binds to the container primitive_1.0 and binds to an interactive bash shell giving the ability to troubleshoot and monitor the process. Within the container, we are running PM2 (a daemon process manager for Node.js). To see running logs and the process dashboard, use the following commands.

```
pm2 logs
pm2 monit
```
1 change: 1 addition & 0 deletions docs/private/environment-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Coming soon
7 changes: 7 additions & 0 deletions docs/private/private-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Overview

The Private Scraper allows users to view their private repositories through the Primitive client. The preferred method of deployment is through the use of Docker. Other options are available to run the private scraper though Node.js within a daemon process manager (e.g., PM2).

### Access to scraper source code or container

Please contact us at **[email protected]** to learn how to download the container or source code for deployment.
23 changes: 23 additions & 0 deletions docs/private/requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Requirements

The private scraper has a few general requirements in order to properly run.

### General Requirements

- Server/machine with the ability to connect to your git hosting service.
- Administration access into Git service to create access tokens or app passwords.
- (NOTE: The account associated with the token/password should have permissions to access all relevant repositories)
- Network capable of allowing clients to connect to server/machine hosting the private scraper.

### Network Requirements

- Static IP address or ability to set up dynamic dns.
- Non-static ip addresses can be used but this may cause issues with the clients ability to connect without frequent alterations to the client configuration file.

### System Requirements (Docker-Deployment)

- Windows 10 Pro, Enterprise, and Education
- MacOS
- Linux (CentOS, Ubuntu, or Red Hat Enterprise Linux 7 (RHEL7) with kernel version 3.10 or higher)
- Recommended 2 GB of RAM
- Recommended 5 GB of available disk space
1 change: 1 addition & 0 deletions docs/private/volume.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Coming soon
11 changes: 11 additions & 0 deletions home.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<p align=center>
<img src="/_media/primitive_logo.png" height="100px">
</p>

# Welcome to Primitive!

Welcome to the Primitive Documentation portal! Here you will find information related to the Primitive VR client as well as scraper information.

For more information, please visit us at [Primitive.io](http://primitive.io) or email us at **[email protected]**

[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
26 changes: 26 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Primitive.io</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
name: "Primitive",
loadSidebar: true,
themeColor: '#59c2ff',
relativePath: true,
coverpage: true,
onlyCover: true,
subMaxLevel: 2
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</body>
</html>

0 comments on commit d99fa90

Please sign in to comment.