Skip to content

Commit

Permalink
docker image to run kubefirst bin inside container (#250)
Browse files Browse the repository at this point in the history
Bump to release 1.8.6

Signed-off-by: 6za <[email protected]>

Signed-off-by: Thiago Pagotto <[email protected]>
Signed-off-by: 6za <[email protected]>
Co-authored-by: 6za <[email protected]>
  • Loading branch information
pagottoo and 6za authored Aug 18, 2022
1 parent f46925d commit c1e737b
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 52 deletions.
54 changes: 20 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
The Kubefirst CLI is a cloud provisioning tool. With simple setup and two CLI commands, we create a kubernetes cluster managed with automated Infrastructure as Code, GitOps asset management and application delivery, secrets management, a sample application delivered to development, staging, and production, and so much more. It's an open source platform ready to be customized to suit your company's needs.

- [DNS Setup](#dns-setup)
- [Clone the Repository](#clone-the-repository)
- [Start the Container](#start-the-container)
- [Connect to the Container](#connect-to-the-container)
- [Installing the CLI](#installing-the-cli)
- [Initialization](#initialization)
- [Creation](#creation)
- [Access ArgoCD](#access-argocd)
Expand Down Expand Up @@ -61,33 +59,14 @@ gitlab.subdomain.example.com
...
```

## Clone the repository
## Installing the CLI

Clone the repository to have the latest `main` branch content

```bash
# via HTTPS
git clone https://github.com/kubefirst/kubefirst.git

# via SSH
git clone [email protected]:kubefirst/kubefirst.git
```

## Start the Container

We run everything in isolation with Docker, for that, start the container with:

```bash
docker-compose up kubefirst
```bash
brew install kubefirst/tools/kubefirst
```
## Other installation techniques:

## Connect to the Container

Open a new terminal to connect to the container to run kubefirst

```bash
docker exec -it kubefirst bash
```
[Details Here](./build/README.md)

## Initialization

Expand All @@ -111,20 +90,27 @@ At this point, everything is ready to start provisioning the cloud services, and
kubefirst cluster create
```

## Access ArgoCD
## Destroy

It will destroy the kubefirst management cluster, and clean up every change made in the cloud.

```bash
aws eks update-kubeconfig --name your_cluster_name
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
kubectl -n argocd port-forward svc/argocd-server 8080:80
kubefirst destroy
```

## Destroy
# What to do next

[Learn More - Getting Started](https://docs.kubefirst.com/kubefirst/getting-started.html)

It will destroy the kubefirst management cluster, and clean up every change made in the cloud.

# If you want learn more

## Access ArgoCD

```bash
kubefirst destroy
aws eks update-kubeconfig --name your_cluster_name
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
kubectl -n argocd port-forward svc/argocd-server 8080:80
```

## Available Commands
Expand Down
19 changes: 8 additions & 11 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM --platform=linux/amd64 golang:1.18
FROM --platform=linux/amd64 buildpack-deps:bullseye-scm
# we are using buidlpack-deps:bullseye-scm https://github.com/docker-library/golang/blob/8d0fa6028120904e16fe761f095bd0620b68eab2/1.18/bullseye/Dockerfile

WORKDIR /opt/kubefirst-install
ARG KUBEFIRST_VERSION=1.8.6

RUN apt-get update && \
apt-get install -y unzip curl jq vim unzip less \
Expand Down Expand Up @@ -28,19 +29,15 @@ RUN curl -LO https://s3.us-west-2.amazonaws.com/amazon-eks/1.21.2/2021-07-05/bin
chmod +x aws-iam-authenticator && \
mv aws-iam-authenticator /usr/local/bin/

# Kubefirst cli
RUN curl -LO https://github.com/kubefirst/kubefirst/releases/download/$KUBEFIRST_VERSION/kubefirst-$KUBEFIRST_VERSION-linux-amd64.tar.gz && \
tar -xvzf kubefirst-$KUBEFIRST_VERSION-linux-amd64.tar.gz -C /usr/local/bin/ && \
chmod +x /usr/local/bin/kubefirst && \
rm kubefirst-$KUBEFIRST_VERSION-linux-amd64.tar.gz

# setup user
RUN useradd -ms /bin/bash developer
USER developer
WORKDIR /home/developer/kubefirst

COPY --chown=developer:developer . .

# download dependencies and prepare fresh installation
RUN go mod download && \
go build

USER root
RUN mv ./kubefirst /usr/local/bin/ && chmod 777 /usr/local/bin/kubefirst
USER developer
RUN kubefirst clean
73 changes: 73 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Overview

This page provide sevral ways to explore kubefirst cli, to allow you to choose the one the better fits your prefered way of work.


# Requirements to run the CLI

In order for the CLI to work, We assume you gave your [AWS Credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) files at: `$HOME/.aws`.


# Getting the binary for linux

```bash
#Check the release page:
#https://github.com/kubefirst/kubefirst/releases

export KUBEFIRST_VERSION=`curl https://github.com/kubefirst/kubefirst/releases/latest -Ls -o /dev/null -w %{url_effective} | grep -oE "[^/]+$"`
curl -LO https://github.com/kubefirst/kubefirst/releases/download/$KUBEFIRST_VERSION/kubefirst-$KUBEFIRST_VERSION-linux-amd64.tar.gz

tar -xvzf kubefirst-$KUBEFIRST_VERSION-linux-amd64.tar.gz -C /usr/local/bin/
chmod +x /usr/local/bin/kubefirst

kubefirst info
```


# Running CLI in docker container

Based on image: https://hub.docker.com/kubefirst/kubefirst

You can easily run it, without any installation step with:
```bash
docker run \
-it --name kubefirst \
--dns="1.0.0.1" --dns="208.67.222.222" --dns="8.8.8.8" \
-v $(PWD):/opt/kubefirst \
-v $HOME/.aws:/home/developer/.aws \
kubefirst/kubefirst
```

After this step is executed, return to [this step](https://github.com/kubefirst/kubefirst#initialization) to run a `kubefirst info` and other functions.

# Running CLI from a Docker-Compose container

## Clone the repository

Clone the repository to have the latest `main` branch content:

```bash
# via HTTPS
git clone https://github.com/kubefirst/kubefirst.git

# via SSH
git clone [email protected]:kubefirst/kubefirst.git
```

## Start the Container

We run everything in isolation with Docker, for that, start the container with:

```bash
docker-compose up kubefirst
```

## Connect to the Container

Open a new terminal to connect to the container to run kubefirst:

```bash
docker exec -it kubefirst bash
```

After this step is executed, return to [this step](https://github.com/kubefirst/kubefirst#initialization) to run a `kubefirst info` and other functions.
46 changes: 46 additions & 0 deletions build/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM --platform=linux/amd64 golang:1.18

WORKDIR /opt/kubefirst-install

RUN apt-get update && \
apt-get install -y unzip curl jq vim unzip less \
&& rm -rf /var/lib/apt/lists/*

# Kubernetes client
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.21.3/bin/$(uname -s)/amd64/kubectl && \
chmod +x ./kubectl && \
mv kubectl /usr/local/bin/

# AWS cli
RUN curl -LO https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip && \
unzip awscli-exe-linux-x86_64.zip && \
./aws/install && \
rm -r aws && \
rm awscli-exe-linux-x86_64.zip

# AWS EKS cli
RUN curl -LO https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_linux_amd64.tar.gz && \
tar -xvzf eksctl_linux_amd64.tar.gz -C /usr/local/bin/ && \
rm eksctl_linux_amd64.tar.gz

# AWS IAM Authenticator tool
RUN curl -LO https://s3.us-west-2.amazonaws.com/amazon-eks/1.21.2/2021-07-05/bin/linux/amd64/aws-iam-authenticator && \
chmod +x aws-iam-authenticator && \
mv aws-iam-authenticator /usr/local/bin/


# setup user
RUN useradd -ms /bin/bash developer
USER developer
WORKDIR /home/developer/kubefirst

COPY --chown=developer:developer . .

# download dependencies and prepare fresh installation
RUN go mod download && \
go build

USER root
RUN mv ./kubefirst /usr/local/bin/ && chmod 777 /usr/local/bin/kubefirst
USER developer
RUN kubefirst clean
2 changes: 1 addition & 1 deletion configs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func ReadConfig() *Config {
config.HelmVersion = "v3.6.1"
config.KubectlVersionM1 = "v1.21.14"

config.KubefirstVersion = "1.8.5"
config.KubefirstVersion = "1.8.6"

config.InstallerEmail = "[email protected]"

Expand Down
6 changes: 0 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: "3"

services:

kubefirst:
platform: linux/amd64
build:
Expand All @@ -10,15 +9,10 @@ services:
container_name: kubefirst
environment:
TERM: xterm-256color
ports:
- "8080:8080" # ArgoCD
- "8888:8888" # GitLab
- "8200:8200" # Vault
volumes:
- ./:/opt/kubefirst
# AWS credentials are strictly used to provision the Kubefirst in your AWS account
- $HOME/.aws:/home/developer/.aws
command: sh -c "./scripts/kubefirst.sh"
dns:
- 208.67.222.222 #Cisco DNS
- 1.1.1.1 #Cloudflare DNS
Expand Down

0 comments on commit c1e737b

Please sign in to comment.