### Install Go SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/go.md Install the Phase Go SDK using the go get command. Ensure you are using version 2 or later for the pure Go implementation. ```fish go get github.com/phasehq/golang-sdk/v2/phase ``` -------------------------------- ### Install Docker and Docker Compose Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/aws.md Execute the downloaded installation script to install Docker and Docker Compose. ```fish sh install.sh ``` -------------------------------- ### Install Phase CLI on Linux Source: https://github.com/phasehq/docs/blob/main/public/quickstart.md Download and execute the installation script to install the Phase CLI on Linux systems. ```fish curl -fsSL https://pkg.phase.dev/install.sh | sh ``` -------------------------------- ### Download and Install Docker Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/digitalocean.md Download the official Docker installation script and make it executable. Then, run the script to install Docker and Docker Compose. ```fish curl https://get.docker.com > install.sh && chmod +x install.sh ``` ```fish sh install.sh ``` -------------------------------- ### Install Phase CLI on Linux Source: https://github.com/phasehq/docs/blob/main/public/integrations/platforms/claude-code.md Download and execute the installation script to install the Phase CLI on Linux. Ensure you have curl installed. ```fish curl -fsSL https://pkg.phase.dev/install.sh | sh ``` -------------------------------- ### Define Docker Container Start Command with Phase Run (Multiple Commands) Source: https://github.com/phasehq/docs/blob/main/public/integrations/platforms/docker.md Use the CMD instruction in your Dockerfile to define a series of commands. This example demonstrates running multiple commands, including database migrations and server startup, with Phase secrets. ```dockerfile FROM your-base-image # ... (other Docker commands, e.g., installing dependencies, etc.) # Use CMD to define a series of commands with correct format and escaping, including Phase CLI version specification if needed. CMD ["sh", "-c", "phase run \"python manage.py migrate && python manage.py runserver payments-api:8000\""] ``` -------------------------------- ### Install the SDK with npm Source: https://github.com/phasehq/docs/blob/main/public/sdks/js.md Install the Phase JavaScript SDK using npm. Ensure you have Node.js and npm installed. ```bash npm i @phase.dev/phase-js ``` -------------------------------- ### Install Phase CLI on Linux Source: https://github.com/phasehq/docs/blob/main/public/cli/install.md Installs the Phase CLI on Linux by downloading and executing an installation script. You can optionally specify a version. ```fish curl -fsSL https://pkg.phase.dev/install.sh | sh ``` ```fish # curl -fsSL https://pkg.phase.dev/install.sh | sh -s -- --version 2.0.0 ``` -------------------------------- ### Install the SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/python.md Install the Python SDK using pip. ```APIDOC ## Install the SDK The Python SDK is distributed via [PyPI](https://pypi.org/project/phase-dev/). You can install it using the following command: ### Install ```fish pip install phase-dev ``` ``` -------------------------------- ### Bitbucket Pipeline Example Source: https://github.com/phasehq/docs/blob/main/public/integrations/platforms/bitbucket-pipelines.md This YAML snippet demonstrates how to set up a Bitbucket pipeline to install the Phase CLI, export secrets, and then use those secrets for Docker login, build, and push operations. Pin the CLI to a specific version using the --version flag for reproducible builds. ```yaml image: atlassian/default-image:2 pipelines: default: - step: name: Prepare script: - curl -fsSL https://pkg.phase.dev/install.sh | sh -s -- --version - export $(phase secrets export --app "my application name" --env prod DOCKERHUB_USERNAME DOCKERHUB_TOKEN | xargs) - step: name: Build and Push script: - docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_TOKEN - docker build -t my-image . - docker push my-image:latest ``` -------------------------------- ### Install the SDK with yarn Source: https://github.com/phasehq/docs/blob/main/public/sdks/js.md Install the Phase JavaScript SDK using yarn. Ensure you have Node.js and yarn installed. ```bash yarn add @phase.dev/phase-js ``` -------------------------------- ### Install the SDK with pnpm Source: https://github.com/phasehq/docs/blob/main/public/sdks/js.md Install the Phase JavaScript SDK using pnpm. Ensure you have Node.js and pnpm installed. ```bash pnpm i @phase.dev/phase-js ``` -------------------------------- ### Install Python SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/python.md Install the Phase Python SDK using pip. This command fetches and installs the latest version from PyPI. ```fish pip install phase-dev ``` -------------------------------- ### Install the SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/js.md Install the JavaScript SDK using npm, yarn, or pnpm. ```APIDOC ## Install the SDK The JavaScript SDK is distributed via [npm](https://www.npmjs.com/package/@phase.dev/phase-js). You can install it using the following command for your preferred package manager. ### npm ```bash npm i @phase.dev/phase-js ``` ### yarn ```bash yarn add @phase.dev/phase-js ``` ### pnpm ```bash pnpm i @phase.dev/phase-js ``` ``` -------------------------------- ### Install Node.js SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/node.md Install the Node.js SDK using your preferred package manager. ```fish npm i @phase.dev/phase-node ``` ```fish yarn add @phase.dev/phase-node ``` ```fish pnpm i @phase.dev/phase-node ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/phasehq/docs/blob/main/CONTRIBUTING.md Use this command to install all necessary project dependencies. Ensure you have npm or yarn installed. ```bash npm install ``` ```bash yarn install ``` -------------------------------- ### Install Phase CLI on Alpine Linux Source: https://github.com/phasehq/docs/blob/main/public/cli/install.md Installs curl if not present, then uses it to download and execute the Phase CLI installation script on Alpine Linux. ```fish apk add --no-cache curl curl -fsSL https://pkg.phase.dev/install.sh | sh ``` -------------------------------- ### Install Phase CLI on NixOS Source: https://github.com/phasehq/docs/blob/main/public/quickstart.md Use Nix to install the phase-cli package on NixOS. ```fish nix-shell -p phase-cli ``` -------------------------------- ### Download Docker Installation Script Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/aws.md Download the official Docker installation script. It is recommended to review the script before execution. ```fish curl https://get.docker.com > install.sh && chmod +x install.sh ``` -------------------------------- ### Install eksctl Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/skills/eks/refs/eks-deployment.md Installs the latest version of eksctl to /usr/local/bin. Ensure you have the necessary permissions to write to this directory. ```bash curl --silent --location \ "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" \ | tar xz -C /tmp && \ sudo mv /tmp/eksctl /usr/local/bin ``` -------------------------------- ### Install Docker on Raspberry Pi Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/raspberrypi.md Installs Docker using a convenience script. After installation, add your user to the docker group to run commands without sudo. Log out and back in for changes to take effect. ```fish wget -O install_docker.sh https://get.docker.com chmod +x install_docker.sh sudo ./install_docker.sh ``` ```fish sudo usermod -aG docker $USER ``` ```fish exit ``` -------------------------------- ### Start Production Server Source: https://github.com/phasehq/docs/blob/main/CONTRIBUTING.md Launches the production-ready server for Phase Docs. ```bash npm run start ``` ```bash yarn start ``` -------------------------------- ### Bare Metal (MetalLB) NGINX Ingress Controller Installation Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/skills/k8s/refs/k8s-deployment.md Installs the NGINX Ingress Controller on a bare-metal setup after MetalLB has been installed. Assumes MetalLB is already configured. ```bash helm install ingress-nginx ingress-nginx/ingress-nginx \ --namespace ingress-nginx --create-namespace \ --set controller.publishService.enabled=true ``` -------------------------------- ### Start FastAPI App with Phase Source: https://github.com/phasehq/docs/blob/main/public/integrations/frameworks/fast-api.md Use this command to start your FastAPI application with Phase injecting secrets at runtime. This example uses uvicorn. ```fish phase run uvicorn main:app --reload ``` -------------------------------- ### Get Environment Response Source: https://github.com/phasehq/docs/blob/main/public/public-api/environments.md Example JSON response when retrieving a single environment. ```json { "id": "af6b7a8e-c268-48c2-967c-032e86e26110", "name": "Development", "envType": "dev", "index": 0, "createdAt": "2024-06-01T12:00:00Z", "updatedAt": "2024-06-01T12:00:00Z" } ``` -------------------------------- ### Initialize Phase Project Source: https://github.com/phasehq/docs/blob/main/public/integrations/platforms/claude-code.md Link your local project directory to a Phase application and environment. This creates a .phase.json configuration file. ```fish > cd /path/to/your/project > phase init ``` -------------------------------- ### Get Dynamic Secrets Source: https://github.com/phasehq/docs/blob/main/src/pages/public-api/dynamic-secrets.mdx Fetch dynamic secrets using the /v1/secrets/dynamic/ endpoint. This example shows the structure of the response, including secret keys and lease details. ```json { "id": "87aef716-9064-4a4a-8079-f5c132693ee2", "name": "AWS IAM credentials", "description": "", "secret": "e30c989a-e032-4328-8220-5b7e6044808b", "ttl": "01:00:00", "status": "active", "credentials": [ { "key": "AWS_USERNAME", "value": "kl498xd8f" }, { "key": "AWS_ACCESS_KEY_ID", "value": "AKIAVYOQRZOLGMVWFM2H" }, { "key": "AWS_SECRET_ACCESS_KEY", "value": "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" } ], "createdAt": "2025-09-12T07:46:41.729641Z", "renewedAt": null, "expiresAt": "2025-09-12T08:46:41.729423Z", "revokedAt": null, "deletedAt": null } ``` -------------------------------- ### Phase Values File for In-cluster Database Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/aws-eks.md Configuration values for installing Phase with an in-cluster database setup. Includes global settings, ingress, and cert-manager configurations. ```yaml global: host: "phase.your-domain.com" # ๐Ÿ‘ˆ Replace with your domain version: "latest" # ๐Ÿ‘ˆ Replace with your preferred version https://github.com/phasehq/console/releases phaseSecrets: phase-console-secret ingress: enabled: true className: "nginx" annotations: {} certManager: enabled: true issuerName: "letsencrypt-prod" issuerKind: "ClusterIssuer" ``` -------------------------------- ### Set Up Phase Database and User Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/aws.md Execute SQL commands to create the necessary database and user for Phase API, granting all privileges. ```sql CREATE DATABASE phase_db; CREATE USER phase_api WITH PASSWORD 'your-password'; GRANT ALL PRIVILEGES ON DATABASE phase_db TO phase_api; ``` -------------------------------- ### Update Secrets using Go Source: https://github.com/phasehq/docs/blob/main/src/pages/public-api/secrets.mdx This Go code snippet provides a starting point for updating secrets. It includes necessary imports and the beginning of an HTTP request setup. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { ``` -------------------------------- ### Get Member API Response Source: https://github.com/phasehq/docs/blob/main/public/public-api/members.md Example JSON response when retrieving a single member. It includes the member's ID, username, full name, email, role, and timestamps. ```json { "id": "3f2e1d0c-9b8a-7654-3210-fedcba987654", "username": "alice", "fullName": "Alice Smith", "email": "alice@example.com", "role": { "id": "6aec9df5-cd75-4645-a9d0-8b6f6aff78d6", "name": "Developer" }, "createdAt": "2024-06-01T12:00:00Z", "updatedAt": "2024-06-01T12:00:00Z" } ``` -------------------------------- ### Run Development Server Source: https://github.com/phasehq/docs/blob/main/CONTRIBUTING.md Starts the local development server for Phase Docs. Access the project at http://localhost:3000 in your browser. ```bash npm run dev ``` ```bash yarn dev ``` -------------------------------- ### Install Phase CLI on Windows using .exe Source: https://github.com/phasehq/docs/blob/main/public/cli/install.md Download the latest .exe installer for your Windows architecture (amd64 or arm64) from the GitHub releases page. Rename it to phase.exe and add it to your system's PATH. ```fish # Download the latest .exe for your architecture from: # https://github.com/phasehq/cli/releases/latest # # phase_cli__windows_amd64.exe (Intel / AMD 64-bit) # phase_cli__windows_arm64.exe (ARM 64-bit) # # Rename to phase.exe and add it to a directory on your PATH. ``` -------------------------------- ### Define Docker Container Start Command with Phase Run (Single Command) Source: https://github.com/phasehq/docs/blob/main/public/integrations/platforms/docker.md Use the CMD instruction in your Dockerfile to define the default command for your container. This example shows how to run a single command with Phase secrets injected. ```dockerfile FROM your-base-image # ... (other Docker commands, e.g., installing dependencies, copying source code, etc.) # Use CMD to define the default command. Include --app, --env, and optionally --version flags to specify context. CMD ["sh", "-c", "phase run --app \"my application name\" --env \"production\" yarn start"] ``` -------------------------------- ### Download .env Template Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/tailscale.md Downloads the example .env file from the Phase Console GitHub repository. ```fish wget -O .env https://raw.githubusercontent.com/phasehq/console/main/.env.example ``` -------------------------------- ### Azure Pipelines YAML Example Source: https://github.com/phasehq/docs/blob/main/public/integrations/platforms/azure-pipelines.md This YAML pipeline installs the Phase CLI, exports secrets as environment variables, and uses them for Docker login and image pushing. Pin the CLI to a specific version using the --version flag for reproducible builds. ```yaml trigger: - master pool: vmImage: 'ubuntu-latest' stages: - stage: BuildAndPush jobs: - job: Prepare steps: - script: curl -fsSL https://pkg.phase.dev/install.sh | sh -s -- --version displayName: 'Install phase-cli' - script: | echo "##vso[task.setvariable variable=DOCKERHUB_USERNAME;]$(phase secrets export --app "my application name" --env prod DOCKERHUB_USERNAME | cut -d '=' -f2)" echo "##vso[task.setvariable variable=DOCKERHUB_TOKEN;]$(phase secrets export --app "my application name" --env prod DOCKERHUB_TOKEN | cut -d '=' -f2)" displayName: 'Export and set environment variables' - job: BuildAndPush dependsOn: Prepare steps: - script: | docker login -u $(DOCKERHUB_USERNAME) -p $(DOCKERHUB_TOKEN) docker build -t my-image . docker push my-image:latest displayName: 'Build and Push Docker image' ``` -------------------------------- ### Initialize the SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/node.md Initialize the SDK with your token. If you are self-hosting Phase, you must also provide the protocol and host for your Phase instance. ```APIDOC ## Initialize the SDK Initialize the SDK with your `token` ```typescript const token = 'pss_service...' // or process.env.PHASE_TOKEN const phase = new Phase(token) ``` If you are self-hosting Phase, you must also provide the protocol and host for your Phase instance: ```typescript const token = 'pss_service...' // or process.env.PHASE_TOKEN const host = 'https://console.phase.dev' // default const phase = new Phase(token, host) ``` ``` -------------------------------- ### Initialize Phase Project Source: https://github.com/phasehq/docs/blob/main/public/cli/usage.md Link your local project to a Phase application by creating a .phase.json file. This is optional; otherwise, you must use --app and --env flags. ```fish # cd /path/to/your/project phase init ``` -------------------------------- ### Initialize Phase Project Source: https://github.com/phasehq/docs/blob/main/public/integrations/platforms/jetbrains.md Link your project to a Phase app and environment. This creates a .phase.json file which stores app and environment IDs. ```bash phase init ``` -------------------------------- ### Install docker-compose on Raspberry Pi Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/raspberrypi.md Installs docker-compose using apt. Ensure your system is updated before installation. ```bash sudo apt update && sudo apt upgrade -y && sudo apt install -y docker-compose ``` -------------------------------- ### Phase CLI init Interactive Prompts Source: https://github.com/phasehq/docs/blob/main/public/cli/commands.md Demonstrates the interactive prompts during `phase init` for selecting an app, environment, and enabling monorepo support. ```fish > phase init ? Select an App: [use arrow keys] ferrari ยป keyspace inception Exit ? Choose a Default Environment: Development ? ๐Ÿฑ Monorepo support: Would you like this configuration to apply to subdirectories? (y/N) ``` -------------------------------- ### Install Helm Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/aws-eks.md Installs the Helm package manager for Kubernetes. This script fetches and executes the Helm installation process. ```bash curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash ``` -------------------------------- ### Check Docker Installation Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/skills/docker-compose/SKILL.md Verifies if Docker is installed on the system. If not, it instructs the user to install Docker and stops the process. ```bash which docker ``` -------------------------------- ### Basic Command Execution Source: https://github.com/phasehq/docs/blob/main/public/cli/commands.md Execute a command, such as starting a development server, with default settings. ```fish > phase run yarn dev ``` -------------------------------- ### Initialize Project Linking Source: https://github.com/phasehq/docs/blob/main/public/integrations/platforms/claude-code.md Link your current project to your Phase application. Run this command if tools report that the project is not linked. ```fish > phase init ``` -------------------------------- ### Initialize Python SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/python.md Initialize the Phase SDK with your service token and the Phase console host URL. Ensure the host URL is correct, especially for self-hosted instances. ```python phase = Phase( init=False, host='https://console.phase.dev', pss=PHASE_SERVICE_TOKEN ) ``` -------------------------------- ### Initialize the SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/python.md Initialize the SDK with your Phase service token or user token and the host URL. ```APIDOC ## Initialize the SDK Initialize the SDK with your Phase service token or user token and the host URL: ```python from phase import Phase # Using a service token # PHASE_SERVICE_TOKEN = "your_service_token" # phase = Phase( # init=False, # host='https://console.phase.dev', # pss=PHASE_SERVICE_TOKEN # ) # Using a user token (for personal secrets) # YOUR_PHASE_USER_TOKEN = "your_user_token" # phase = Phase( # init=False, # host='https://console.phase.dev', # pss=YOUR_PHASE_USER_TOKEN # ) ``` If you are self-hosting Phase, make sure to use the correct host URL for your Phase instance. ``` -------------------------------- ### Install Phase CLI on Windows with Scoop Source: https://github.com/phasehq/docs/blob/main/public/cli/install.md Add the phasehq/cli bucket to Scoop and then install the Phase CLI. This is for Windows users who prefer using Scoop for package management. ```fish scoop bucket add phasehq https://github.com/phasehq/scoop-cli.git scoop install phase ``` -------------------------------- ### Create Working Directory Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/tailscale.md Creates the necessary directories for Phase and Tailscale configuration and navigates into the new directory. ```fish mkdir -p phase-tailscale/nginx phase-tailscale/tailscale && cd phase-tailscale ``` -------------------------------- ### Install Phase CLI on macOS with Homebrew Source: https://github.com/phasehq/docs/blob/main/public/cli/install.md Use this command to install the Phase CLI on macOS using Homebrew. Ensure you have Homebrew installed and have tapped the phasehq/cli repository. ```fish brew tap phasehq/cli && brew trust phasehq/cli brew install phase ``` -------------------------------- ### Example Secret Response Source: https://github.com/phasehq/docs/blob/main/public/public-api/secrets.md This is an example of a secret response object from the API. ```json [{{ "id": "36fc2244-47f5-4ff4-8b72-deed1bf876da", "key": "DEBUG", "value": "False", "type": "secret", "lifecycle": "static", "comment": "Debug mode for the backend app", "tags": ["config"], "override": {{ "id": "904a64c7-95df-470f-aa58-6beaa55dea3c", "value": "True", "isActive": true, "createdAt": "2024-04-11T15:03:02.029689Z", "updatedAt": "2024-04-11T15:03:02.032630Z" }}, "path": "/backend", "keyDigest": "2bba3630bec4829f3f98b9fd7548e4f782df43a24ba5d94c2dd80e1fe618c65e", "version": 2, "createdAt": "2024-02-13T13:41:45.551255Z", "updatedAt": "2024-02-14T07:44:10.926591Z", "environment": "af6b7a8e-c268-48c2-967c-032e86e26110" }}] ``` -------------------------------- ### Initialize the Go SDK Source: https://github.com/phasehq/docs/blob/main/public/sdks/go.md Initialize the Phase client with your service or user token and the Phase Console host. Debug logging can be enabled for troubleshooting. ```go package main import ( "log" "github.com/phasehq/golang-sdk/v2/phase" ) func main() { token := "pss_service:v1:....." host := "https://console.phase.dev" // Adjust this for a self-hosted instance of Phase debug := false // For logging verbosity, disable in production p, err := phase.New(token, host, debug) if err != nil { log.Fatalf("Failed to initialize Phase client: %v", err) } _ = p // Use the client to manage secrets: p.Get(...), p.Create(...), etc. } ``` -------------------------------- ### Install cert-manager Source: https://github.com/phasehq/docs/blob/main/public/self-hosting/kubernetes.md Installs the cert-manager component on Kubernetes. Replace the version with the latest release. ```bash kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.17.2/cert-manager.yaml ``` -------------------------------- ### Service Account Response Example Source: https://github.com/phasehq/docs/blob/main/public/public-api/service-accounts.md Example JSON response when listing service accounts. ```json { "data": [ { "id": "8ab27128-02d8-42c1-b893-12acaffbbd4b", "name": "deploy-bot", "role": { "id": "d3a2124c-9770-42d5-abf8-599b4a372e9d", "name": "Service" }, "createdAt": "2024-06-01T12:00:00Z", "updatedAt": "2024-06-01T12:00:00Z" } ] } ```