Skip to content

Commit

Permalink
merge with tony's docs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
maidul98 committed Nov 20, 2022
2 parents 83f56e0 + 067d8ff commit e64ba7e
Show file tree
Hide file tree
Showing 27 changed files with 328 additions and 216 deletions.
10 changes: 5 additions & 5 deletions docs/contributing/developing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ cp .env.example .env

```bash
# build and start the services
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up --build
docker-compose -f docker-compose.dev.yml up --build
```

Then browse http://localhost:3000
Then browse http://localhost:8080

```bash
# To stop environment use Control+C (on Mac) CTRL+C (on Win) or
docker-compose down
docker-compose -f docker-compose.dev.yml down
# start services
docker-compose up
docker-compose -f docker-compose.dev.yml up
```

The docker-compose environment consists of:
The docker-compose development environment consists of:

- frontend
- backend
Expand Down
65 changes: 45 additions & 20 deletions docs/getting-started/cli/cli-guide.mdx
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
---
title: "Infisical CLI"
description: "Learn about each supported command and its flags"
title: "Usage"
---

## Background
Prerequisite: [Install the CLI](../../getting-started/cli/installation)

Infisical ships with multiple commands to assist with ongoing project needs; we list these commands and give context for them below.
## Login

<Card title="Install the CLI" icon="lightbulb" href="/installCLI">
If you haven't already, install the Infisical CLI
</Card>
Login in using the `login` command in your terminal. Logging in is a one-time, post-installation action that authenticates you with the platform — to change users, you can run the command again.

Note on arguments:
```bash
infisical login
```

- [environment]: the intended environment for the given command being one of dev, staging, or prod.
- [projectId]: the project identifier found on the dashboard.
## Initialization

## Commands
In the root of your local project, initialize Infisical and follow steps to connect your project to the platform.

- `login` used to set the logged in user. Your credentials are saved securely in your system key ring. Note: only one user can be logged in at a time. To change the logged in user, run the command again and overwrite the previous login.
- `init` used to link your infisical.com project to your local project. Run this command ideally at the root of your local project. You will have to run this command for each new project you create locally.
- `run` used to inject your secrets as environment variables into your application process. Example `infisical run --stage=prod -- npm run start`
- `---projectId` flag is used to link your local project to a Infisical.com project. Use this option only when you are injecting via Infisical Token instead of your login.
- `---stage` flag is used to set the environment from which your secrets are pulled from. By default, secrets from your project are pulled from the `dev`. To change to for example prod, add `--stage=prod`
```bash
cd /path/to/project

### Global flags
These are flags you can add to any command
# initialization
infisical init
```

- `--domain` you may change this if you are self hosting Infisical. By default, the CLI points to Infisical.com backend. To point to your own backend, make sure to set this flag for each command you run. Example `infisical login --domain=https://mybackend.com`
- `--debug` use this flag when you want to see more logs related to the error you are receiving. By default debug logs are hidden. Example `infisical run --debug <your command>`
## Injecting environment variables

To inject environment variables from the platform to your project, use the `run` command.

```bash
# command
infisical run -- [your application start command]
```

Options you can specify:

| Option | Description | Default value |
| ------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |
| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` |
| `--projectId` | Used to link a local project to the platform (required only if injecting via the service token method) | `None` |

Examples:

```bash
# example with node
infisical run -- node index.js

# example with node (nodemon)
infisical run -- nodemon index.js

# example with node (nodemon) pulling in secrets from test environment
infisical run --env=test -- nodemon index.js

# example with flask
infisical run -- flask run
```
68 changes: 0 additions & 68 deletions docs/getting-started/cli/infisical-token.mdx

This file was deleted.

64 changes: 6 additions & 58 deletions docs/getting-started/cli/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: "Installation"
---

Prerequisite: [Setup an account](../../getting-started/dashboard/create-account) with Infisical Cloud or via self-hosted installation.

Follow the guide for your OS below to install the CLI.

<Tabs>
Expand Down Expand Up @@ -84,64 +86,10 @@ Follow the guide for your OS below to install the CLI.
| sudo -E bash
```

Then install CLI
```
$ apt-get update && apt-get install -y infisical
```
Then install CLI
```bash
$ apt-get update && apt-get install -y infisical
```

</Tab>
</Tabs>

## Usage

Once you have the CLI installed in your system, follow the guide to login and sync your first project.

#### Login

Login to the CLI by running the following command in your terminal

```
infisical login
```
<Info>
To authenticate without logging in manually, read about [Infisical
Token](/infisicalToken)
</Info>
#### Link secrets to your project After logging in, `CD` into the root of your local
project. Then run the following command in the terminal to link your Infisical project
to your local project.
```
infisical init
```
#### Inject
To inject the secrets from the Infisical project you have selected in step 2 into your application process, run the following command.
```
infisical run -- <your application start command>
```
Example:
```
infisical run -- npm run dev
```
By default, Infisical injects secrets from your development environment. To modify from which environment your secrets are pulled from, use the --stage flag
Example:
```
infisical run --stage=prod -- npm run dev
```
You're now automatically pulling and injecting secrets as environment variables into your application!
### Support
We're constantly improving Infisical, so we'd love to get your feedback and take feature requests.
Lastly, if you have any questions or inquiries, shoot an email over to [[email protected]](mailto:[email protected]) so we can assist you. Alternatively, feel free to post your question or DM us on Slack here; we'd be happy to connect with you.
55 changes: 55 additions & 0 deletions docs/getting-started/cli/reference.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: "Reference"
---

