package
3.5.18+incompatible
Repository: https://github.com/devspace-cloud/devspace.git
Documentation: pkg.go.dev
# README
Redeploy Instead of Hot Reload example
This example shows you how to develop a small go application with automated repeated deploying with devspace on devspace.cloud. For a more detailed documentation, take a look at https://devspace.cloud/docs
Step 0: Prerequisites
For local
- Install minikube (no docker required, since devspace uses the built in minikube docker daemon)
Other
- Make sure docker is installed
- Replace
yourusername/devspace
with your desired image name indevspace.yaml
andkube/deployment.yaml
Step 1: Develop the application
- Run
devspace dev
to start the application.
The command does several things in this order:
- Build the docker image
- Create needed image pull secrets
- Deploy the kubectl manifests (you can find and change them in
kube/
) - Attach to the pod and print its output
You should see the following output:
[info] Loaded config from devspace-configs.yaml
[info] Using space redeploy
[info] Skip building image 'default'
[info] Deploying devspace-default with kubectl
deployment.extensions/devspace unchanged
[done] √ Finished deploying devspace-default
[info] The Space is now reachable via ingress on this URL: https://yourusername.devspace.host
[info] Will now try to print the logs of a running devspace pod...
[info] Printing logs of pod devspace-59c4d868f8-j2pg5/default...
Hello World!
Hello World!
Hello World!
Hello World!
- Change the message in main.go and you should see the container reloading
[info] Change detected, will reload in 2 seconds
[info] Building image 'dscr.io/yourusername/devspace' with engine 'docker'
[done] √ Authentication successful (dscr.io)
Sending build context to Docker daemon 12.29kB
Step 1/6 : FROM golang:1.11
---> 901414995ecd
[...]
[info] Image pushed to registry (dscr.io)
[done] √ Done processing image 'dscr.io/yourusername/devspace'
[info] Deploying devspace-default with kubectl
deployment.extensions/devspace configured
[done] √ Finished deploying devspace-default
[info] The Space is now reachable via ingress on this URL: https://yourusername.devspace.host
[info] Will now try to print the logs of a running devspace pod...
[info] Printing logs of pod devspace-5d5cdb7554-lmxsg/default...
Hello World devspace!
Troubleshooting
If you experience problems during deploy or want to check if there are any issues within your deployed application devspace provides useful commands for you:
devspace analyze
analyzes the namespace and checks for warning events and failed pods / containersdevspace enter
open a terminal to a kubernetes pod (the same as runningkubectl exec ...
)devspace logs
shows the logs of a devspace (the same as runningkubectl logs ...
)devspace purge
delete the deployed application
See https://devspace.cloud/docs for more advanced documentation