Custom docker image as workspace - eclipse-che

I just deployed an Eclipse Che environment on my microk8s server and it works great with the sample devfiles. Now I want to use my own repo with a custom devfile.
But everytime I try to start the environment I get the following error message: Container tools has state CrashLoopBackOff.
This only happens with the custom devfile.yaml but not with the default one. The problem is, I need a more recent version of Golang, so I need a different file.
This is the devfile.yaml
schemaVersion: 2.1.0
metadata:
name: kubernetes-image-version-checker
components:
- name: tools
container:
image: quay.io/devfile/golang:latest
env:
- name: GOPATH
value: /projects:/home/user/go
- name: GOCACHE
value: /tmp/.cache
memoryLimit: 2Gi
mountSources: true
command: ['/checode/entrypoint-volume.sh']
projects:
- name: kubernetes-image-version-checker
git:
remotes:
origin: "https://gitlab.imanuel.dev/DerKnerd/kubernetes-image-version-checker.git"

Related

React App running on OpenShift with environment variables

I have a react app which has some environment specific configuration (API Endpoint, User and Password). In my local development environment I pass this by local environment variables and can use them.
export default axios.create({
baseURL: process.env["REACT_APP_MANAGEMENT_BASE_URL"],
auth: {
username: process.env["REACT_APP_MANAGEMENT_USER"]!.toString(),
password: process.env["REACT_APP_MANAGEMENT_PASSWORD"]!.toString()
}
})
Everything works fine, when running locally. But when deploying it to OpenShift, the environment variables are not picked up.
Here is the relevant snippet from my deployment config:
spec:
containers:
- image: frontend-image
name: frontend
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
envFrom:
- configMapRef:
name: frontend-env-configs
- secretRef:
name: userdata
frontend-env-configs an userdata is created like this:
configMapGenerator:
- behavior: create
literals:
- TZ=Europe/Berlin
- REACT_APP_MANAGEMENT_BASE_URL=https://api.dev/
name: frontend-env-configs
secretGenerator:
- name: techn-user
envs:
- secrets/techn_user.env
techn_user.env holds the encrypted Username / Password which is created as secret in OpenShift.
But when I access the application I get an error on Browser console, that this environment variables are not there.
When I go to the console of my pod in OpenShift I can see the environment variables:
sh-4.4$ env | grep REACT
REACT_APP_MANAGEMENT_BASE_URL=https://api.dev/
REACT_APP_MANAGEMENT_USER=myUser
REACT_APP_MANAGEMENT_PASSWORD=passwordOfUser

How to override env variables in React JS application with Kuberenetes?

I've a simle React JS application and it's using a environment variable(REACT_APP_BACKEND_SERVER_URL) defined in .env file. Now I'm trying to deploy this application to minikube using Kubernetes.
This is my deployment file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-ui
spec:
replicas: 1
selector:
matchLabels:
app: test-ui
template:
metadata:
name: test-ui-pod
labels:
app: test-ui
spec:
containers:
- name: test-ui
image: test-ui:1.0.2
ports:
- containerPort: 80
env:
- name: "REACT_APP_BACKEND_SERVER_URL"
value: "http://127.0.0.1:59058"
When I run the application, it's working but REACT_APP_BACKEND_SERVER_URL is giving the value which I defined in .env file. Not the one I'm overriding. Can someone help me with this please? How to override the env variable using Kubernetes deployment?
After starting the app with your deployment YAML and checking for the environment variables I see the environment variables for that environment variable.
REACT_APP_BACKEND_SERVER_URL=http://127.0.0.1:59058
you can check that by doing an kubectl exec -it <pod-name> -- sh and running env command.
So you can see that REACT_APP_BACKEND_SERVER_URL is there in the environment variables. It's available for your application to use. I suspect that you may need to understand better from the React app side on how to use the .env file.

How to use Google Cloud Debugger on Cloud Run with Django

