|
| 1 | +# Offline-Development example |
| 2 | + |
| 3 | +This example shows you how to develop offline with a minikube setup. You have to run `devspace up` once while online to setup the environment correctly in your minikube cluster, but you can afterwards develop offline. |
| 4 | + |
| 5 | +# Step 0: Prerequisites |
| 6 | + |
| 7 | +In order to use this example, make sure you have a working minikube setup (you don't need an additional docker daemon, because devspace can use the internal minikube docker daemon). See [install minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/) for more details. |
| 8 | + |
| 9 | +# Step 1: Start DevSpace |
| 10 | + |
| 11 | +This step has to be done once while being online. To deploy the application to minikube simply run `devspace up`. The output of the command should look similar to this: |
| 12 | + |
| 13 | +``` |
| 14 | +[DONE] √ Tiller started |
| 15 | +[DONE] √ Internal registry started |
| 16 | +[INFO] Building image 'devspace' with engine 'docker' |
| 17 | +[DONE] √ Authentication successful (10.102.46.101:5000) |
| 18 | +Sending build context to Docker daemon 6.144kB |
| 19 | +Step 1/7 : FROM node:8.11.4 |
| 20 | + ---> 8198006b2b57 |
| 21 | +Step 2/7 : RUN mkdir /app |
| 22 | + ---> Using cache |
| 23 | + ---> 1b6632b2da50 |
| 24 | +Step 3/7 : WORKDIR /app |
| 25 | + ---> Using cache |
| 26 | + ---> 20b4e5a1df9b |
| 27 | +Step 4/7 : COPY package.json . |
| 28 | + ---> ee7f6e81e51d |
| 29 | +Step 5/7 : RUN npm install |
| 30 | + ---> Running in e6ef4c082b0c |
| 31 | +npm notice created a lockfile as package-lock.json. You should commit this file. |
| 32 | +npm WARN node-js-sample@0.0.1 No repository field. |
| 33 | +
|
| 34 | +added 48 packages in 1.946s |
| 35 | + ---> ff5be7678a3d |
| 36 | +Step 6/7 : COPY . . |
| 37 | + ---> b20037e9623f |
| 38 | +Step 7/7 : CMD ["npm", "start"] |
| 39 | + ---> Running in abd0c9294587 |
| 40 | + ---> f8d49e9378ff |
| 41 | +Successfully built f8d49e9378ff |
| 42 | +Successfully tagged 10.102.46.101:5000/devspace:oswQSfh |
| 43 | +The push refers to repository [10.102.46.101:5000/devspace] |
| 44 | +e4f99e03005a: Pushed |
| 45 | +c9515cc05f90: Pushed |
| 46 | +9ad0fa9ab2ad: Pushed |
| 47 | +10959d10898a: Pushed |
| 48 | +be0fb77bfb1f: Pushed |
| 49 | +63c810287aa2: Pushed |
| 50 | +2793dc0607dd: Pushed |
| 51 | +74800c25aa8c: Pushed |
| 52 | +ba504a540674: Pushed |
| 53 | +81101ce649d5: Pushed |
| 54 | +daf45b2cad9a: Pushed |
| 55 | +8c466bf4ca6f: Pushed |
| 56 | +oswQSfh: digest: sha256:af6f6f701136149dc303aad52c124ab8913015e8125ae68994e06325c327cc2e size: 2839 |
| 57 | +[INFO] Image pushed to registry (10.102.46.101:5000) |
| 58 | +[DONE] √ Done building and pushing image 'devspace' |
| 59 | +[INFO] Deploying devspace-default with helm |
| 60 | +[DONE] √ Deployed helm chart (Release revision: 1) |
| 61 | +[DONE] √ Successfully deployed devspace-default |
| 62 | +[DONE] √ Port forwarding started on 3000:3000 |
| 63 | +[DONE] √ Sync started on /go-workspace/src/github.com/covexo/devspace/examples/minikube <-> /app (Pod: test/devspace-default-6446cb6b8c-c2l2q) |
| 64 | +root@devspace-default-6446cb6b8c-c2l2q:/app# |
| 65 | +``` |
| 66 | + |
| 67 | +The command deployed a tiller server and internal registry and used the minikube docker daemon to build the dockerfile. |
| 68 | + |
| 69 | +# Step 2: Start developing |
| 70 | + |
| 71 | +You can now disconnect from the internet. You can start the server now with `npm start` in the open terminal. Now navigate in your browser to `localhost:3000` and you should see the output 'Hello World!'. |
| 72 | + |
| 73 | +You can easily change any code within the `index.js` and restart the server with `npm start` and you should see the changes immediately, without the need of rebuilding the docker file or redeploying the chart. |
| 74 | + |
| 75 | +You can also exit the terminal and reopen it with `devspace up` without the need of an internet connection. |
0 commit comments