### Clone Convox example Node.js app Source: https://docs.convox.com/getting-started/introduction Clones the official Convox Node.js example application from GitHub. This is the first step in deploying a sample app to Convox. ```bash git clone https://github.com/convox-examples/nodejs.git ``` -------------------------------- ### Install Convox CLI for Linux (x86_64) Source: https://docs.convox.com/getting-started/introduction Installs the Convox CLI on Linux systems with x86_64 architecture. It downloads the binary, moves it to the system's PATH, and sets execute permissions. ```bash curl -L https://github.com/convox/convox/releases/latest/download/convox-linux -o /tmp/convox sudo mv /tmp/convox /usr/local/bin/convox sudo chmod 755 /usr/local/bin/convox ``` -------------------------------- ### Install Convox CLI for Linux (arm64) Source: https://docs.convox.com/getting-started/introduction Installs the Convox CLI on Linux systems with arm64 architecture. It downloads the binary, moves it to the system's PATH, and sets execute permissions. ```bash curl -L https://github.com/convox/convox/releases/latest/download/convox-linux-arm64 -o /tmp/convox sudo mv /tmp/convox /usr/local/bin/convox sudo chmod 755 /usr/local/bin/convox ``` -------------------------------- ### Install Convox CLI for macOS (arm64) Source: https://docs.convox.com/getting-started/introduction Installs the Convox CLI on macOS systems with arm64 architecture. It downloads the binary, moves it to the system's PATH, and sets execute permissions. ```bash curl -L https://github.com/convox/convox/releases/latest/download/convox-macos-arm64 -o /tmp/convox sudo mv /tmp/convox /usr/local/bin/convox sudo chmod 755 /usr/local/bin/convox ``` -------------------------------- ### Install Convox CLI for macOS (x86_64) Source: https://docs.convox.com/getting-started/introduction Installs the Convox CLI on macOS systems with x86_64 architecture. It downloads the binary, moves it to the system's PATH, and sets execute permissions. ```bash curl -L https://github.com/convox/convox/releases/latest/download/convox-macos -o /tmp/convox sudo mv /tmp/convox /usr/local/bin/convox sudo chmod 755 /usr/local/bin/convox ``` -------------------------------- ### Clone Rails example application Source: https://docs.convox.com/tutorials/local-development Clones the official Convox Rails example application from GitHub. This is the first step in setting up the local development environment. ```bash $ git clone https://github.com/convox-examples/rails.git ``` -------------------------------- ### Navigate to Node.js app directory Source: https://docs.convox.com/getting-started/introduction Changes the current directory to the root of the cloned Convox Node.js example application. This is necessary before deploying the app. ```bash cd nodejs ``` -------------------------------- ### Clone Example Rails Application (Shell) Source: https://docs.convox.com/tutorials/local-development Clones the example Rails application from the official Convox GitHub repository to the local machine. ```shell $ git clone https://github.com/convox-examples/rails.git ``` -------------------------------- ### Clone Example Node.js App Source: https://docs.convox.com/index Clones the example Node.js application repository from GitHub to get started with Convox deployments. ```git git clone https://github.com/convox-examples/nodejs.git ``` -------------------------------- ### Run Convox Application Locally with `convox start` Source: https://docs.convox.com/tutorials/local-development This command initiates the process of running your application locally against your development Rack. The first time `convox start` is executed, it may take longer due to uncached components. It involves building a Docker image with all necessary dependencies and then starting the application container. ```bash convox start ``` -------------------------------- ### Navigate to Example Application Directory (Shell) Source: https://docs.convox.com/tutorials/local-development Changes the current directory to the root of the cloned Rails application, preparing for further configuration and deployment. ```shell $ cd rails ``` -------------------------------- ### Deploy App with Convox CLI Source: https://docs.convox.com/getting-started/introduction This command packages and uploads your application source code for deployment to your Convox Rack. The first deployment may take longer due to initial build processes, but subsequent deployments are faster. After deployment, use `convox services` to get the app's URL. ```bash $ convox deploy Packaging source... OK Uploading source... OK Starting build... OK Authenticating 782231114432.dkr.ecr.us-east-1.amazonaws.com: Login Succeeded Building: . Sending build context to Docker daemon 48.95MB Step 1/5 : FROM node:10.16.3-alpine .......... $ convox services SERVICE DOMAIN PORTS web web.nodejs.0a1b2c3d4e5f.convox.cloud 443:3000 ``` -------------------------------- ### Start Minikube for Convox Rack Installation (Shell) Source: https://docs.convox.com/installation/development-rack/macos-m1 This command starts Minikube with specific configurations required for Convox development racks. It includes setting an insecure registry, specifying the Kubernetes version, and using the Docker driver. Ensure the RACK_NAME and k8s_VERSION are replaced with your actual values. ```bash minikube start --kubernetes-version= --insecure-registry="https://registry..macdev.convox.cloud" --driver=docker ``` -------------------------------- ### Run a Command on a Service Source: https://docs.convox.com/tutorials/local-development Executes a one-off command against a specified service within the Convox application. This example shows running a database migration and tests on the 'web' service. ```bash $ convox run web rake db:migrate test Finished in 5.053022s, 0.0000 runs/s, 0.0000 assertions/s. 0 runs, 0 assertions, 0 failures, 0 errors, 0 skips ``` -------------------------------- ### Start Minikube for Convox Rack Setup Source: https://docs.convox.com/installation/development-rack/macos This command starts Minikube with specific configurations required for Convox development racks. It sets the Kubernetes version, an insecure registry for Docker images, and uses the Docker driver. Ensure you replace `` and `` with your specific values. ```bash minikube start --kubernetes-version= --insecure-registry="https://registry..macdev.convox.cloud" --driver=docker ``` ```bash minikube start --kubernetes-version=v1.23.0 --insecure-registry="https://registry.test-local.macdev.convox.cloud" --driver=docker ``` -------------------------------- ### Clone NodeJS Example Application Source: https://docs.convox.com/tutorials/deploying-an-application This command clones the example NodeJS application from GitHub. This is the starting point for deploying a sample application to Convox. ```bash $ git clone https://github.com/convox-examples/nodejs.git ``` -------------------------------- ### Deploy Application to Convox (CLI) Source: https://docs.convox.com/getting-started/introduction Deploys the application source code to the Convox Rack. The first deployment may take longer as it includes building the Docker image. Subsequent deploys are faster. ```bash $ convox deploy Packaging source... OK Uploading source... OK Starting build... OK Authenticating 782231114432.dkr.ecr.us-east-1.amazonaws.com: Login Succeeded Building: . Sending build context to Docker daemon 48.95MB Step 1/5 : FROM node:10.16.3-alpine .......... ``` -------------------------------- ### Log in to Convox CLI with a key Source: https://docs.convox.com/getting-started/introduction Logs the Convox CLI into a specific Convox console using a provided authentication token. This is an alternative to the interactive login process. ```bash convox login console.convox.com -t 0123456789abcdefghijklmnopqrstuvwxyz ``` -------------------------------- ### Manage Convox Racks (CLI) Source: https://docs.convox.com/getting-started/introduction Commands for interacting with Convox Racks, including listing available racks and switching to a specific rack for deployment. Ensure you are connected to the correct rack before deploying. ```bash $ convox racks NAME PROVIDER STATUS org/dev aws running $ convox switch dev ``` -------------------------------- ### Manage Convox Releases (CLI) Source: https://docs.convox.com/getting-started/introduction Commands for managing application releases, including viewing historical releases and performing rollbacks. Releases track the state and history of deployments. ```bash $ convox releases ID STATUS BUILD CREATED DESCRIPTION RSBSSIPZIEF active BUTQJQRIWUZ 2 minutes ago RYCWZIXLKQT BVXIJQDCELS 30 minutes ago $ convox releases rollback RYCWZIXLKQT Rolling back to RYCWZIXLKQT... OK, RSPAOICEBER Promoting RSPAOICEBER... ... ``` -------------------------------- ### Define Convox Application Configuration (convox.yml) Source: https://docs.convox.com/getting-started/introduction Defines application services, environment variables, and build configurations for Convox deployments. This file is essential for specifying how your application should be built and run on Convox. ```yaml environment: - PORT=3000 services: web: build: . port: 3000 ``` -------------------------------- ### Start Application for Local Development (Convox CLI) Source: https://docs.convox.com/reference/cli/start The `convox start` command initiates an application for local development. It can take service names as arguments and supports specifying an alternative manifest file using the `-m` option. The example demonstrates the build and deployment process, including Docker image creation, pushing to a registry, and application scaling. ```shell convox start [service] [service...] [options] ``` ```shell convox start build | uploading source build | starting build build | Authenticating registry.convox/nodejs: Login Succeeded build | Building: . build | Sending build context to Docker daemon 171.5kB build | Step 1/5 : FROM node:10.16.3-alpine build | ---> b95baba1cfdb build | Step 2/5 : WORKDIR /usr/src/app build | ---> Using cache build | ---> 8b06151e1836 build | Step 3/5 : COPY . /usr/src/app build | ---> Using cache build | ---> 02881c46489e build | Step 4/5 : EXPOSE 3000 build | ---> Using cache build | ---> 79271f2d681d build | Step 5/5 : CMD ["node", "app.js"] build | ---> Using cache build | ---> fd45ec629418 build | Successfully built fd45ec629418 build | Successfully tagged c9b4c3c01a44a3037f2b6e57b9269de8382e772b:latest build | Running: docker tag c9b4c3c01a44a3037f2b6e57b9269de8382e772b convox/nodejs:web.BABCDEFGHI build | Running: docker tag convox/nodejs:web.BABCDEFGHI registry.convox/nodejs:web.BABCDEFGHI build | Running: docker push registry.convox/nodejs:web.BABCDEFGHI convox | starting sync from . to /usr/src/app on web web | Scaled up replica set web-58d8446884 to 1 web | Created pod: web-58d8446884-gfkxz web | Successfully assigned convox-nodejs/web-58d8446884-gfkxz to docker-desktop web | Container image "registry.convox/nodejs:web.BABCDEFGHI" already present on machine web | Created container main web | Server running at http://0.0.0.0:3000/ web | Started container main ``` ```shell convox start -m my_convox.yml ``` -------------------------------- ### Redeploy Application to Convox (CLI) Source: https://docs.convox.com/getting-started/introduction Redeploys the application after code changes. This process is typically faster than the initial deployment. After redeploying, verify the changes by accessing the application URL. ```bash $ convox deploy ``` -------------------------------- ### Install Convox Rack on Azure Source: https://docs.convox.com/installation/production-rack/azure Installs a Convox Rack on Azure with specified parameters. ```APIDOC ## POST Install Convox Rack on Azure ### Description Installs a Convox Rack on Azure, allowing you to manage containerized applications. ### Method POST ### Endpoint `convox rack install azure [param=value]…` ### Parameters #### Path Parameters - **``** (string) - Required - The name for your Convox Rack. #### Query Parameters - **`cert_duration`** (string) - Optional - How often certificates renew. Defaults to `2160h`. - **`node_type`** (string) - Optional - VM size for Kubernetes nodes. Defaults to `Standard_D3_v3`. - **`region`** (string) - Optional - Azure region for the Rack. Defaults to `eastus`. - **`syslog`** (string) - Optional - Forward logs to a syslog endpoint. ### Request Example ```bash convox rack install azure my-rack region=westus2 node_type=Standard_D2_v3 ``` ``` -------------------------------- ### Convox Rack Installation on GCP Source: https://docs.convox.com/installation/production-rack/gcp Instructions for installing a Convox Rack on Google Cloud using the `convox rack install gcp` command with available parameters. ```APIDOC ## POST /websites/convox/rack/install/gcp ### Description Installs a Convox Rack on Google Cloud. ### Method POST ### Endpoint `/websites/convox/rack/install/gcp` ### Parameters #### Query Parameters - **name** (string) - Required - The name of the rack to install. - **cert_duration** (string) - Optional - Certification renew period. Default is `2160h`. - **node_type** (string) - Optional - Node instance type. Default is `n1-standard-1`. - **preemptible** (boolean) - Optional - Use preemptible instances. Default is `true`. - **region** (string) - Optional - GCP Region. Default is `us-east1`. - **syslog** (string) - Optional - Forward logs to a syslog endpoint (e.g. `tcp+tls://example.org:1234`). ### Request Example ```json { "name": "my-convox-rack", "cert_duration": "2160h", "node_type": "n1-standard-2", "preemptible": false, "region": "us-west2", "syslog": "tcp://logs.example.com:514" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "Rack installation initiated successfully." } ``` ``` -------------------------------- ### View Running Convox Services (CLI) Source: https://docs.convox.com/getting-started/introduction Lists all running services within the current application and their associated domains and ports. This command is used to obtain the URL for accessing deployed services. ```bash $ convox services SERVICE DOMAIN PORTS web web.nodejs.0a1b2c3d4e5f.convox.cloud 443:3000 ``` -------------------------------- ### Create a Convox Application (CLI) Source: https://docs.convox.com/getting-started/introduction Creates a new application within the currently connected Convox Rack. The application name defaults to the current directory name, but can be specified as an argument. ```bash $ convox apps create $ convox apps create [name] ``` -------------------------------- ### Run Application Locally with Convox CLI Source: https://docs.convox.com/tutorials/local-development Initiates the application build and runtime process on a development Convox Rack. The first execution may be slower due to caching. This command handles source uploading, Docker image building, dependency installation, and container startup. ```bash $ convox start build | uploading source build | starting build build | Authenticating registry.dev.convox/rails: Login Succeeded build | Building: . build | Sending build context to Docker daemon 77.69MB build | Step 1/12 : FROM ruby:2.6.4 AS development build | 2.6.4: Pulling from library/ruby build | Digest: sha256:403a98dc3cc6737cc81ff5143acb50256ce46a65b462c8c75e1942a1c8480852 build | Status: Downloaded newer image for ruby:2.6.4 build | ---> 121862ceb25f build | Step 2/12 : ENV RAILS_ENV development build | ---> Running in 354878b13b32 build | Removing intermediate container 354878b13b32 build | ---> 7359d7e18815 build | Step 3/12 : RUN apt-get update && apt-get install -y nodejs npm postgresql-client build | ---> Running in c8540dfe21b6 build | Removing intermediate container c8540dfe21b6 build | ---> b3d0acfb372a build | Step 4/12 : RUN npm install -g yarn build | ---> Running in 8bcd03f9c571 build | added 1 package in 0.654s build | Removing intermediate container 8bcd03f9c571 build | ---> 9db86c97841f build | Step 5/12 : WORKDIR /usr/src/app build | ---> Running in 00e392fb9ffb build | Removing intermediate container 00e392fb9ffb build | ---> 0ef9e064dee2 build | Step 6/12 : COPY Gemfile Gemfile.lock ./ build | ---> e61bf31b9497 build | Step 7/12 : RUN bundle install build | ---> Running in ef927a1ba0d7 build | Bundle complete! 17 Gemfile dependencies, 75 gems now installed. build | Bundled gems are installed into /usr/local/bundle build | Removing intermediate container ef927a1ba0d7 build | ---> 9ef79cb583f9 build | Step 8/12 : COPY package.json yarn.lock ./ build | ---> 5b2b243d810f build | Step 9/12 : RUN yarn install --check-files build | ---> Running in 861e030377e0 build | yarn install v1.22.0 build | [1/4] Resolving packages... build | [2/4] Fetching packages... build | [3/4] Linking dependencies... build | [4/4] Building fresh packages... build | Done in 23.49s. build | Removing intermediate container 861e030377e0 build | ---> 63a446385c38 build | Step 10/12 : COPY . . build | ---> 11d5aa716a19 build | Step 11/12 : EXPOSE 3000 build | ---> Running in 81e03ee67a6a build | Removing intermediate container 81e03ee67a6a build | ---> 0153050d030c build | Step 12/12 : CMD ["rails", "server", "-b", "0.0.0.0", "-p", "3000"] build | ---> Running in b013715c9e03 build | Removing intermediate container b013715c9e03 build | ---> b80559b89574 build | Successfully built b80559b89574 build | Successfully tagged e44305a1288f25f77d83bc4ef6ecf16c974c4b86:latest build | Running: docker tag e44305a1288f25f77d83bc4ef6ecf16c974c4b86 dev/rails:web.BLBXTCIKDBL build | Running: docker tag dev/rails:web.BLBXTCIKDBL registry.dev.convox/rails:web.BLBXTCIKDBL build | Running: docker push registry.dev.convox/rails:web.BLBXTCIKDBL convox | starting sync from Gemfile to /usr/src/app/Gemfile.lock on web convox | starting sync from . to /usr/src/app on web convox | starting sync from package.json to /usr/src/app/yarn.lock on web web | Scaled up replica set web-85bcd457c4 to 1 web | Created pod: web-85bcd457c4-m9mkq web | Successfully assigned dev-rails/web-85bcd457c4-m9mkq to docker-desktop web | => Booting Puma web | => Rails 6.0.0 application starting in development web | => Run `rails server --help` for more startup options web | Container image "registry.dev.convox/rails:web.BLBXTCIKDBL" already present on machine web | Created container main web | Started container main web | Puma starting in single mode... web | * Version 3.12.2 (ruby 2.6.4-p104), codename: Llamas in Pajamas web | * Min threads: 5, max threads: 5 web | * Environment: development web | * Listening on tcp://0.0.0.0:3000 web | Use Ctrl-C to stop web | Started GET "/health" for 10.1.0.1 at 2020-02-11 15:24:11 +0000 web | Cannot render console from 10.1.0.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1 ``` -------------------------------- ### Add a custom route in Rails Source: https://docs.convox.com/tutorials/local-development Modifies the `config/routes.rb` file to add a new GET route '/test' that responds with 'Hello World!'. This demonstrates how to quickly add new endpoints to a Rails application. ```ruby get "/test", to: proc { [ 200, {}, ["Hello World!"] ] } ``` -------------------------------- ### Install Convox CLI on Linux (x86_64) Source: https://docs.convox.com/index Installs the Convox CLI for Linux x86_64 architecture by downloading the binary, saving it to /usr/local/bin, and setting execute permissions. This is a one-time setup for Linux users. ```shell $ curl -L https://github.com/convox/convox/releases/latest/download/convox-linux -o /tmp/convox $ sudo mv /tmp/convox /usr/local/bin/convox $ sudo chmod 755 /usr/local/bin/convox ``` -------------------------------- ### Service Principal Creation Output Example Source: https://docs.convox.com/installation/production-rack/azure This JSON object represents the typical output when creating an Azure service principal. It contains essential fields like `appId` (Client ID), `password` (Client Secret), and `tenant` (Tenant ID), which are needed for authentication and integration. ```json { "appId": "abcdef12-3456-7890-abcd-ef1234567890", ← Client ID "displayName": "terraform", "password": "ABC8Q~X12DeF34gH56iJ78kL90mN-OpQr23StUv", ← Client Secret "tenant": "87654321-4321-4321-4321-cba987654321" ← Tenant ID } ``` -------------------------------- ### Basic Dockerfile Structure Source: https://docs.convox.com/configuration/dockerfile This is a fundamental Dockerfile example that specifies the base image, copies application files, installs dependencies, and defines the default command to run. It demonstrates the core directives used in Dockerfile creation. ```dockerfile FROM ubuntu:18.04 COPY . . RUN ["deps", "install"] CMD ["bin/start"] ``` -------------------------------- ### Rollback Release with Convox CLI Source: https://docs.convox.com/getting-started/introduction This command allows you to revert your application to a previous release. First, list all releases using `convox releases`. Then, provide the ID of the release you wish to roll back to with `convox releases rollback [release-id]`. ```bash $ convox releases ID STATUS BUILD CREATED DESCRIPTION RSBSSIPZIEF active BUTQJQRIWUZ 2 minutes ago RYCWZIXLKQT BVXIJQDCELS 30 minutes ago $ convox releases rollback RYCWZIXLKQT Rolling back to RYCWZIXLKQT... OK, RSPAOICEBER Promoting RSPAOICEBER... ... ``` -------------------------------- ### Create App with Convox CLI Source: https://docs.convox.com/getting-started/introduction This command creates a new, empty application within your Convox Rack. By default, it uses the current directory name for the app name, but you can specify a custom name as an argument. Ensure you are logged in and connected to the desired Rack before executing. ```bash $ convox racks NAME PROVIDER STATUS org/dev aws running $ convox switch dev $ convox apps create $ convox apps create [name] ``` -------------------------------- ### Verify Convox Rack Installation (Shell) Source: https://docs.convox.com/tutorials/local-development Checks if the local development Rack is running. It displays details such as the Rack's name, provider, router, status, and version. ```shell $ convox rack Name dev Provider local Router router.dev.convox Status running Version 3.0.0 ``` -------------------------------- ### View application services Source: https://docs.convox.com/tutorials/local-development Lists the services available for the Convox application, showing their domains and exposed ports. This is useful for understanding the application's network configuration. ```bash $ convox services SERVICE DOMAIN PORTS web web.rails.dev.convox 443:3000 ``` -------------------------------- ### Install Convox Rack on AWS Source: https://docs.convox.com/installation/production-rack/aws This command installs a Convox Rack on AWS. The `` parameter specifies the name of the rack, and optional `[param1=value1]` arguments can be used for additional configuration parameters. ```bash $ convox rack install aws [param1=value1]... ``` -------------------------------- ### Start Minikube with Specific Configuration Source: https://docs.convox.com/installation/development-rack/ubuntu This command starts Minikube with a specified Kubernetes version, an insecure registry for Convox, and a static IP address. Ensure that the Kubernetes version and rack name match your environment. This is a crucial step for enabling Convox's local development features. ```bash minikube start --kubernetes-version=v1.23.0 --insecure-registry="https://registry.test-local.localdev.convox.cloud" --static-ip 192.168.212.2 ``` -------------------------------- ### Install Convox Rack on GCP Source: https://docs.convox.com/installation/production-rack/gcp Installs a Convox Rack on Google Cloud. It accepts a name for the rack and optional parameters to customize the installation, such as node type, region, and certificate duration. ```bash convox rack install gcp [param1=value1]... ``` -------------------------------- ### Create Google Cloud Project Source: https://docs.convox.com/installation/production-rack/gcp Creates a new Google Cloud project and sets it as the default. The project ID is then used for the GOOGLE_PROJECT environment variable. ```bash $ gcloud projects create --set-as-default ``` -------------------------------- ### Alternative: Using Convox Console Runtime Integration Source: https://docs.convox.com/installation/production-rack/azure Describes how to use the Convox Console for managing Azure integration as an alternative to the CLI. ```APIDOC ## Alternative: Using Convox Console Runtime Integration ### Description Provides an alternative method for installing and managing your Azure integration using the Convox Console's web-based interface. ### Steps 1. Navigate to [https://console.convox.com/](https://console.convox.com/) 2. Sign in to your Convox account. 3. Go to the **Integrations** page. 4. Select **Install Azure Runtime**. ``` -------------------------------- ### Install Convox Rack on AWS Source: https://docs.convox.com/installation/production-rack/aws This command installs a Convox rack on AWS. Replace '' with your desired rack name. Optional parameters can be provided as key-value pairs (e.g., param1=value1) to customize the installation, such as specifying VPC details or user data scripts. ```bash convox rack install aws [param1=value1]... ``` -------------------------------- ### Install Convox Local Development Rack Source: https://docs.convox.com/installation/development-rack/macos This command installs the Convox local development rack. It requires specifying a rack name, a version (must be 3.10.5 or later), and the operating system as 'mac'. Replace `` and `` accordingly. ```bash convox rack install local -v os=mac ``` ```bash convox rack install local test-local -v 3.10.5 os=mac ``` -------------------------------- ### Install Convox Rack on Azure (Bash) Source: https://docs.convox.com/installation/production-rack/azure Installs a Convox rack on Azure. The command requires a rack name and accepts optional parameters like region, node_type, cert_duration, and syslog endpoint. ```bash convox rack install azure [param=value]… ``` ```bash # Example: convox rack install azure my-rack region=westus2 node_type=Standard_D2_v3 ``` -------------------------------- ### Example Convox.yml with Service Configuration Source: https://docs.convox.com/reference/primitives/app/service A complete example of a convox.yml file demonstrating service definition, build process, port exposure, scaling with autoscaling targets based on external metrics, and emptyDir volume mounting. ```yaml services: web: build: . port: 3000 scale: count: 1-3 targets: external: - name: "datadogmetric@default:web-requests" averageValue: 200 volumeOptions: - emptyDir: id: "test-vol" mountPath: "/my/test/vol" ``` -------------------------------- ### Convox CLI Login Command Examples Source: https://docs.convox.com/reference/cli/login These examples demonstrate how to use the `convox login` command. The first example shows a simple login with a hostname. The second example shows logging in with a specific authentication token. ```bash $ convox login console.convox.com Authenticating with console.convox.com... OK ``` ```bash $ convox login console.convox.com -t a1234567-acde-1234-abcde-123abc456def Authenticating with console.convox.com... OK ``` -------------------------------- ### View Application Services Source: https://docs.convox.com/tutorials/local-development Lists the services associated with the Convox application, displaying their service name, domain, and exposed ports. This command helps in understanding the application's network configuration. ```bash $ convox services SERVICE DOMAIN PORTS web web.rails.dev.convox 443:3000 ``` -------------------------------- ### Navigate to Example Application Directory Source: https://docs.convox.com/tutorials/deploying-an-application This command changes the current directory to the 'nodejs' folder, which contains the cloned example application. This step is necessary before inspecting or deploying the application. ```bash $ cd nodejs ``` -------------------------------- ### Examine Convox Configuration File (Shell) Source: https://docs.convox.com/tutorials/local-development Displays the content of the `convox.yml` file, which defines the application's services, resources, build processes, health checks, and port configurations. ```shell $ cat convox.yml resources: database: type: postgres services: web: build: . health: /health port: 3000 resources: - database ``` -------------------------------- ### List Available Convox Racks (Shell) Source: https://docs.convox.com/installation/development-rack/macos-m1 This command lists all the Convox racks currently configured on your system, including your newly installed local development rack. This is useful for confirming successful installation and managing multiple racks. ```bash convox racks ``` -------------------------------- ### Deploy Application with Convox deploy Source: https://docs.convox.com/index This command packages your application's source code, uploads it, and starts a build process on your Convox Rack. The first deployment might take longer due to initial setup and image pulling. Subsequent deploys are significantly faster. ```bash $ convox deploy Packaging source... OK Uploading source... OK Starting build... OK Authenticating 782231114432.dkr.ecr.us-east-1.amazonaws.com: Login Succeeded Building: . Sending build context to Docker daemon 48.95MB Step 1/5 : FROM node:10.16.3-alpine ........ ``` -------------------------------- ### Example Convox.yml with Environment Variables Source: https://docs.convox.com/reference/primitives/app/service An example convox.yml file showing how to define environment variables and configure a service, including build context, port mapping, and volume options using emptyDir. ```yaml environment: - PORT=3000 services: web: build: . port: 3000 volumeOptions: - emptyDir: id: "test-vol" mountPath: "/my/test/vol" ``` -------------------------------- ### Create Google Cloud Service Account and Key Source: https://docs.convox.com/installation/production-rack/gcp Creates a service account named 'convox' and generates a key file for authentication. This key file is used for the GOOGLE_CREDENTIALS environment variable. ```bash serviceaccount="convox@${GOOGLE_PROJECT}.iam.gserviceaccount.com" gcloud iam service-accounts create convox gcloud iam service-accounts keys create ~/.gcloud.convox --iam-account="${serviceaccount}" ``` -------------------------------- ### Start Minikube Tunnel (Shell) Source: https://docs.convox.com/installation/development-rack/macos-m1 This command starts a tunnel for Minikube, which is necessary to address the Convox rack on macOS. This terminal window must remain open while you are working with the local rack. ```bash minikube tunnel ``` -------------------------------- ### convox.yml Manifest Example Source: https://docs.convox.com/configuration/convox-yml A comprehensive example of a `convox.yml` file, demonstrating the definition of environment variables, app settings, resources (like databases and queues), services (api, web, worker, metrics), and timers. ```yaml environment: - COMPANY=Convox - DOCS_URL appSettings: awsLogs: cwRetention: 31 disableRetention: false resources: database: type: postgres options: storage: 200 queue: type: redis services: api: annotations: - test.annotation.org/value=foobar build: . command: bin/api environment: - ENCRYPTION_KEY health: /check internal: true port: 3000 resources: - database - queue termination: grace: 45 test: make test timeout: 120 deployment: minimum: 50 maximum: 200 web: build: . command: bin/web environment: - SESSION_SECRET port: 3000 worker: build: ./worker command: bin/worker environment: - ENCRYPTION_KEY resources: - database - queue metrics: agent: true image: awesome/metrics timers: cleanup: schedule: "0 3 * * * *" command: bin/cleanup service: worker ``` -------------------------------- ### Verify Convox rack status Source: https://docs.convox.com/tutorials/local-development Checks the status of the local Convox development rack, confirming it is running and showing its version and router details. This is part of verifying the Convox installation. ```bash $ convox rack Name dev Provider local Router router.dev.convox Status running Version 3.0.0 ``` -------------------------------- ### Sign in to Azure CLI Source: https://docs.convox.com/installation/production-rack/azure Logs you into your Azure account. This command opens a web browser for authentication and allows selection of the default tenant and subscription if multiple are available. ```bash az login ``` -------------------------------- ### Sign in to Azure CLI Source: https://docs.convox.com/installation/production-rack/azure This command initiates the sign-in process for the Azure CLI, opening a web browser for authentication. It's the first step in interacting with Azure resources via the command line. ```bash # sign‑in to Azure az login ``` -------------------------------- ### Install Local Convox Development Rack (Shell) Source: https://docs.convox.com/installation/development-rack/macos-m1 This command installs the local development Convox rack. It requires specifying a rack name, a version (must be 3.10.5 or later), and the operating system as 'mac'. Replace and with your chosen rack name and the desired rack version. ```bash convox rack install local -v os=mac ``` -------------------------------- ### Convox.yml Example for Django App Source: https://docs.convox.com/tutorials/preparing-an-application This `convox.yml` example defines a Django application with a web service, a Celery worker service, and a timer for sending email reminders. It specifies PostgreSQL and Redis as resources and uses a single Dockerfile for both services. The web service is exposed externally, while the worker service runs with a specific command. ```yaml environment: - DEVELOPMENT=True resources: database: type: postgres broker: type: redis services: web: build: . domain: ${DOMAIN} port: 8001 resources: - database - broker worker: build: . command: celery -A web worker -l info resources: - database - broker timers: reminderemails: schedule: "*/5 * * * *" command: python manage.py sendreminders service: worker ``` -------------------------------- ### Clone Convox Node.js Example App Source: https://docs.convox.com/index Clones the official Convox Node.js example application repository from GitHub. This is the first step in deploying a sample application. ```shell $ git clone https://github.com/convox-examples/nodejs.git ``` -------------------------------- ### Get Information about a Convox Build Source: https://docs.convox.com/reference/cli/builds Retrieves detailed information for a specific build, including its ID, status, release, description, start time, and elapsed duration. ```bash convox builds info ``` -------------------------------- ### Get Service Principal Object ID Source: https://docs.convox.com/installation/production-rack/azure Retrieves the objectId of a service principal based on its display name. ```APIDOC ## GET Service Principal Object ID ### Description Retrieves the objectId of a service principal based on its display name. ### Method GET ### Endpoint https://graph.microsoft.com/v1.0/servicePrincipals ### Parameters #### Query Parameters - **`$filter`** (string) - Required - Filters the results to service principals where the displayName is 'terraform'. ### Response #### Success Response (200) - **`value[0].id`** (string) - The object ID of the service principal. ### Response Example ```json { "value": [ { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } ] } ``` ``` -------------------------------- ### Optimizing Dockerfile Builds with npm Source: https://docs.convox.com/configuration/dockerfile This example illustrates how to optimize Dockerfile build times by selectively copying only the necessary files (package.json and package-lock.json) before running 'npm install'. This leverages Docker's build cache, ensuring 'npm install' is only re-run when these specific files change. ```dockerfile FROM nodejs COPY package.json package-lock.json . RUN ["npm", "install"] COPY . . CMD ["npm", "start"] ``` -------------------------------- ### Enable Google Cloud APIs Source: https://docs.convox.com/installation/production-rack/gcp Enables essential Google Cloud APIs required for Convox to function, including compute, container, and service management APIs. ```bash gcloud services enable cloudapis.googleapis.com gcloud services enable compute.googleapis.com gcloud services enable cloudresourcemanager.googleapis.com gcloud services enable container.googleapis.com gcloud services enable serviceusage.googleapis.com gcloud services enable servicemanagement.googleapis.com ``` -------------------------------- ### Get Role Definition ID for Application Administrator Source: https://docs.convox.com/installation/production-rack/azure Retrieves the internal roleDefinitionId for the 'Application Administrator' role using the Azure CLI. ```APIDOC ## GET Role Definition ID for Application Administrator ### Description Retrieves the internal roleDefinitionId for the 'Application Administrator' role using the Azure CLI. ### Method GET ### Endpoint https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?`$filter=displayName eq 'Application Administrator' ### Parameters #### Query Parameters - **`$filter`** (string) - Required - Filters the results to role definitions where the displayName is 'Application Administrator'. ### Response #### Success Response (200) - **`value[0].id`** (string) - The ID of the 'Application Administrator' role definition. ### Response Example ```json { "value": [ { "id": "9b895d92-2cd3-44c7-9d02-a6ac2d5ea5c3" } ] } ``` ``` -------------------------------- ### Sync Application Changes Source: https://docs.convox.com/tutorials/local-development Indicates that changes made to the application's configuration files, such as `config/routes.rb`, are being synchronized to the development Rack. This highlights Convox's live synchronization feature. ```text convox | sync: config/routes.rb to /usr/src/app on web ``` -------------------------------- ### Verify Convox Rack Installation Source: https://docs.convox.com/tutorials/deploying-an-application This command verifies that your Convox production Rack is running and displays its status, provider, router, and version. It's a crucial step after Rack installation. ```bash $ convox rack Name production Provider do Router router.production.convox Status running Version 3.0.18 ``` -------------------------------- ### Install Convox Rack Source: https://docs.convox.com/reference/cli/rack Installs a Convox rack using a specified provider and name. It can optionally include region, runtime ID, and other provider-specific options. Ensure your CLI is updated for organization-based installations with runtime integration. ```shell convox rack install [option=value]... convox rack install / region= --runtime= [option=value]... ``` ```shell $ convox rack install local dev $ convox rack install aws production region=eu-west-1 node_type=t3.large $ convox rack install aws my-org/staging region=us-east-1 --runtime=20e58437-fab7-4124-aa5a-2e5978f1149e ``` -------------------------------- ### Get Azure Tenant ID Source: https://docs.convox.com/installation/production-rack/azure Retrieves the current Azure tenant ID in a TSV format. This is essential for configuring applications and services that need to authenticate with Azure. ```bash az account show --query tenantId -o tsv ``` -------------------------------- ### View application logs Source: https://docs.convox.com/tutorials/local-development Displays logs from the application's web service, showing incoming requests and processing details. This helps in debugging and monitoring application activity. ```logs web | Processing by Rails::WelcomeController#index as HTML web | Rendering /usr/local/bundle/gems/railties-6.0.0/lib/rails/templates/rails/welcome/index.html.erb web | Rendered /usr/local/bundle/gems/railties-6.0.0/lib/rails/templates/rails/welcome/index.html.erb (Duration: 3.8ms | Allocations: 194) web | Completed 200 OK in 8ms (Views: 4.4ms | ActiveRecord: 0.0ms | Allocations: 1053) ``` -------------------------------- ### Add a Test Route in Rails Source: https://docs.convox.com/tutorials/local-development Modifies the Rails application's routes file to add a new endpoint '/test' that responds with 'Hello World!'. This demonstrates how to quickly add and test new routes. ```ruby get "/test", to: proc { [ 200, {}, ["Hello World!"] ] } ``` -------------------------------- ### Install Local Convox Rack Source: https://docs.convox.com/installation/development-rack/ubuntu This command installs a local Convox development rack. Replace `` with your chosen rack name and `` with the required Convox rack version (3.10.5 or later). This command provisions the necessary resources within Minikube for your local Convox environment. ```bash convox rack install local test-local -v 3.10.5 ``` -------------------------------- ### Install a New Rack (convox rack install) Source: https://docs.convox.com/reference/cli/rack Installs a new Convox rack. Allows specifying runtime, region, and other parameters, including organization and rack name. ```shell convox rack install ``` -------------------------------- ### Get Azure Subscription ID Source: https://docs.convox.com/installation/production-rack/azure Retrieves the current Azure subscription ID in a TSV (Tab Separated Values) format. This is useful for scripting and setting environment variables. ```bash az account show --query id -o tsv ``` -------------------------------- ### List Azure Subscriptions Source: https://docs.convox.com/installation/production-rack/azure Displays a table of all available Azure subscriptions associated with your account. It includes details like Subscription Name, Subscription ID, State, and whether it's the default. ```bash az account list --output table ```