I'm trying to use Google Cloud Debugger on Cloud Run with Django. I red this document.
https://cloud.google.com/debugger/docs/setup/python
What I did.
I turned on Debugger in google cloud.
Install google-python-cloud-debugger.
I created source-context.json same directory with models.py
I add this code in manage.py
try:
import googleclouddebugger
googleclouddebugger.enable()
except ImportError:
pass
I update container of Google Cloud Run. How ever I cant find any application in Debugger
I imported my source code from GitHub. I can see my code in Debugger. However, I couldn't check break point in Debugger page.
How to debug Django on Clod Run? Please help me.
Update
I did this 2 step.
Add logger Cloud Debugger Agent rights to the service account from IAM.
Connect GitHub repository with Google Cloud Source
Cloud Debugger works on local environment. However it doesn't work in Cloud Run.
This picture has only local application. I can't find Cloud Run application.
This is my yaml file. (I'm using Cloud Run as full managed mode)
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: my_app
namespace: '135253772466'
selfLink: /apis/serving.knative.dev/v1/namespaces/135253772466/services/my_app
uid: 61b4ac55-4aab-4d33-801d-d21b0d116ea4
resourceVersion: AAWmjubgiTg
generation: 176
creationTimestamp: '2020-04-14T12:38:39.484473Z'
labels:
cloud.googleapis.com/location: asia-northeast1
annotations:
run.googleapis.com/client-name: gcloud
serving.knative.dev/creator: 135253772466#cloudbuild.gserviceaccount.com
serving.knative.dev/lastModifier: 135253772466#cloudbuild.gserviceaccount.com
client.knative.dev/user-image: gcr.io/my_project/my_app
run.googleapis.com/client-version: 291.0.0
spec:
traffic:
- percent: 100
latestRevision: true
template:
metadata:
name: my_app-00176-wud
annotations:
run.googleapis.com/client-name: gcloud
client.knative.dev/user-image: gcr.io/my_project/my_app
run.googleapis.com/client-version: 291.0.0
autoscaling.knative.dev/maxScale: '1000'
spec:
timeoutSeconds: 900
serviceAccountName: 135253772466-compute#developer.gserviceaccount.com
containerConcurrency: 80
containers:
- image: gcr.io/my_project/my_app
ports:
- containerPort: 8080
env:
- name: CLOUD_RUN_HOST
value: my_app-u3ljntrlma-an.a.run.app
resources:
limits:
cpu: 1000m
memory: 2048Mi
status:
conditions:
- type: Ready
status: 'True'
lastTransitionTime: '2020-05-26T15:39:32.595Z'
- type: ConfigurationsReady
status: 'True'
lastTransitionTime: '2020-05-26T15:39:25.640Z'
- type: RoutesReady
status: 'True'
lastTransitionTime: '2020-05-26T15:39:32.595Z'
observedGeneration: 176
traffic:
- revisionName: my_app-00176-wud
percent: 100
latestRevision: true
latestReadyRevisionName: my_app-00176-wud
latestCreatedRevisionName: my_app-00176-wud
address:
url: https://my_app-u3ljntrlma-an.a.run.app
url: https://my_app-u3ljntrlma-an.a.run.app

I can't configure lando with xdebug

I am trying to setup Xdebug with a Lando Drupal site. I have tried a lot of different lando configurations but no matter what I do I can't get xdebug to show up in my phpinfo. The current configuration I have is:
name: content-engine-1
recipe: pantheon
config:
framework: drupal8
site: content-engine-1
id: bdfe297a-e96b-401d-b932-158854085e0e
xdebug: true
php: .lando.php.ini
services:
appserver:
xdebug: true
overrides:
environment:
PHP_IDE_CONFIG: "serverName=appserver"
here's the .lando.php.ini file
xdebug.remote_enable=true
xdebug.remote_host="127.0.0.1"
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_log="/var/tmp/xdebug.log"
xdebug.remote_autostart=true
here is the output from phpinfo():
phpinfo output
Based on Documentation https://docs.lando.dev/config/php.html#configuration
it should be
name: content-engine-1
recipe: pantheon
config:
framework: drupal8
site: content-engine-1
id: bdfe297a-e96b-401d-b932-158854085e0e
xdebug: true
config:
php: .lando.php.ini

Where is the cassandra.yaml location on the MAC?

I am working on the docker environment, and executed docker exec -it mycassandra cqlsh. Then, I am inserting the data, and it is occurring the following error:
WriteTimeout - Error from server: code=1100
By this, it tells me that I need to find out the cassandra.yaml document and amend the write-time, but I can not find that on my MAC.
Could you tell me how can I find it and how to amend the document?
Thanks.
for those who have installed it as brew install cassandra, yaml file will located in usr/local/etc/cassandra
If you are running the official cassandra image then cassandra.yaml may be found at /etc/cassandra/cassandra.yaml in the container. If you want to create a custom cassandra.yaml file then you may try to overwrite it in your Dockerfile or docker-compose.yml file. For example, in my docker-compose.yml file I have something like:
services:
cassandra:
image: cassandra:3.11.4
volumes:
- ./cassandra.yaml:/etc/cassandra/cassandra.yaml
which causes the cassandra.yaml file in the container to be overwritten by my local cassandra.yaml.
I hope this helps.
From the provided example, it seems that the database is executed from inside a container. So the cassandra.yaml that you're looking for will be created on the fly when the container is started up, based on the configuration that you provided.
We have set Cassandra Containers with Kubernetes, and execute them in docker, based on the instructions found here, and been able to modify the settings of the cassandra.yaml file in the configuration of the statefulset, updating the variables in env for the spec of the container.
For example, to modify the seeds list, the cluster name, and the rack of the C* cluster named c-test-qa:
apiVersion: apps/v1
kind: StatefulSet
...
spec:
serviceName: c-test-qa
replicas: 1
selector:
matchLabels:
app: c-test-qa
template:
metadata:
labels:
app: c-test-qa
spec:
containers:
- name: c-test-qa
image: cassandra:3.11
imagePullPolicy: IfNotPresent
...
env:
- name: CASSANDRA_SEEDS
value: c-test-qa-0.c-test-qa.qa.svc.cluster.local
- name: CASSANDRA_CLUSTER_NAME
value: "testqa"
- name: CASSANDRA_RACK
value: "DC1"
- name: CASSANDRA_RACK
value: "CustomRack1"
...
On MacOS :
It will be found in either of the below locations:
Cassandra package installations: /etc/cassandra
Cassandra tarball installations: install_location/conf
DataStax Enterprise package installations: /etc/dse/cassandra
DataStax Enterprise tarball installations: install_location/resources/cassandra/conf

Resources