Setup in three steps:

There are basically three steps to setup and start using ShimmerCat Accelerator, plus one more to serve a website with ShimmerCat.

If you have any questions or feedback, don't hesitate to contact us at ops@shimmercat.com or through our ticket system.

1. Create an authentication token that will work for at least a complete week

Please note that for the command below (and any other on this tutorial) you should use single quotes ' and double quotes " otherwise they could fail.

$ curl -X POST https://accelerator.shimmercat.com/presentation-api/v1/trial/ -H 'Content-type: application/json' -d '{"username": "<your_username>"}'

This command above will create a user for you in the Accelerator database with the username provided in the request data field your_username and will also create an authentication token linked to that user that we will return on the response. See the response data below:

{"authentication_token": "<your_authentication_token>"}

After a week we will disable your authentication token, and your domains, but we will hold your data on our databases, and if you decide to use our services for more than a week we will enable all of it for you again. We will be happy to assist you so please feel free to reach us at ops@shimmercat.com.

2. Setup your edge servers with sc_pack

We will assume you install the sc_pack on a directory on your home: /home/shimmercat/test/shimmercat-accelerator that you should have already created, and we will assume it is what we call the install_dir.

$ cd /home/shimmercat/test/shimmercat-accelerator
curl -O $(curl -s  https://accelerator.shimmercat.com/presentation-api/v1/download/sc_pack/?format=json | jq -r .download_url)
$ sudo apt-get install python3 python3-dev virtualenv git
$ virtualenv venv -p python3
$ source venv/bin/activate
$ pip install /home/shimmercat/test/shimmercat-accelerator/sc_pack-0.1.553-py3-none-any.whl
$ sc_pack version
$ 0.1.553
---
# This is a YAML document with the configuration items
# we need to set up the server with sc_pack.
# For the format, see example below.
#
# All the directories defined are relative to install_dir
shimmercat:
    root_dir: www
    devlove_file_path: devlove.yaml
    scratch_dir_name: shimmercat-scratch-folder
    listen_port: "4043"
    http2https_port: "8084"
    bots_views_dir: views-dir
# Update this value with the value of your authentication token
api_access_token: <your_authentication_token>
user: shimmercat
user_group: shimmercat
# Update this path with the path you want the sc_pack files to be at
install_dir: /home/shimmercat/test/shimmercat-accelerator
logs_host_name: localhost
# Update this value with the value of your deployment site's `name16` you will create on the next step
deployment_site_long_name: <your_name16>
# Update this value with the value of your deployment site's `secret16` you will create on the next step
deployment_site_long_secret: <your_secret16>
amqp_server_url: amqp.staging.c.shimmercat.com
amqp_vhost: skyloft
enable_bots_blocking: True
humanity_validator_host: localhost
humanity_validator_port: 8080
google_recaptcha_site_key: 6LfimFIUAAAAAACMycLvA3wetRR9v6ejSbf7uu2v
google_recaptcha_site_secret: 6LfimFIUAAAAAEpCe1QNHwr2p46AMKbUoOBdLWbE
transit_encryption_key: test-accelerator.shimmercat.com.no_enc
deployment_group: test
dht_bind_port: 48101
dht_bootstrap_node: dht.shimmercat.com:26131

If you don't have a user shimmercat you can either create it, or use a different one, in any case please be sure to update the user and user_group above accordingly.

You can also get a similar copy of the config file by typing the sc_pack command:

$ sc_pack extract example.sc_pack.conf.yaml
$ sc_pack create -f /home/shimmercat/test/shimmercat-accelerator/sc_pack.conf.yaml

or

$ sc_pack create

... if you have already a file called sc_pack.conf.yaml on the directory from where you are running that command.

Subject to the same rule, it's possible to omit the -f in many sc_pack sub-commands. E.g, if the current dir is /home/shimmercat/test/shimmercat-accelerator and the file /home/shimmercat/test/shimmercat-accelerator/sc_pack.conf.yaml exists and you run sc_pack create, the configuration file taken is /home/shimmercat/test/shimmercat-accelerator/sc_pack.conf.yaml.

$ ls
$ celery redis shimmercat   devlove.yaml sc_logs_agent shimmercat-scratch-folder views-dir  # And some others
$ sc_pack supervisord

You will see some logs like:

2018-09-18 14:52:00,385 INFO success: redis entered RUNNING state,
process has stayed up for > than 10 seconds (startsecs)

2018-09-18 14:52:00,385 INFO success: shimmercat entered RUNNING state,
process has stayed up for > than 10 seconds (startsecs)

2018-09-18 14:52:00,385 INFO success: kv_store entered RUNNING state,
process has stayed up for > than 10 seconds (startsecs)

2018-09-18 14:52:00,385 INFO success: humanity_validator entered RUNNING state,
process has stayed up for > than 10 seconds (startsecs)

To start the accelerator at boot time see here.

Inside every service directory there is a directory data where we store the logs for each service, if there are errors please check the logs for more details. For instance if you see celery (exit status 1; not expected) on the logs you can see more details about what is happening with celery on /home/shimmercat/test/shimmercat-accelerator/celery/data/celery.log. It is expected that the celery, and the sc_logs_agent don't start with that configuration because we are yet missing the deployment_site_long_name, and deployment_site_long_secret that are needed to let the celery authenticates with the celery broker. See the next section to learn how to get them.

To learn more about how to install sc_pack, see the information on Install sc_pack.

3. Create deployments sites and domains

Create a deployment site, be sure you update the token below with the one you got:

$ curl -X POST https://accelerator.shimmercat.com/presentation-api/v1/deployment-site/ -H 'Authorization: Token <your_authentication_token>' -H 'Content-type: application/json' -d '{"description": "Deployment site on server 'test1'"}'

You will get that response data:

{
  "id":<your_deployment_id>,
  "customer": {
      "id": <your_customer_id>,
      "name":"ShimmerCat Accelerator Test"
  },
  "description":"Deployment site on sever test1",
  "name16":"<your_deployment_site_long_name>",
  "secret16":"<your_deployment_site_long_secret>"
}

Go an update the sc_pack.conf.yaml with the deployment_site_long_name, and deployment_site_long_secret, and now the celery should run smoothly. Once it is running the accelerator platform will automatically send the encryption key the sc_logs_agent needs to run, and it will start automatically, at least when the supervisor is running on the background.

$ curl -X POST https://accelerator.shimmercat.com/presentation-api/v1/domain/ -H 'Authorization: Token <your_authentication_token>' -H 'Content-type: application/json' -d '{"name": "example-accelerator.shimmercat.com", "deployment_site_id": 48}'

Note that you need to use the "deployment_site_id":<your_deployment_id> to let know the accelerator that the domain you are creating will be linked to the deployment site with this id. You will get a response like:

{"id":<your_domain_id>,"name":"example-accelerator.shimmercat.com","sub_domains":[]}

To add more deployment sites to your domain, see the information on Adding a new deployment for an existing domain for further details.

Serve a website with ShimmerCat

As you can see on the your install_dir /home/shimmercat/test/shimmercat-accelerator we have there a devlove.yaml file that was automatically created when you ran the sc_pack create command, it is the ShimmerCat's server config file, so if you modify it with this content below:

---
shimmercat-devlove:
      domains:
          elec example-accelerator.shimmercat.com:
              root-dir: www

and you download our static website example and decompress it under /home/shimmercat/test/shimmercat-accelerator/www you will have a running website with our accelerator. Be sure that either the file /home/shimmercat/test/shimmercat-accelerator/www/index.html is present after you decompress it, or that your devlove.yaml has the root-dir: www/tutorial-1 because the content of the compressed file will probably end inside a directory with the same name than it if you use the Extract here option of your Operating system right click.

You will need to modify your /etc/hosts to have that line: 127.0.0.1 example-accelerator.shimmercat.com though.

Be sure the sc_pack supervisord command is running, open a browser and visit: https://example-accelerator.shimmercat.com:4043/.

Something does not work for you as we explain here? Take a look to our troubleshooting section.

You are now ready to use the accelerator for the domain example-accelerator.shimmercat.com. We will let you know on the next tutorials how to:

Thanks a lot for your time, and keep reading!