## Commands

| Command | Description | Options |
| ------- | -------------------------------------------------------------------- | ---------------------- |
| `login` | Used to authenticate and set the logged in user. |
| `init` | Used to link a local project to the platform. |
| `run` | Used to inject envars from the platform into an application process. | `--projectId`, `--env` |

## Global options

| Option | Description |
| ----------------- | ---------------------------------- |
| `--help`, `-h` | List help for any command |
| `--debug`, `-d` | Enable verbose logging |
| `--domain` | Use to direct Infisical to |
| `--version`, `-v` | Print version information and quit |

### Login

Used to authenticate and set the logged in user.

Post-authentication credentials are saved securely in your system keyring. Since only one user can be logged in at a time, to change the logged in user, run the command again to overwrite the previous login.

```bash
infisical login
```

### Init

Used to link a local project to the platform (cloud or self-hosted)

Run this command at the root of your local project. You will have to run this command for each new project you create locally.

```bash
infisical init
```

### Run

Used to inject environment variables from the platform into an application process.

```bash
infisical run [options] -- [your application start command]
```

Options you can specify:

| Option | Description | Default value |
| ------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |
| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` |
| `--projectId` | Used to link a local project to the platform (required only if injecting via the service token method) | `None` |
21 changes: 21 additions & 0 deletions docs/getting-started/cli/token.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: "Infisical Token"
---

Prerequisite: [Infisical Token and How to Generate One](../../getting-started/dashboard/token).

It's possible to use the CLI to sync environment varialbes without manually entering login credentials by using a service token in the prerequisite link above.

## Feeding Infisical Token to the CLI

The CLI looks out for an environment variable called the `INFISICAL_TOKEN` which you can set depending on where you run the CLI. If `INFISICAL_TOKEN` is detected by the CLI, it will authenticate and retrieve the environment variables which the token is authorized for.

A common use-case is to use the Infisical Token to fetch environment variables with Docker. More specifically, a token can be passed to a container as an environment variable for the CLI to authenticate and pull its corresponding secrets. Check out the integration guides for that:

- [Docker](../../integrations/docker)
- [Docker Compose](../../integrations/docker-compose)

<Info>
Once the token is expired, the CLI using it will no longer be able to make
requests with it.
</Info>
12 changes: 8 additions & 4 deletions docs/getting-started/dashboard/create-account.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "New Account"
title: "Sign up"
---

## Self-hosted
Expand All @@ -8,13 +8,17 @@ If you're using a self-hosted installation, follow the [setup](/self-hosting/ove

## Infisical Cloud

**Step 1.** Open [infisical.com](https://infisical.com/) and click on either "Try Infisical for free" or "Start for free" to head to the signup sequence.
**Step 1:** Open [infisical.com](https://infisical.com/) and click on either "Try Infisical for free" or "Start for free" to head to the signup sequence.

![title](../../images/landing-page.png)

**Step 2.** Fill out the signup sequence.
**Step 2:** Fill out the signup sequence.

After verifying your email address, you'll be prompted to fill out some required fields to set up your account.
![signup start](../../images/signup-box.png)
![signup one-time password](../../images/signup-otp.png)
![signup complete account](../../images/signup-complete-account.png)

You'll be prompted to fill out some required fields to set up your account.

| Field | Description |
| ---------- | --------------------------- |
Expand Down
13 changes: 13 additions & 0 deletions docs/getting-started/dashboard/integrations.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "Integrations"
---

We’re still early with integrations but you’ll be able to sync environment variables across your entire infrastructure from local development to CI/CD and production.

![integrations](../../images/project-integrations.png)

Check out integrations:

- Heroku
- Docker
- Docker Compose
23 changes: 23 additions & 0 deletions docs/getting-started/dashboard/token.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: "Infisical Token"
---

An Infisical Token is needed to authenticate the CLI when there isn't an easy way to manually type in your login credentials to sync environment variables to your applications.

It grants read-only access to a particular environment and project for a specified amount of time; once the token expires, any CLI application that relies on it for authentication will be denied access to retrieve related secrets.

This is useful in the following contexts:

- [Docker](../../integrations/docker)/[Docker-Compose](../../integrations/docker-compose) integration: An Infisical Token can be passed to a Docker container as an environment variable for the CLI to authenticate and pull its corresponding secrets.

## Generate an Infisical Token

It's possible to generate an Infisical token in the settings of a project.

![token add](../../images/project-token-add.png)

![token name](../../images/project-token-name.png)

![token added](../../images/project-token-added.png)

To use the Infisical Token in the CLI, check out the docs for that [here](../../getting-started/cli/token).
Loading

0 comments on commit e64ba7e

Please sign in to comment.