Now that all configuration is done, you are ready to initialize The Things Stack and start it!
Begin by opening a terminal prompt in the same directory as your docker-compose.yml
file.
Initialization
The first time The Things Stack is started, it requires some initialization. Start by pulling the Docker images:
$ docker-compose pull
Next, you need to initialize the database of the Identity Server:
$ docker-compose run --rm stack is-db init
Note:
If you receive an error running The Things Stack, make sure a The Things Stack container isn’t already running. Usedocker ps
to see running containers.
For the Storage Integration available in The Things Stack Enterprise, the database of the Application Server needs to be initialized as well:
$ docker-compose run --rm stack storage-db init
The Things Stack Enterprise requires a tenant to be present, even if multi-tenancy is not included in the license. You create a tenant with:
$ docker-compose run --rm stack is-db create-tenant
Note:
This will take thetenancy.default-id
Tenant ID from the configuration in ttn-lw-stack-docker.yml
. To specify another Tenant ID, use the --id
parameter.
Next, an initial admin
user has to be created. Make sure to give it a good password.
$ docker-compose run --rm stack is-db create-admin-user \
--id admin \
--email your@email.com
Then the command-line interface needs to be registered as an OAuth client:
$ docker-compose run --rm stack is-db create-oauth-client \
--id cli \
--name "Command Line Interface" \
--owner admin \
--no-secret \
--redirect-uri "local-callback" \
--redirect-uri "code"
Afterwards, the same needs to be done for the Console.
$ CONSOLE_SECRET="your-console-secret"
$ SERVER_ADDRESS="your-server-address"
$ docker-compose run --rm stack is-db create-oauth-client \
--id console \
--name "Console" \
--owner admin \
--secret "${CONSOLE_SECRET}" \
--redirect-uri "${SERVER_ADDRESS}/console/oauth/callback" \
--redirect-uri "/console/oauth/callback" \
--logout-redirect-uri "${SERVER_ADDRESS}/console" \
--logout-redirect-uri "/console"
Note:
If running a multi-tenant environment, use option--tenant-id NULL
to register the OAuth client for all tenants.
Note:
For--secret
, make sure to enter the same value as you set for console.oauth.client-secret
in the ttn-lw-stack-docker.yml
file in the Configuration step.
Running The Things Stack
Start The Things Stack with:
$ docker-compose up
This starts the stack, so you will see the stack logs being printed to your terminal. You can also start the stack in detached mode by adding -d
to the command above. In that case you can get logs with docker-compose logs
.
With The Things Stack up and running, follow Console or Command-line Interface to proceed with the login, then continue with connecting gateways, creating devices and working with streaming data.