Setup
- Kubernetes
- Docker
- Github
- Gitlab
- VSCode
- Linux
- OSX
- Windows
Opctl can be deployed to Kubernetes in order to run ops across an arbitrary number of nodes.
Example deployment yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: opctl-in-kubernetes
spec:
replicas: 1
template:
spec:
containers:
- name: opctl
image: ghcr.io/opctl/opctl:0.1.58-dind
ports:
# expose to other containers
- name: http
containerPort: 42224
protocol: TCP
securityContext:
privileged: true
Opctl can be run in docker containers using either DinD (Docker in Docker) or DooD (Docker out of Docker).
DinD
The -dind
variant uses DinD (Docker in Docker) as the container runtime and requires a --privileged
flag.
For example, to run github.com/opspec-pkgs/uuid.v4.generate#1.1.0 with DinD:
docker run \
--privileged \
ghcr.io/opctl/opctl:0.1.58-dind \
opctl run github.com/opspec-pkgs/uuid.v4.generate#1.1.0
DooD
The -dood
variant uses DooD (Docker out of Docker) as the container runtime and requires:
-v /var/run/docker.sock:/var/run/docker.sock
to mount the socket of the external docker daemon.-v opctl_data_dir:/root/opctl
to mount an external directory as opctl's data dir.
For example, to run github.com/opspec-pkgs/uuid.v4.generate#1.1.0 with DooD:
docker run \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/opctl:/root/opctl \
ghcr.io/opctl/opctl:0.1.58-dood \
opctl run github.com/opspec-pkgs/uuid.v4.generate#1.1.0
Opctl can be used from Github Actions to run ops.
Example workflow yaml:
# .github/workflows/your_workflow.yml
name: your_workflow_name
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Opctl
run: curl -L https://github.com/opctl/opctl/releases/latest/download/opctl-linux-amd64.tgz | sudo tar -xzv -C /usr/local/bin
- name: Build
run: opctl run build
Opctl can be used from Gitlab CI/CD to run ops.
Example .gitlab-ci.yml:
image: ghcr.io/opctl/opctl:0.1.58-dind
stages:
- build
- deploy
build:
stage: build
script:
# passes args to opctl from gitlab variables
- export gitlabUsername="$CI_REGISTRY_USER"
- export gitlabSecret="$CI_REGISTRY_PASSWORD"
- opctl run build
deploy:
stage: deploy
only:
- main
script:
- opctl run deploy
Intellisense for opspec can be enabled in VSCode.
-
install vscode-yaml plugin
-
add to your user or workspace settings
"yaml.schemas": {
"https://raw.githubusercontent.com/opctl/opctl/main/opspec/opfile/jsonschema.json": "/op.yml"
} -
edit or create an op.yml w/ your fancy intellisense.
Opctl can be installed and run natively on linux.
Dependencies
Opctl currently supports multiple container runtimes. Dependencies vary based on whichever you choose:
container runtime | dependencies |
---|---|
docker | docker |
qemu (experimental) | lima |
Installation
from terminal, run:
curl -L https://github.com/opctl/opctl/releases/latest/download/opctl-linux-amd64.tgz | sudo tar -xzv -C /usr/local/bin
Upgrading
from terminal, run:
# update to latest release from https://github.com/opctl/opctl/releases
opctl self-update
Opctl can be installed and run natively on OSX.
Dependencies
Opctl currently supports multiple container runtimes. Dependencies vary based on whichever you choose:
container runtime | dependencies |
---|---|
docker | docker |
qemu (experimental) | lima |
Installation
M1
from terminal, run:
curl -L https://github.com/opctl/opctl/releases/latest/download/opctl-darwin-arm64.tgz | sudo tar -xzv -C /usr/local/bin
Intel
from terminal, run:
curl -L https://github.com/opctl/opctl/releases/latest/download/opctl-darwin-amd64.tgz | sudo tar -xzv -C /usr/local/bin
Upgrading
from terminal, run:
# update to latest release from https://github.com/opctl/opctl/releases
opctl self-update
Use Windows Subsystem for Linux (WSL) and the linux install.