diff --git a/chart/values-dev.yaml b/chart/values-dev.yaml deleted file mode 100644 index b969fcb..0000000 --- a/chart/values-dev.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# Default values for devxp-app. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -# --name is the github repository name of this application deploy - -name: teste-loki -namespace: - enabled: true -image: - repository: ghcr.io/devxp-tech/teste-loki - tag: b289a6c9 -network: - service: - type: NodePort - nodePort: 3005 -resources: - requests: - cpu: "200m" - memory: "256Mi" - limits: - cpu: "400m" - memory: "512Mi" -deployment: - enabled: true -argoRollouts: - enabled: false -sealedSecrets: - enabled: false -quota: - enabled: false -istioInjection: - enabled: false -ingress: - enabled: false -autoscaling: - enabled: false -container: - port: 8080 -probe: - enabled: false diff --git a/devspace.yaml b/devspace.yaml index 44109b8..d780b35 100644 --- a/devspace.yaml +++ b/devspace.yaml @@ -1,73 +1,59 @@ version: v2beta1 name: teste-loki -# This is a list of `pipelines` that DevSpace can execute (you can define your own) +vars: + IMAGE: ghcr.io/devxp-tech/teste-loki #:devspace + pipelines: - # This is the pipeline for the main command: `devspace dev` (or `devspace run-pipeline dev`) dev: run: |- run_dependencies --all # 1. Deploy any projects this project needs (see "dependencies") - ensure_pull_secrets --all # 2. Ensure pull secrets - create_deployments --all # 3. Deploy Helm charts and manifests specfied as "deployments" - start_dev app # 4. Start dev mode "app" (see "dev" section) - # You can run this pipeline via `devspace deploy` (or `devspace run-pipeline deploy`) - deploy: - run: |- - run_dependencies --all # 1. Deploy any projects this project needs (see "dependencies") - ensure_pull_secrets --all # 2. Ensure pull secrets - build_images --all -t $(git describe --always) # 3. Build, tag (git commit hash) and push all images (see "images") - create_deployments --all # 4. Deploy Helm charts and manifests specfied as "deployments" + create_deployments --all + start_dev app # This is a list of `images` that DevSpace can build for this project # We recommend to skip image building during development (devspace dev) as much as possible images: app: - image: ghcr.io/devxp-tech/teste-loki + image: ${IMAGE} dockerfile: ./Dockerfile # This is a list of `deployments` that DevSpace can create for this project deployments: app: - # This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations - helm: - releaseName: devxp-app - # We are deploying this project with the Helm chart you provided - chart: - name: devxp-app - version: 0.1.72 - repo: https://devxp-tech.github.io/helm-charts - # Under `values` we can define the values for this Helm chart used during `helm install/upgrade` - # You may also use `valuesFiles` to load values from files, e.g. valuesFiles: ["values.yaml"] - valuesFiles: - - chart/values-dev.yaml - disableDependencyUpdate: null + # This deployment uses `kubectl` but you can also define `helm` deployments + kubectl: + manifests: + - kustomize/overlays/dev/ + kustomize: true # This is a list of `dev` containers that are based on the containers created by your deployments dev: app: # Search for the container that runs this image - imageSelector: ghcr.io/devxp-tech/teste-loki + imageSelector: ${IMAGE} # Replace the container image with this dev-optimized image (allows to skip image building during development) devImage: ghcr.io/loft-sh/devspace-containers/go:1.18-alpine + logs: {} + command: + - go + - run + - main.go # Sync files between the local filesystem and the development container sync: - - path: ./ - # Open a terminal and use the following command to start it - terminal: - command: ./devspace_start.sh - # Inject a lightweight SSH server into the container (so your IDE can connect to the remote dev env) - ssh: - enabled: true - # Make the following commands from my local machine available inside the dev container - proxyCommands: - - command: devspace - - command: kubectl - - command: helm - - gitCredentials: true + - path: ./:/app + uploadExcludeFile: .dockerignore + excludePaths: + - "**" + - "!**/*.go" + - "!go.mod" + - "!go.sum" + onUpload: + restartContainer: true # Forward the following ports to be able access your application via localhost ports: - - port: "2345" - - port: "8080" + - port: 23450:2345 + - port: 8080:8080 # Open the following URLs once they return an HTTP status code other than 502 or 503 open: - url: http://localhost:8080 @@ -80,7 +66,7 @@ commands: echo 'Anyone using this project can invoke it via "devspace run migrate-db"' test: command: |- - go test ./... + go test -v ./... # Define dependencies to other projects with a devspace.yaml # dependencies: @@ -89,3 +75,7 @@ commands: # tag: v1.0.0 # ui: # path: ./ui # Path-based dependencies (for monorepos) + +dependencies: + homepage: + path: ../homepage diff --git a/devspace_start.sh b/devspace_start.sh deleted file mode 100755 index 4732f8b..0000000 --- a/devspace_start.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -set +e # Continue on errors - -COLOR_BLUE="\033[0;94m" -COLOR_GREEN="\033[0;92m" -COLOR_RESET="\033[0m" - -# Print useful output for user -echo -e "${COLOR_BLUE} - %########% - %###########% ____ _____ - %#########% | _ \ ___ __ __ / ___/ ____ ____ ____ ___ - %#########% | | | | / _ \\\\\ \ / / \___ \ | _ \ / _ | / __// _ \\ - %#############% | |_| |( __/ \ V / ____) )| |_) )( (_| |( (__( __/ - %#############% |____/ \___| \_/ \____/ | __/ \__,_| \___\\\\\___| - %###############% |_| - %###########%${COLOR_RESET} - - -Welcome to your development container! - -This is how you can work with it: -- Files will be synchronized between your local machine and this container -- Some ports will be forwarded, so you can access this container via localhost -- Run \`${COLOR_GREEN}go run main.go${COLOR_RESET}\` to start the application -" - -# Set terminal prompt -export PS1="\[${COLOR_BLUE}\]devspace\[${COLOR_RESET}\] ./\W \[${COLOR_BLUE}\]\\$\[${COLOR_RESET}\] " -if [ -z "$BASH" ]; then export PS1="$ "; fi - -# Include project's bin/ folder in PATH -export PATH="./bin:$PATH" - -# Open shell -bash --norc - diff --git a/docker-compose-old.yml b/docker-compose-old.yml deleted file mode 100644 index 318cbde..0000000 --- a/docker-compose-old.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: "3.8" -services: - - # used as base for all services - test: &defaults - build: - context: . - target: base - working_dir: /app/ - command: go test -v ./... - environment: - - ENVIRONMENT=development - - PORT=80 # dont forget when change this value here &&& - - CGO_ENABLED=0 - - GOOS=linux - volumes: - - .:/app/ - - go_packages:/go - - # include all information in test and - # add the command to run - app: - <<: *defaults - command: go run main.go - ports: - - 8080:80 # ***update value here - - # use all configuration probided in test - # and use a stand-alone image to run tests in Circle-ci workflow - ci: - <<: *defaults - build: - context: . - target: ci - volumes: [] - -volumes: - go_packages: {} diff --git a/kustomize/base/deployment.yaml b/kustomize/base/deployment.yaml new file mode 100644 index 0000000..3db0175 --- /dev/null +++ b/kustomize/base/deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: teste-loki + labels: + app: teste-loki + component: web +spec: + selector: + matchLabels: + app: teste-loki + component: web + template: + metadata: + labels: + app: teste-loki + component: web + spec: + # imagePullSecrets: + # - name: ghcr-secret + containers: + - name: teste-loki + image: ghcr.io/devxp-tech/teste-loki #:devspace + # image: diegoluisi/teste-loki + ports: + - containerPort: 8080 + resources: + requests: + cpu: "100m" + memory: "256Mi" + limits: + cpu: "200m" + memory: "512Mi" diff --git a/kustomize/base/kustomization.yaml b/kustomize/base/kustomization.yaml new file mode 100644 index 0000000..a33121c --- /dev/null +++ b/kustomize/base/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - deployment.yaml + - service.yaml diff --git a/kustomize/base/service.yaml b/kustomize/base/service.yaml new file mode 100644 index 0000000..ba5e0a4 --- /dev/null +++ b/kustomize/base/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: teste-loki + labels: + app: teste-loki +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + name: http + selector: + app: teste-loki diff --git a/kustomize/overlays/dev/kustomization.yaml b/kustomize/overlays/dev/kustomization.yaml new file mode 100644 index 0000000..2333422 --- /dev/null +++ b/kustomize/overlays/dev/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../base