appuio / appuio-cloud-docs

APPUiO Cloud User Documentation
https://docs.appuio.cloud
Creative Commons Attribution Share Alike 4.0 International
0 stars 1 forks source link

How To: Using DevSpace to develop apps for APPUiO Cloud #30

Closed akosma closed 2 years ago

akosma commented 2 years ago

Create a tutorial about using DevSpace to write apps for APPUiO Cloud.

tobru commented 2 years ago

https://loft.sh/blog/python-flask-development-on-kubernetes-with-devspace/ can be used as inspiration.

akosma commented 2 years ago

Unfortunately it appears that DevSpace is not compatible with OpenShift, as it deploys auxiliary images requesting privileged ports (80) or performing operations that require root permissions (read/write operations mostly) on the pod. The documentation does not mention OpenShift anywhere, so most probably this is not a supported platform. Closing.

akosma commented 2 years ago

My mistake, retried again and made it work. Working on this.

akosma commented 2 years ago

What worked was devspace deploy -p production; this ticket explains that what does not work is devspace dev, which apparently syncs files between the local laptop and the container automatically.

akosma commented 2 years ago

Tried again following suggestion by developer, without success. See original ticket for details.

akosma commented 2 years ago

Could not get devspace to work with OpenShift. Closing.

tobru commented 2 years ago

I got it working... The main issue is that the /app folder isn't writable, but with a simple "trick" we can have a writable path mounted there:

diff --git a/devspace.yaml b/devspace.yaml
index b4854cf..da4bd70 100755
--- a/devspace.yaml
+++ b/devspace.yaml
@@ -76,6 +76,14 @@ dev:
       - "9999999"
     - op: remove
       path: spec.containers[0].securityContext
+    - op: add
+      path: spec.containers[0].env
+      value:
+      - name: HOME
+        value: /app
+    persistPaths:
+      - path: /app
+        skipPopulate: true

See https://devspace.sh/cli/docs/configuration/development/replace-pods#persistence for more information about persistence. skipPopulate: true is necessary, because otherwise an init container tries to copy stuff around which again leads into:

cp: preserving times for '/devspace-persistence/.': Operation not permitted`.

Setting the HOME env var is needed so that the various dev tools are using a writable location.

With that we should be able to write a page about DevSpace on APPUiO Cloud.