One line installation (detailed instructions):
/bin/bash -c "$(curl -fsSL https://docs.opta.dev/install.sh)"
Make sure the Azure cloud credentails are configured in your terminal.
In this step we will create an environment (example staging, qa, prod) for your organization.
You can use the CLI option described below or checkout our interactive app to build your first environment and service.
Start by running:
opta init env azure
This will create an
staging.yml file with initial configurations for your environment. Below are examples of the resulting yaml files for each environment.
name: staging # A unique identifier for your environment org_name: runx # A unique identifier for your organization providers: azurerm: location: centralus tenant_id: XXX subscription_id: YYY modules: - type: base - type: k8s-cluster - type: k8s-base
opta apply -c staging.yml
This step will create an AKS cluster for you and set up networking and various other infrastructure pieces.
In this step we will create a service - which is basically a docker container and associated database.
We will create another
hello-world.yml file, which defines high level configuration of this service.
To get started, run
opta init service <YOUR_ENV_FILE_PATH> k8s
This will prompt you for some information and create a starting
point for your
hello-world.yml file. Then, update the fields specific to your service setup. You can see examples of resulting files below.
name: hello-world # service names are unique per-environment environments: - name: staging path: "staging.yml" modules: - name: app type: k8s-service port: http: 80 image: docker.io/kennethreitz/httpbin:latest # Or you can specify your own healthcheck_path: "/get" public_uri: all links: - db - name: db type: postgres # Will spawn a Cloud SQL database and credentials will be passed via env vars
Now you are ready to deploy your service.
One line deployment:
opta apply -c hello-world.yml
Now, once this step is complete, you should be to curl your service by specifying the load balancer url/ip.
output and note down
Now you can:
- Access your service at http://<ip>/
- SSH into the container by running
- See logs by running
Once you’re finished playing around with these examples, you may clean up by running the following command from the environment directory:
opta destroy -c hello-world.yml opta destroy -c staging.yml
- Check out more examples: github
- Use your own docker image: Custom Image
- Set up a domain name for your service: Ingress
- Use secrets: Secrets
- Set up observability integrations in one line(!): Observability
- Explore all the infrastructure that Opta sets up for you: Architecture
- Explore the api for all modules: Reference