Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed src/assets/img/docs/architecture-overview.png
Binary file not shown.
7 changes: 4 additions & 3 deletions src/pages/docs/contributing/repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ contributors to follow so that we can have a chance of keeping on top of things.

## Getting Started

Codius is organized into two major repositories:
Codius is made up of the following major repositories:

* [codiusd](https://github.com/codius/codiusd)
* [codius-cli](https://github.com/codius/codius)
* [codius-operator](https://github.com/codius/codius-operator)
* [codius-web](https://github.com/codius/codius-web)
* [receipt-verifier](https://github.com/coilhq/receipt-verifier)

## Making Changes

Expand Down
10 changes: 4 additions & 6 deletions src/pages/docs/overview/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ Previously, most distributed applications in the cryptocurrency community were w

# How Codius works

Codius is a hosting platform and accompanying client. We generally distinguish two roles:
Codius is a hosting platform. We generally distinguish two roles:

* **Codius Hosts** are companies or individuals who are looking to earn money by operating servers to host other people's applications. They use [`codiusd`](https://github.com/codius/codiusd) in order to provide the necessary APIs for uploading apps. `codiusd` also creates a [pod](https://kubernetes.io/docs/concepts/workloads/pods/pod/) and the necessary amount of [containers](https://www.docker.com/what-container). These pods are granted access to a [moneyd](https://github.com/interledgerjs/moneyd) instance that allows both the host and its pods to send and receive payments over [Interledger](https://interledger.org).
* **Codius Hosts** are companies or individuals who are looking to earn money by operating servers to host other people's applications. They use several components ([`receipt-verifier`](https://github.com/coilhq/receipt-verifier), [`codius-operator`](https://github.com/codius/codius-operator) and [`codius-web`](https://github.com/codius/codius-web)) in a Kubernetes cluster in order to accept [Interledger](https://interledger.org) payments and provide the necessary APIs for uploading apps. `codius-operator` also creates a [pod](https://kubernetes.io/docs/concepts/workloads/pods/pod/) and the necessary amount of [containers](https://www.docker.com/what-container).

* **Developers** create applications and deploy them on top of Codius. They use [`codius`](https://github.com/codius/codius) to upload apps. The upload is accomplished via a [manifest](https://github.com/codius/codius-manifest) that describes information about the program such as its name, version, environment variables, and a Docker image to pull. (Images are pulled from Dockerhub by default.)
* **Developers** create applications and deploy them to a Codius host. They use the Codius host's [`web page`](https://github.com/codius/codius-web) to upload apps to the host's Kubernetes cluster. The upload is accomplished via a [manifest](https://godoc.org/github.com/codius/codius-operator/servers#Services) that describes information about the program such as its environment variables and Docker image to pull. (Images are pulled from [Docker Hub](https://hub.docker.com/) by default.)

[ `codiusd`](https://github.com/codius/codisud) utilizes [`hyperd`](https://github.com/hyperhq/hyperd) in order to run applications isolated from each other and from the outside world.

![Architecture Diagram](/assets/img/docs/architecture-overview.png)
By default, [ `codius-operator`](https://github.com/codius/codius-operator) utilizes [`Kata Containers`](https://katacontainers.io/) in order to run applications isolated from each other and from the outside world.
4 changes: 2 additions & 2 deletions src/pages/docs/overview/why-codius.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ section: docs
---

# Codius Features
Codius is an open hosting protocol, carrying with it all of the connotations that implies - distributed peer-to-peer hosting and third-party verified smart contracts. But Codius brings a host of its own features to the table as well, offering flexibility in distribution and development. Throw Interledger into the mix, and Codius adds flexibility in payments to its feature suite.
Codius is an open hosting protocol, carrying with it all of the connotations that implies - distributed peer-to-peer hosting and third-party verified smart contracts. But Codius brings a host of its own features to the table as well, offering flexibility in distribution and development. Throw [Interledger](https://interledger.org) into the mix, and Codius adds flexibility in payments to its feature suite.

## Any Language, Any Case
Codius hosts run code via hardware-isolated virtual machines referred to as "pods". This means that developers can develop their code in any language they like, then configure a pod on a Codius host with an environment that is able to run said code.

Codius' hosting protocol is also run independently of any blockchains, which allows for a greater range of use cases on Codius. Developers can create apps that do not depend on or are more practical without a blockchain, granting them freedom to develop exactly the kind of app they wish to host.

## Freedom in Payment Method
Codius hosting's payment infrastructure is provided by Interledger, so users and developers can send or receive payments in the currency of their choosing.
Codius hosting's payment infrastructure is provided by [Interledger](https://interledger.org), so users, developers, and hosts can send or receive payments in the currency of their choosing.

## Flexibility in Distribution
Most hosting platforms require developers to make a choice between centralized hosting on a single provider, or completely decentralized hosting with every member of the network participating in hosting a developer's code. Codius puts both of these options - and anywhere in between - under a single umbrella. Developers can now choose exactly who to trust with hosting their code, and have total freedom on just how distributed they wish their code to be.
Expand Down
13 changes: 4 additions & 9 deletions src/pages/docs/running-a-host/host-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@ section: docs
---

# Codius Host Architecture
A Codius host is comprised of several components that allows it to perform its duties of hosting code in an isloated manner, and send and receive payments through itself and through the individual services that it is hosting. The main roles a Codius host plays is to create a space where each program that is uploaded can live, send and receive payments for itself and on behalf of any programs it is running in its pods, and to broadcast itself to the rest of the Codius network while building its own library of known Codius nodes.
A Codius host is comprised of several components that allows it to perform its duties of hosting code in an isolated manner. The main roles a Codius host plays is to create a space where each program that is uploaded can live and to receive payments.

## Hosting
The main function of the Codius host is to create a place to run uploaded code, and then proxy connections to the uploaded code through itself. A host receives uploaded code in the form of a [manifest](https://github.com/codius/codius-manifest). The manifest contains information about the code such as its name, version, Docker Image, and environment variables. In addition to the manifest, the host also receives information on how long the uploader wishes to run the code and the necessary payment. The host then generates a hash from the uploaded manifest and converting it into what is called a pod spec. The hash is used to identify the manifest to the host and by extension, the outside world. The pod spec is passed to hyperd, which codiusd talks to in order to manage pods.
The main function of the Codius host is to create a place to run uploaded code, and then proxy connections to the uploaded code through itself. A host receives uploaded code in the form of a [manifest](https://godoc.org/github.com/codius/codius-operator/servers#Service). The manifest contains information about the code such as its Docker image and environment variables. The host generates a hash from the uploaded manifest. The hash is used to identify the manifest to the host and by extension, the outside world. The manifest defines a Kubernetes [custom resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) which the [codius-operator](https://github.com/codius/codius-operator) uses to manage pods.

### Pods
A [pod](https://kubernetes.io/docs/concepts/workloads/pods/pod/) creates a small hardware-isolated unit of computing that groups together [containers](https://www.docker.com/what-container) within it. Containers that share a pod all share the same network, kernel, and storage, but are otherwise isolated from each other. A manifest file can describe multiple containers to be run in the pod that the Codius Host provisions for it.

The pod is identified by the Codius host with the manifest hash, which is generated from the manifest itself. A pod can then have its runtime extended with queries using that hash to designate it to the host. The host also uses this hash to make its associated pod accessible by generating a URI of the format `MANIFEST_HASH.CODIUS_HOST_URI`. Using this URI, the host proxies requests on it to the designated pod.

Pods are able to connect to the Interledger for payments by way of the Codius host exposing a port in the Pod's network, which passes data on that port to the Codius Host's own Interledger connection.
The pod is identified by the Codius host with the manifest name. A pod can have its runtime extended with queries using that name to designate it to the host. The host makes its associated pod accessible by generating a URI of the format `MANIFEST_NAME.CODIUS_HOST_URI`. Using this URI, the host proxies requests on it to the designated pod.

### Payments
Codius uses [Interledger](https://interledger.org) to handle payments, implementing it by running the daemon [moneyd](https://github.com/interledgerjs/moneyd). It then extends payment functionality into its pods by exposing a port in each of them, which connects them to the Interledger network as well. With Interledger, a Codius host can accept payments to host programs, and any programs that are uploaded to the host that contain a contract can handle payments over Interledger.

### Peers
To aid in creating distributed applications, Codius hosts maintain a list of other Codius nodes on the network that is updated as new Codius hosts go live. They also broadcast themselves so that other hosts become aware of them.
A Codius host uses [Interledger](https://interledger.org) to accept payments to host programs.
2 changes: 1 addition & 1 deletion src/pages/docs/running-a-host/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Running a Codius host means being in the hosting business. You should do it, if

# Earning money

The payments component of a Codius host, [Moneyd](https://github.com/interledgerjs/moneyd) supports XRP billing right out of the box. Additionally, developers can build custom billing modules to allow alternate payment methods. Codius billing is resource-driven, you should see a very strong correlation between the load on your servers (and the number of servers required) and the amount of money earned.
Codius supports accepting payments to a host's Interledger [Payment Pointer](https://paymentpointers.org/) right out of the box. Additionally, developers can build custom billing modules to allow alternate payment methods. Codius billing is resource-driven, you should see a very strong correlation between the load on your servers (and the number of servers required) and the amount of money earned.

# Setup costs

Expand Down
61 changes: 11 additions & 50 deletions src/pages/docs/using-codius/running-the-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,23 @@ title: Running the Examples
section: docs
---

# Installing the CLI
# Example Services

In order to upload programs to Codius hosts, you'll need to install the CLI.
Codius has a number of [example services](https://github.com/codius/examples) to help you get started.

``npm install -g codius``
* [nginx](https://github.com/codius/codius-examples/blob/master/nginx.yaml) - a simple nginx server
* [create-react-app](https://github.com/codius/codius-examples/blob/master/react-app.yaml) - the bootstrap React App

# Example Applications
# Pay the Codius Host

Codius has a number of example applications to help you get started, which you can acquire by cloning this repo:
Navigate to the Codius host in a web browser with a [Web Monetization](https://webmonetization.org/) provider enabled.

``git clone git://github.com/codius/codius-examples``
# Deploy the applicatoin

## [nginx](https://github.com/codius/codius-examples/blob/master/manifest/nginx-manifest.json)
1. Input a name for your service. This is the Codius host's subdomain at which the service will be available.

The first example is a simple nginx server:
2. Paste the contents of the example service file to the Codius host web page.

* ``cd codius-examples/manifest/``
* ``codius upload ./nginx-manifest.json --host https://codius.feraltc.com``
3. Click `Deploy`.

You should get a response that looks something like this:
```
{ url:
'http://MANIFEST_HASH.local.codius.org:3000/',
manifestHash: 'oooiikrql23xkjhvc6gobe7vjf5tiprodtmphqnwm7v3vx5g2csq',
host: 'http://local.codius.org:3000',
expiry: '2018-06-05T20:52:02.068Z',
expirationDate: '06-05-2018 1:52:02 -0700',
expires: 'a few seconds ago',
pricePaid: '4' }
```

Notice the `url` field in the response. You can use this url to query the pod you just launched, and it should return the standard nginx welcome page.

## [create-react-app](https://github.com/codius/codius-examples/blob/master/manifest/create-react-app-manifest.json)

Another available example pod launches the bootstrap React App, [create-react-app](https://github.com/codius/examples/blob/master/manifest/create-react-app-manifest.json)

* ``cd codius-examples/manifest/``
* ``codius upload ./create-react-app-manifest.json --host https://codius.feraltc.com``

As before, you should get a similar response:

```
{ url:
'https://MANIFEST_HASH.codius.feraltc.com/',
manifestHash: 'MANIFEST_HASH',
host: 'https://codius.feraltc.com',
expiry: '2018-06-05T20:52:02.068Z',
expirationDate: '06-05-2018 1:52:02 -0700',
expires: 'a few seconds ago',
pricePaid: '4' }
```

Feel free to test these examples with some of the other hosts that the Codius team are running:

* `https://codius.justmoon.com`
* `https://codius.tinypolarbear.com`
* `https://codius.risky.business`
* `https://codius.andros-connector.com`
If the deployment succeeds, you can visit the service at the chosen subdomain (ex: `https://name.example-host.com`).
6 changes: 3 additions & 3 deletions src/pages/docs/using-codius/writing-an-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ section: docs
# Writing a Codius application

Codius applications are nothing more than everyday NodeJS packages. The structure
of an applicatoin is fairly straightforward:
of an application is fairly straightforward:

* A [manifest](https://github.com/coilhq/codius-manifest) describing basic information about your program, such as name, verison, image, and its environment variables.
* A [manifest](https://godoc.org/github.com/codius/codius-operator/servers#Service) describing basic information about your program, such as its Docker image and environment variables.

The main component from which your program will be sourced is a Docker image, the path to which can be found in the `manifest` object in a field called `image`. By default, the image is pulled from Dockerhub.
The main component from which your program will be sourced is a Docker image, the path to which can be found in the `containers` object(s) in a field called `image`. By default, the image is pulled from [Docker Hub](https://hub.docker.com/).

Codius also has a number of [example applications](running-the-examples) available.