Skip to content

Commit

Permalink
fix: add terraform files for the getting started tutorial (#39)
Browse files Browse the repository at this point in the history
* docs: add tf files for the getting started tutorial

* fix: address review suggestions

* docs: fix azure azs issue

* fix: add k9s to the container image, review grammar of docker.md

* fix: add terraform tests

* fix: addressed review suggestions

* fix: update spectro provider version, cluster profile logic, and broken tag

* fix: metallb pack type

* docs: fix merge conflicts in dockerfile

* docs: update pack and images version
  • Loading branch information
caroldelwing authored Sep 23, 2024
1 parent d06502e commit 77882b1
Show file tree
Hide file tree
Showing 33 changed files with 2,494 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
ORAS_VERSION: 1.0.0
TERRAFORM_VERSION: 1.9.0
PALETTE_REGISTRY_CLI_VERSION: 4.3.0
K9S_VERSION: 0.32.5

jobs:
docker:
Expand Down Expand Up @@ -68,6 +69,7 @@ jobs:
ORAS_VERSION=${{env.ORAS_VERSION}}
TERRAFORM_VERSION=${{env.TERRAFORM_VERSION}}
PALETTE_REGISTRY_CLI_VERSION=${{env.PALETTE_REGISTRY_CLI_VERSION}}
K9S_VERSION=${{env.K9S_VERSION}}
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository }}:${{steps.dependencies.outputs.VERSION}}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
ORAS_VERSION: 1.0.0
TERRAFORM_VERSION: 1.9.0
PALETTE_REGISTRY_CLI_VERSION: 4.3.0
K9S_VERSION: 0.32.5

concurrency:
group: docker-${{ github.ref }}
Expand Down Expand Up @@ -77,3 +78,4 @@ jobs:
ORAS_VERSION=${{env.ORAS_VERSION}}
TERRAFORM_VERSION=${{env.TERRAFORM_VERSION}}
PALETTE_REGISTRY_CLI_VERSION=${{env.PALETTE_REGISTRY_CLI_VERSION}}
K9S_VERSION=${{env.K9S_VERSION}}
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ARG PALETTE_REGISTRY_CLI_VERSION
ARG PACKER_VERSION
ARG ORAS_VERSION
ARG TERRAFORM_VERSION
ARG K9S_VERSION

