@ -400,7 +400,7 @@ Each service plays a particular role in running your Gaia hub.
</tr>
<tr>
<td><code>nginx</code></td>
<td>Runs an Nginx proxy in front of the Gaia Hub. This service does things like rate-limiting, SSL termination, and redirects to HTTPS. Your nginx service relies on your hub's <code>readURL</code> to make requests. Changes to a hub's <code>readURL</code> must be reflected in the <code>nginx</code> service configuration in <code>/gaia/nginx/conf.d/default.conf</code></td>
<td>Runs an Nginx proxy in front of the Gaia Hub. This service does things like rate-limiting, SSL termination, and redirects to HTTPS. Your nginx service relies on your hub's <code>readURL</code> to make requests. Changes to a hub's <code>readURL</code> must be reflected in the <code>nginx</code> service configuration in <code>/gaia/nginx/conf.d/default.conf</code></td>
</tr>
<tr>
<td><code>gaia-admin</code></td>
@ -409,7 +409,7 @@ Each service plays a particular role in running your Gaia hub.
<tr>
<td><code>gaia-reader</code></td>
<td>The Gaia read side-car services get file requests on URLs that start with
your Gaia hub's <code>readURL</code>. You can determine your Gaia hub's read URL by either
your Gaia hub's <code>readURL</code>. You can determine your Gaia hub's read URL by either
looking for the <code>readURL</code> key in your Gaia hub's config file. This value is or by looking for
the <code>read_url_prefix</code> field in the data returned by a <code>HUB_URL/hub_info</code> page on your
@ -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.
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">
<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:
```
"Resource": "arn:aws:s3:::meepers/*"
```yaml
'Resource': 'arn:aws:s3:::meepers/*'
```
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.
8. Use `s3cmd` to enact the policy.
```
```bash
s3cmd setpolicy gaiahub-policy s3://<SPACE_NAME>
```
Be sure to `SPACE_NAME` with the name of your space, for example:
```
```bash
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.
```
```bash
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.
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.
@ -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.
```
```bash
Welcome to DigitalOcean's One-Click Docker Droplet.
To keep this Droplet secure, the UFW firewall is enabled.
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.
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.
@ -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.
Successful output from this command looks like the following.
```
```bash
Cloning into 'gaia'...
remote: Enumerating objects: 63, done.
remote: Counting objects: 100% (63/63), done.
@ -294,48 +294,48 @@ You should have the console open as `root` on your Droplet. In this section, you
2. Change to `hub` directory in the `gaia` code.
```
```bash
cd gaia/hub
```
3. Copy the configuration sample to a new `config.json` file.
```
```bash
cp config.do.sample.json config.json
```
4. Edit your new `config.json` file with `vi` or `vim`.
```
```bash
vi config.json
```
You now need to edit this JSON file to have it store files on your DigitalOcean space.
```
```json
{
"serverName": "DROPLET_NAME",
"port": 4000,
"driver": "aws",
"readURL": "SPACE_URL",
"proofsConfig": {
"proofsRequired": 0
},
"pageSize": 20,
"bucket": "SPACE_NAME",
"awsCredentials": {
"serverName": "DROPLET_NAME",
"port": 4000,
"driver": "aws",
"readURL": "SPACE_URL",
"proofsConfig": {
"proofsRequired": 0
},
"pageSize": 20,
"bucket": "SPACE_NAME",
"awsCredentials": {
"endpoint": "SPACE_LOCATION",
"accessKeyId": "YOUR_ACCESS_KEY",
"secretAccessKey": ""
},
"argsTransport": {
"level": "debug",
"handleExceptions": true,
"stringify": true,
"timestamp": true,
"colorize": false,
"json": true
}
},
"argsTransport": {
"level": "debug",
"handleExceptions": true,
"stringify": true,
"timestamp": true,
"colorize": false,
"json": true
}
}
```
@ -344,12 +344,12 @@ 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.
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.
9. Copy the **Key** and paste it into the `accessKeyId` value in the `config.json` file.
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.
10. Copy the **Secret** and paste it into the `secretAccessKey` value in the `config.json` file.
11. In the DigitalOcean dashboard, choose the Spaces page.
12. Copy the section of your space URL that follows the name.
@ -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.
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
{
@ -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.
@ -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.
```
```bash
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:
@ -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
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
@ -80,7 +80,7 @@ different users.
### Private-user hub
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.
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
const l = listCV <BooleanCV> [trueCV(), intCV(1)];
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 "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 "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 `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 `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)
### 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
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.
It looks like we see some failed tests. That is on purpose - we will implement the new smart contract in the next steps. After every step in this tutorial, we will rerun the tests to ensure we're on the right track.