Sign in and choose a project
Sign in to the CLI through your browser and learn how it decides which project and which environment a command acts on.
On this page
Before the CLI can work with your hosted website, it needs two things: who you are and which project you mean. You sign in once per computer, through your browser. The project is found from the Git checkout you are standing in, or from a name you give. The CLI never guesses a project.
Sign in
-
Start the sign-in. The first time, name the portal:
tilizy auth:login --portal-url https://app.tilizy.comThe command prints a short code and an address, and opens the address in your browser. Later sign-ins on the same computer remember the portal, so
tilizy auth:loginis enough. -
In the browser, sign in to the portal if you are not signed in yet. Check that the code on the page matches the code in your terminal, then authorise.
-
Return to the terminal. The CLI has picked up the sign-in and saved it on your computer. Your password never passes through the terminal.
-
Check who you are signed in as. The output shows your user and the portal:
tilizy auth:info
On a computer without a browser, add --no-browser. The command then only prints the address and the code, and you open the address on another device.
Sign out
tilizy auth:logout --revoke
Without --revoke, the command only forgets the sign-in on this computer, and the access stays valid until you revoke it in the portal in your profile, on the Devices page. With --revoke, the access of this computer ends at the portal as well. Your other computers keep theirs.
Sign in from a script
For continuous integration, create a token in the portal in your profile, on the Devices page. Pass it on standard input:
echo "$TOKEN" | tilizy auth:token --stdin --portal-url https://app.tilizy.com
Keep the token in the secret store of your pipeline. Add --no-input to every command a script runs, so that nothing waits for an answer.
How the CLI finds your project
A command that needs a project takes it from exactly two places:
- A name you give. Pass the short name of the project with
-p <project>. Many commands also accept it as an argument. - The checkout you are in. The CLI reads the address of the Git remote
originand matches it to the repository connected to a project.
There is no third way. The CLI does not remember the last project you used and does not pick one from a list. Outside a checkout, or in a repository that belongs to no project, a command without -p stops with an error. It never acts on a project you did not name.
Find and fetch a project
List every project you can open. Projects that are checked out on this computer are marked, with their folder:
tilizy project:list
Fetch a project you do not have yet. The command clones the repository into your projects folder and starts the website locally. With --data it also copies the live database, with personal data replaced, and the files:
tilizy project:setup <project> --data
If a checkout is not recognised, bind it once. The command reads the address of origin and stores it on the project:
tilizy project:link <project>
Choose the environment
| Flag | Environment |
|---|---|
-e local | The copy on your computer |
-e <branch> | The hosted environment of that branch |
--staging | The staging environment |
--prod | The live environment |
What happens without a flag depends on the command:
| Kind of command | Without a flag | Examples |
|---|---|---|
| Works locally and on hosted environments | Acts on the copy on your computer | app:start, app:stop, app:status, app:logs, app:shell, app:open, db:shell, db:dump, db:load |
| Works only on hosted environments | Acts on live | app:deploy, app:rollback, db:pull, backup:create, the files commands |
Each command states its scope in its --help, under the heading "Scope". Read it before you run a command against a hosted environment for the first time.
Warning:tilizy files:rmdeletes on live when you give no flag. Always pass-e <branch>or--stagingwhen you mean another environment.tilizy app:destroyis the exception: it refuses live and always needs-e <branch>.
What can go wrong
- A command stops because it has no project. Change into the checkout, or add
-p <project>. Do not script around the refusal: it is there so that a command never lands on the wrong website. - The checkout is not recognised. The address of
origindoes not match the repository connected to the project, for example after you moved the repository. Runtilizy project:link <project>. - A command is refused although you are signed in. What you may do is decided by your permissions on the project, not by the CLI. Having a command does not mean you are allowed to use it on every project.
-pdoes not help withapp:launchorapp:create. These read the project file from the checkout, so they must run inside the checkout of that project.
Next: Run your website locally and the command reference.