ENV REGISTRY_LOG_LEVEL=info
ENV REGISTRY_AUTH=htpasswd
Expand Down Expand Up @@ -64,16 +65,18 @@ RUN wget https://spectro-cli.s3.amazonaws.com/v$PALETTE_REGISTRY_CLI_VERSION/li
rm -rf oras_${ORAS_VERSION}_*.tar.gz oras-install/ && \
git clone https://github.com/spectrocloud/CanvOS.git && \
rm -rf /var/cache/apk/* && \
wget https://github.com/derailed/k9s/releases/download/v${K9S_VERSION}/k9s_Linux_amd64.tar.gz -O - | tar -xz -C /usr/local/bin && \
rm -rf k9s_Linux_amd64.tar && \
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin && \
rm -rf terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
mkdir -p /var/log/ && chmod 777 /var/log/
mkdir -p /var/log/ && chmod 777 /var/log/

ADD https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip /usr/local/sbin/
RUN unzip /usr/local/sbin/packer_${PACKER_VERSION}_linux_amd64.zip -d /usr/local/sbin && \
rm -rf /usr/local/sbin/packer_${PACKER_VERSION}_linux_amd64.zip && \
mkdir -p /home/appuser/.config/packer && mkdir /root/.spectro && \
chown -R appuser:appuser /home/appuser/.config/packer terraform/ packs/ edge/ CanvOS/ /var/log/ /root/.spectro/ /etc/spectro/
mkdir -p /home/appuser/.config/packer && mkdir /root/.spectro && mkdir -p /home/appuser/.config/k9s && mkdir -p /home/appuser/etc/xdg/k9s && \
chown -R appuser:appuser /home/appuser/.config/packer terraform/ packs/ edge/ CanvOS/ /var/log/ /root/.spectro/ /etc/spectro/ /home/appuser/.config/k9s /home/appuser/etc/xdg/k9s
EXPOSE 5000

USER appuser
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ build-docker: ## Build docker image
--build-arg PALETTE_CLI_VERSION=$(PALETTE_CLI_VERION) \
--build-arg PALETTE_EDGE_VERSION=$(PALETTE_EDGE_VERSION) \
--build-arg PACKER_VERSION=$(PACKER_VERSION) \
--build-arg ORAS_VERSION=$(PACKER_VERSION) \
--build-arg ORAS_VERSION=$(ORAS_VERSION) \
--build-arg TERRAFORM_VERSION=$(TERRAFORM_VERSION) \
--build-arg K9S_VERSION=$(K9S_VERSION) \
-t tutorials .


Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The following tutorial code is available:

- [vmware-cluster-deployment-tf](./terraform/vmware-cluster-deployment-tf/README.md) - Learn how to deploy a VMware cluster and the Hello Universe application as a part of the Deploy App Workloads with a PCG tutorial. [Link](https://docs.spectrocloud.com/clusters/pcg/deploy-app-pcg)

- [getting-started-deployment-tf](./terraform/getting-started-deployment-tf/README.md) - Learn how to deploy and update a cluster to AWS, Azure, GCP, and VMware vSphere with Palette. [Link](https://docs.spectrocloud.com/getting-started/terraform)

## Docker

All the tutorials are available in a Docker image that you can use to get started with the tutorials.
Expand Down
11 changes: 6 additions & 5 deletions docs/docker.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Docker

To download the image issue the following commnad. Change the version tag as needed.
To download the image, issue the following command. Change the version tag as needed.

```shell
docker pull ghcr.io/spectrocloud/tutorials:1.0.12
Expand All @@ -12,7 +12,7 @@ You can start the container using the following command.
docker run -p 5000:5000 --rm -it ghcr.io/spectrocloud/tutorials:1.0.12 bash
```

> The Docker file is build for a Linux environment. You can use this on a Mac and Windows. Windows users will require the usage of WSL2.
> The Docker file builds a Linux environment. You can use this image on a Mac and Windows. Windows users will require the usage of [WSL2](https://learn.microsoft.com/en-us/windows/wsl/about).
The Docker image includes the following tools.

Expand Down Expand Up @@ -41,6 +41,7 @@ The Docker image includes the following tools.
| `aws-cli` | AWS command-line interface |
| `oras` | Tool for pushing and pulling OCI artifacts to and from OCI registries |
| `podman` | Tool for building and deploying OCI images |
| `k9s` | Tool that provides a terminal UI to interact with your Kubernetes clusters |

### Spectro Cloud Pack Registry Server

Expand All @@ -50,7 +51,7 @@ The Spectro Cloud registry server has the following credentials:

- `password`: `admin`

You can start the registry server by issuing the following command.
You can start the registry server by issuing the command below.
Keep in mind that the registry server is started in HTTP mode. For additional guidance, review the [Registry Server documentation](https://docs.spectrocloud.com/registries-and-packs/adding-a-custom-registry).

```shell
Expand All @@ -59,8 +60,8 @@ registry serve /etc/spectro/config.yml > /var/log/registry.log 2>&1 &

# Local Builds

If you are wanting to build the docker image locally you must provide the the build arguments for `PALETTE_VERSION`, `PALETTE_CLI_VERSION`, `PALETTE_EDGE_VERSION`, `PACKER_VERSION`, `ORAS_VERSION` and `TERRAFORM_VERSION`. Use the following command to build a local image. Replace the versions as needed.
If you want to build the docker image locally, you must provide the build arguments for `PALETTE_VERSION`, `PALETTE_CLI_VERSION`, `PALETTE_EDGE_VERSION`, `PACKER_VERSION`, `ORAS_VERSION`, `TERRAFORM_VERSION`, and `K9S_VERSION`. Use the following command to build a local image and replace the versions as needed.

```shell
docker build --build-arg PALETTE_VERSION=4.0.2 --build-arg PALETTE_CLI_VERSION=4.4.0 --build-arg PALETTE_EDGE_VERSION=4.4.2 --build-arg PACKER_VERSION=1.11.0 --build-arg ORAS_VERSION=1.0.0 --build-arg PALETTE_REGISTRY_CLI_VERSION=4.3.0 --build-arg TERRAFORM_VERSION=1.9.0 -t tutorials .
docker build --build-arg PALETTE_VERSION=4.0.2 --build-arg PALETTE_CLI_VERSION=4.4.0 --build-arg PALETTE_EDGE_VERSION=4.4.2 --build-arg PACKER_VERSION=1.11.0 --build-arg ORAS_VERSION=1.0.0 --build-arg PALETTE_REGISTRY_CLI_VERSION=4.3.0 --build-arg TERRAFORM_VERSION=1.9.0 --build-arg K9S_VERSION=0.32.5 -t tutorials .
```
Loading

0 comments on commit 77882b1

Please sign in to comment.