@ -7,7 +7,7 @@ description: Learn how to run a Gaia hub on DigitalOcean
This teaches you how to run a Gaia storage hub on DigitalOcean (DO). DigitalOcean is an affordable and convenient cloud computing provider. This example uses DigitalOcean Spaces for file storage. A space is equivalent to AWS's S3 file storage solution.
This teaches you how to run a Gaia storage hub on DigitalOcean (DO). DigitalOcean is an affordable and convenient cloud computing provider. This example uses DigitalOcean Spaces for file storage. A space is equivalent to AWS's S3 file storage solution.
DigitalOcean provides you with a compute machines known as a **Droplets** and storage called a **Spaces**. You need both to run a Gaia hub. The Gaia hub setup you create here, requires get a Digital Droplet with Docker pre-installed and a 250 GB Space. Droplets and storage each run for $5/month or a total of $10/month.
DigitalOcean provides you with a compute machines known as a **Droplets** and storage called a **Spaces**. You need both to run a Gaia hub. The Gaia hub setup you create here, requires get a Digital Droplet with Docker pre-installed and a 250 GB Space. Droplets and storage each run for \$5/month or a total of \$10/month.
<divclass="uk-card uk-card-default uk-card-body">
<divclass="uk-card uk-card-default uk-card-body">
<h5>Is this tutorial for you?</h5>
<h5>Is this tutorial for you?</h5>
@ -103,8 +103,8 @@ On your local workstation, create a bucket policy to grant read permission on yo
For example, if your space is named `meepers`, after editing the line you would have:
For example, if your space is named `meepers`, after editing the line you would have:
```
```yaml
"Resource": "arn:aws:s3:::meepers/*"
'Resource': 'arn:aws:s3:::meepers/*'
```
```
Be sure not to change any of the other fields, especially `Version`.
Be sure not to change any of the other fields, especially `Version`.
@ -112,13 +112,13 @@ On your local workstation, create a bucket policy to grant read permission on yo
7. Save and close the file.
7. Save and close the file.
8. Use `s3cmd` to enact the policy.
8. Use `s3cmd` to enact the policy.
```
```bash
s3cmd setpolicy gaiahub-policy s3://<SPACE_NAME>
s3cmd setpolicy gaiahub-policy s3://<SPACE_NAME>
```
```
Be sure to `SPACE_NAME` with the name of your space, for example:
Be sure to `SPACE_NAME` with the name of your space, for example:
```
```bash
s3cmd setpolicy gaiahub-policy s3://meepers
s3cmd setpolicy gaiahub-policy s3://meepers
```
```
@ -140,7 +140,7 @@ On your local workstation, create a bucket policy to grant read permission on yo
2. Use `s3cmd` to enact the configuration.
2. Use `s3cmd` to enact the configuration.
```
```bash
s3cmd setcors gaiahub-cors.xml s3://<SPACE_NAME>
s3cmd setcors gaiahub-cors.xml s3://<SPACE_NAME>
```
```
@ -177,7 +177,7 @@ In this task, you add a droplet to your account. The droplet is a droplet is a c
9. Scroll down to the **Finalize and create** section.
9. Scroll down to the **Finalize and create** section.
10. **Choose a hostname** for your droplet such as `moxie-gaiahub`.
10. **Choose a hostname** for your droplet such as `moxie-gaiahub.`
11. Review your choices then click **Create** to start your droplet running.
11. Review your choices then click **Create** to start your droplet running.
@ -224,7 +224,7 @@ A droplet console emulates the access you would have if you were sitting down wi
The system logins you in and gives you a welcome message. At the conclusion of the message, you are at the console prompt.
The system logins you in and gives you a welcome message. At the conclusion of the message, you are at the console prompt.
```
```bash
Welcome to DigitalOcean's One-Click Docker Droplet.
Welcome to DigitalOcean's One-Click Docker Droplet.
To keep this Droplet secure, the UFW firewall is enabled.
To keep this Droplet secure, the UFW firewall is enabled.
All ports are BLOCKED except 22 (SSH), 2375 (Docker) and 2376 (Docker).
All ports are BLOCKED except 22 (SSH), 2375 (Docker) and 2376 (Docker).
@ -253,7 +253,7 @@ A droplet console emulates the access you would have if you were sitting down wi
4. Enter a name for the key.
4. Enter a name for the key.
It is helpful to choose descriptive name like `gai-hub-key`.
It is helpful to choose a descriptive name, like `gai-hub-key`.
5. Press the check mark.
5. Press the check mark.
@ -273,13 +273,13 @@ You should have the console open as `root` on your Droplet. In this section, you
1. Copy the Gaia code into your droplet using the `git clone` command.
1. Copy the Gaia code into your droplet using the `git clone` command.
Successful output from this command looks like the following.
Successful output from this command looks like the following.
```
```bash
Cloning into 'gaia'...
Cloning into 'gaia'...
remote: Enumerating objects: 63, done.
remote: Enumerating objects: 63, done.
remote: Counting objects: 100% (63/63), done.
remote: Counting objects: 100% (63/63), done.
@ -294,25 +294,25 @@ You should have the console open as `root` on your Droplet. In this section, you
2. Change to `hub` directory in the `gaia` code.
2. Change to `hub` directory in the `gaia` code.
```
```bash
cd gaia/hub
cd gaia/hub
```
```
3. Copy the configuration sample to a new `config.json` file.
3. Copy the configuration sample to a new `config.json` file.
```
```bash
cp config.do.sample.json config.json
cp config.do.sample.json config.json
```
```
4. Edit your new `config.json` file with `vi` or `vim`.
4. Edit your new `config.json` file with `vi` or `vim`.
```
```bash
vi config.json
vi config.json
```
```
You now need to edit this JSON file to have it store files on your DigitalOcean space.
You now need to edit this JSON file to have it store files on your DigitalOcean space.
```
```json
{
{
"serverName": "DROPLET_NAME",
"serverName": "DROPLET_NAME",
"port": 4000,
"port": 4000,
@ -344,9 +344,9 @@ You'll find that the `driver` is set to `aws`. The DigitalOcean space API exactl
5. Set the `serverName` to the droplet you just created.
5. Set the `serverName` to the droplet you just created.
6. Set the `readURL` to the URL of the DigitalOcean space you just created.
6. Set the `readURL` to the URL of the DigitalOcean space you just created.
If your space URL called `https://meepers-hub-space.sfo2.digitaloceanspaces.com`, the `readURL` name is `https://meepers-hub-space.sfo2.digitaloceanspaces.com`. 7. Set the `bucket` to the name of the DigitalOcean space you just created.
If your space URL called `https://meepers-hub-space.sfo2.digitaloceanspaces.com,` the `readURL` name is `https://meepers-hub-space.sfo2.digitaloceanspaces.com.` 7. Set the `bucket` to the name of the DigitalOcean space you just created.
If your space is called `meepers-hub-space`, the `bucket` value is `meepers-hub-space`.
If your space is called `meepers-hub-space,` the `bucket` value is `meepers-hub-space`.
8. Go back to your DigitalOcean dashboard open to your space key.
8. Go back to your DigitalOcean dashboard open to your space key.
9. Copy the **Key** and paste it into the `accessKeyId` value in the `config.json` file.
9. Copy the **Key** and paste it into the `accessKeyId` value in the `config.json` file.
@ -364,7 +364,7 @@ In this example, you would copy the `sfo2.digitaloceanspaces.com` section.
This will allow Stacks user to write to your Gaia hub, without any social proofs required. You can change this later on, and do other things to lock-down this Gaia hub to just yourself, but that is outside the scope of this document.
This will allow Stacks user to write to your Gaia hub, without any social proofs required. You can change this later on, and do other things to lock-down this Gaia hub to just yourself, but that is outside the scope of this document.
At this point, the `json.config` file should be completed and appear similar to the following&—; but with your values.
At this point, the `json.config` file should be completed and appear similar to the following, but with your values.
```json
```json
{
{
@ -393,7 +393,7 @@ At this point, the `json.config` file should be completed and appear similar to
}
}
```
```
15. Save your config file and close the `vim` editor.
1. Save your config file and close the `vim` editor.
The system returns you back to the prompt.
The system returns you back to the prompt.
@ -403,16 +403,13 @@ While your console is still in the the `gaia/hub` folder, build the `gaia.hub` i
1. Enter the following `docker` command at the console command line.
1. Enter the following `docker` command at the console command line.
```
```bash
docker build -t gaia.hub .
docker build -t gaia.hub .
```
```
This build users the `Dockerfile` already in the `gaia/hub` folder. The output of the command is similar to the following:
This build users the `Dockerfile` already in the `gaia/hub` folder. The output of the command is similar to the following:
@ -30,7 +30,7 @@ You should store a JSON configuration file either in the top-level directory of
```
```
You can specify the logging level, the backend driver, the credentials
You can specify the logging level, the backend driver, the credentials
for that backend driver, and the `readURL` of the hub. Typically, this is the URL for the compute resource on the cloud computing provider— where the hub service is running.
for that backend driver, and the `readURL` of the hub. Typically, this is the URL for the compute resource on the cloud computing provider, where the hub service is running.
### Require the correct hub URL
### Require the correct hub URL
@ -80,7 +80,7 @@ different users.
### Private-user hub
### Private-user hub
A private-user hub receives requests for a single user. Requests are controlled
A private-user hub receives requests for a single user. Requests are controlled
via _whitelisting_ the addresses allowed to write files. Recall that each application uses a different app- and user-specific address. It follows, to
via _whitelisting_ the addresses allowed to write files. Recall that each application uses a different app and user-specific address. It follows, to
support application storage, your configuration must add to the whitelist each application you wish to use.
support application storage, your configuration must add to the whitelist each application you wish to use.
Alternatively, the user's client can use the authentication scheme and generate
Alternatively, the user's client can use the authentication scheme and generate
If you develop in TypeScript, the type checker can help prevent you from creating wrongly-typed Clarity values. For example, the following code won't compile since in Clarity lists are homogeneous, meaning they can only contain values of a single type. It is important to include the type variable `BooleanCV` in this example, otherwise the typescript type checker won't know which type the list is of and won't enforce homogeneity.
If you develop in Typescript, the type checker can help prevent you from creating wrongly typed Clarity values. For example, the following code won't compile since in Clarity lists are homogeneous, meaning they can only contain values of a single type. It is important to include the type variable `BooleanCV` in this example, otherwise the typescript type checker won't know which type the list is of and won't enforce homogeneity.
```js
```js
const l = listCV <BooleanCV> [trueCV(), intCV(1)];
const l = listCV <BooleanCV> [trueCV(), intCV(1)];
With the above example configuration, the following are true:
With the above example configuration, the following are true:
- The price of "john" would be 2 \* 10^8, since "john" falls into bucket 4 and has no punctuation or numerics.
- The price of `john` would be 2 \* 10^8, since `john` falls into bucket 4 and has no punctuation or numerics.
- The price of "john1" would be 2 \* 10^6, since "john1" falls into bucket 5 but has a number (and thus receives a 10x discount)
- The price of `john1` would be 2 \* 10^6, since `john1` falls into bucket 5 but has a number (and thus receives a 10x discount)
- The price of "john_1" would be 2 \* 10^6, since "john_1" falls into bucket 6 but has a number and punctuation (and thus receives a 10x discount)
- The price of `john_1` would be 2 \* 10^6, since `john_1` falls into bucket 6 but has a number and punctuation (and thus receives a 10x discount)
- The price of "j0hn_1" would be 2 \* 10^5, since "j0hn_1" falls into bucket 6 but has a number and punctuation and lacks vowels (and thus receives a 100x discount)
- The price of `j0hn_1` would be 2 \* 10^5, since `j0hn_1` falls into bucket 6 but has a number and punctuation and lacks vowels (and thus receives a 100x discount)
### NAME_IMPORT
### NAME_IMPORT
@ -398,7 +398,7 @@ Description: This transaction registers a name and some name state into a
namespace that has been revealed, but not been launched. Only the namespace
namespace that has been revealed, but not been launched. Only the namespace
creator can import names. See the [namespace creation section](/technology/naming-system) for details.
creator can import names. See the [namespace creation section](/technology/naming-system) for details.
Description: This transaction transfers tokens from one account to another. Only `STACKS` tokens can be transferred at this time. The transaction encodes the number of _micro-Stacks_ to send.
Description: This transaction transfers tokens from one account to another. Only `STACKS` tokens can be transferred at this time. The transaction encodes the number of _micro-Stacks_ to send.