logo

Runops Proxy

Runops proxy allows forwarding remote TCP services locally.

Agent Setup

The agent is responsible for managing TCP connections in your local infrastructure, for proxying MySQL connections, a target with type mysql is required with the configurations described in the integrations section. The agent must be able to reach out the MySQL instance.

Docker Deployment

shell
AGENT_TOKEN=AGENT_TAG=docker run --rm -it runops/rproxy agent \ --tag "$AGENT_TAG" \ --token $AGENT_TOKEN \ -e MYSQL_CONFIG='{ "MYSQL_HOST": "", "MYSQL_PORT": "", "MYSQL_USER": "", "MYSQL_PASS": "" }'

Kubernetes Deployment

Alter the snippet below to deploy a new instance in Kubernetes
shell
# The agent token to connect to the API# If you have any agent deployed, use the same token.# Otherwise run the command to obtain a new one: runops agents create-token -fAGENT_TOKEN=# If you need multiple agents running in distinct networks, tag each instance with a unique name.# A target must always match an agent instance, leave empty if this is your first instance.AGENT_TAG=kubectl apply -f - <<EOFapiVersion: apps/v1kind: Deploymentmetadata: labels: app: rproxy-agent name: rproxy-agent namespace: runopsspec: replicas: 1 selector: matchLabels: app: rproxy-agent strategy: type: Recreate template: metadata: labels: app: rproxy-agent spec: containers: - env: # The AWS environments is required when there are # targets using the secret manager as secret provider # - name: AWS_ACCESS_KEY_ID # value: '' # - name: AWS_SECRET_ACCESS_KEY # value: '' # - name: AWS_REGION # value: '' # This environment is used if the secret provider option in the target # is 'env-var'. The environment name must match with the secret path value of the target # If you have multiple database instances, add new environments configuration with distinct # names. - name: MYSQL_CONFIG value: '{ "MYSQL_HOST": "", "MYSQL_PORT": "", "MYSQL_USER": "", "MYSQL_PASS": "" }' - name: TOKEN value: $AGENT_TOKEN - name: TAG value: "$AGENT_TAG" image: "runops/rproxy" args: ["agent"] imagePullPolicy: Always resources: requests: memory: "1024Mi" cpu: "500m" name: rproxy-agentEOF

Running the Proxy

  • Download and install the runops cli: npm install -g runops
First authenticate with a valid user in your organization
shell
runops login

Start

shell
TARGET_NAME=rproxy mysql -c $TARGET_NAME

Try to connect in the database instance using your prefered MySQL client

shell
mysql -h 127.0.0.1 --port 3307
There’s no need to pass the username and password