how to read vmc push log - cloud-foundry

when i use vmc push project to micro cloudfoundry,start application error,
smart tips is below. but i can't find log is my project path.
Uploading Application:
Checking for available resources: OK
Processing resources: OK
Packing application: OK
Uploading (206K): OK
Push Status: OK
Stopping Application: OK
Staging Application: OK
Starting Application: ..........................Error 306: Error retrieving file 'logs/startup.log'
where can found the log?

You can also manually look at files (such as logs) by using vmc files <myapp> path/to/file. For example:
vmc files myapp logs/stderr.log

You ran vmc push to deploy the app. You should be able to run vmc logs myapp to see the logs.
But I have never seen a 306 error like that. I fear that vmc logs myapp might fail for the same underlying reason you got during push.
You should be able to ssh to the Micro Cloud Foundry instance and then track down the logs. They'll be here:
/var/vcap/data/dea/apps/myapp-a-bunch-of-other-letters-and-digits/tomcat

Related

Why GCloud Builds submit failing after creating image?

I am learning deploying a pubsub service to run under Cloud Run, by following the guidelines given here
Steps I followed are:
Created a new project folder "myProject" in my local machine
Added below files:
app.jsindex.jsDockerfile
Executed below command to ship the code
gcloud builds submit --tag gcr.io/Project-ID/pubsub
It's mentioned in the tutorial document that
Upon success, you should see a SUCCESS message containing the ID, creation time, and image name. The image is stored in Container Registry and can be re-used if desired.
But in my case it's returning with error: (Ref: screenshot)
I have verified the build logs, "It's success"
So I thought to ignore this error and proceed with the next step to deploy the app by running the command:
gcloud run deploy sks-pubsub-cloudrun --image gcr.io/Project-ID/pubsub --no-allow-unauthenticated
When I run this command it immediately asking to specify the region (26 is my choice) from the list.
Next it fails with error:
Deploying container to Cloud Run service [sks-pubsub-cloudrun] in project [Project-ID] region [us-central1]
Deploying new service... Cloud Run error: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable.
Logs for this revision might contain more information.
As I am new to this GCP & Dockerizing services, not understanding this issue and unable to fix it. I researched many blogs and articles yet no proper solution for this error.
Any help will be appreciated.
Tried to run the container locally and it's failing with error.
I'm using VS Code IDE, and "Cloud Code: Debug on Cloud Run Emulator" to debug the code.
Starting to debug the app using configuration `Cloud Run: Run/Debug Locally` from .vscode/launch.json
To view more detailed logs, go to Output channel : "Cloud Run: Run/Debug Locally - Detailed"
Dependency check started
Dependency check succeeded
Unpausing minikube
The minikube profile 'cloud-run-dev-internal' has been scheduled to stop automatically after exiting Cloud Code. To disable this on future deployments, set autoStop to false in your launch configuration d:\POC\promo_run_pubsub\.vscode\launch.json
Configuring minikube gcp-auth addon
Using GCP project 'Project-Id' with minikube gcp-auth
Failed to configure minikube gcp-auth addon. Your app might not be able to authenticate Google or GCP APIs it calls. The addon has been disabled. More details can be found in the detailed logs.
Update initiated
Deploy started
Deploy completed
Status check started
Resource pod/promo-run-pubsub-5d4cd64bf9-8pf4q status updated to In Progress
Resource deployment/promo-run-pubsub status updated to In Progress
Resource pod/promo-run-pubsub-5d4cd64bf9-8pf4q status updated to In Progress
Resource deployment/promo-run-pubsub status failed with waiting for rollout to finish: 0 of 1 updated replicas are available...
Status check failed
Update failed with error code STATUSCHECK_CONTAINER_TERMINATED
1/1 deployment(s) failed
Skaffold exited with code 1.
Cleaning up...
Finished clean up.

Cloud Run /Cloud Code deployment error in intellij

trying to follow the Getting Started instructions for Deploying a Cloud Run service with Cloud Code in Intellij (deploying HelloWorld Flask app container with Cloud Run: Deploy) but getting the following error, any idea why this might be happening
it worked initially i.e. deployed the app on Cloud Run service using the same steps, and then started throwing this error after a week or so when trying to redeploy, there was no change in project settings.
intellij and docker versions are the latest.
authenticated to google cloud project with gcloud auth login --update-adc
The local run works fine (Cloud Run: Run Locally),
but running the Cloud Run: Deploy throws this "code 89" error
Preparing Google Cloud SDK (this may take several minutes for first time setup)...
Creating skaffold file: /var/.../skaffold8013155926954225609.tmp
Configuring image push settings in /var/.../skaffold8013155926954225609.tmp
../Library/Application Support/cloud-code/bin/versions/../
skaffold build --filename /var/.../skaffold8013155926954225609.tmp --tag latest --skip-tests=true
invalid skaffold config: getting minikube env:
running [/Users/USER/Library/Application Support/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/bin/
minikube docker-env --shell none -p minikube --user=skaffold]
- stdout: "false exit code 89"
- stderr: ""
- cause: exit status 89
Failed to build and push Cloud Run container image.
Please ensure your builder settings are correct, network is available, you are logged in to a valid GCP project, and try again.
Edit: I see minikube error code 89: ExGuestUnavailable and it's an error code specific to the guest host, still unclear what might be causing this
Looks like an issue with skaffold attempting to communicate with minikube (which could be used for building images as well). Please try cleaning minikube
minikube stop
minikube delete --all --purge
and try again.
ok, i still don't know why it fails to deploy to cloud run from intellij but i got it to deploy from command line
cd my-flask-app
#step 1: build container image from Dockerfile and submit to container registry
gcloud builds submit --tag gcr.io/GCP_PROJECT_ID/my-flask-app
#step 2: deploy the image on cloud run (reference)
gcloud run deploy --image gcr.io/GCP_PROJECT_ID/my-flask-app
references:
https://cloud.google.com/build/docs/building/build-containers
https://cloud.google.com/container-registry/docs/quickstart
Edit: the answer above did the trick : minikube delete --all --purge

Logstash Google Pubsub Input Plugin fails to load file and pull messages

I'm getting this error when trying to run Logstash pipeline with a configuration that is using google_pubsub on a docker container running in my production env:
2021-09-16 19:13:25 FATAL runner:135 - The given configuration is invalid. Reason: Unable to configure plugins: (PluginLoadingError) Couldn't find any input plugin named 'google_pubsub'. Are you sure this is correct? Trying to load the google_pubsub input plugin resulted in this error: Problems loading the requested plugin named google_pubsub of type input. Error: RuntimeError
you might need to reinstall the gem which depends on the missing jar or in case there is Jars.lock then resolve the jars with `lock_jars` command
no such file to load -- com/google/cloud/google-cloud-pubsub/1.37.1/google-cloud-pubsub-1.37.1 (LoadError)
2021-09-16 19:13:25 ERROR Logstash:96 - java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit
This seems to randomly happen when re-installing the plugin. I thought it's a proxy issue but I have the google domain enabled in the whitelist. Might be the wrong one / missing something. Still, doesn't explain the random failures.
Also, when I run the pipeline in my machine I get GCP events, but when I do it on a VM - no Pubsub messages are being pulled. Could it be a firewall rule blocking them?
The error message suggests there is a problem in loading the ‘google_pubsub’ input plugin. This error generally occurs when the input Pub/Sub plugin is not installed properly. Kindly ensure that you are installing the Logstash Plugin for Pub/Sub correctly.
For example, installing Logstash Plugin for Pub/Sub in a VM :
sudo -u root sudo -u logstash bin/logstash-plugin install logstash-input-google_pubsub
For a detailed demo refer to this community tutorial.

Application Logs on Cloudfoundry don't show up

I have a problem with my application logs on my Cloudfoundry deployment.
I've deployed Cloudfoundry in a something minimized design based on the tiny-aws deployment of https://github.com/cloudfoundry-community/cf-boshworkspace.
I further minimized the deployment and put everything from the VMs "api", "backbone", "health" and "services" together on the api-machines.
So I have the following VMs:
api (2 instances)
data (1 instance)
runner (2 instances)
haproxy (1 public and 1 private proxy)
Cloudfoundry version is 212.
The deployment itself seems to work. I can deploy apps and they start up.
But the logs from my applications don't show up when I run
"cf logs my-app --recent"
I've tried several log-configurations in my spring-boot-app.
standard without modifications which should log to STDOUT according to spring-boot documentation
exlicitly set a log4j.properties file which was configured to log to STDOUT as well
a log4j-2 configuration for logging on STDOUT
a spring-boot configuration which logs to a file
In the last configuration, the file was created and my logs was shown when I ran "cf files my-app log/my-app.log"
I tried to debug where my logs are lost, but I couldn't find something.
The dea_logging_agent seems to run and has the correct NATS location configured, the dea itself too.
Loggregator seems to run well on the api-host too and seems to be connected to NATS too.
So my question is: In which locations should I search to find out where my logs go?
Thank you very much.

VMC cannot detect application type when publishing Play Framework 2.2 app to CloudFoundry

I am using a free cloud foundry account. Today I tried pushing my Play 2.2 application but it rejects to start, the message is Unable to detect a supported application type (RuntimeError).
Deploying the app to cloud foundry is done as described in the official documentation.
Has anyone yet get this working?
Here is the full error message:
Preparing to start ***... OK
-----> Downloaded app package (38M)
/var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:94:in `build_pack': Unable to detect a supported application type (RuntimeError)
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:72:in `block in compile_with_timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:71:in `compile_with_timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:53:in `block in stage_application'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:49:in `chdir'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:49:in `stage_application'
from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `<main>'
Checking status of app '***'...Application failed to stage
EDIT: I posted the issue on the official mailing list. No answer yet. But here are the steps to reproduce the issue:
create a new play 2.2 app ( play new version22 )
cd into app directory ( cd version22 )
build the project ( play dist )
push the application to cloud foundry ( cf push --path=target/universal/version22-1.0-SNAPSHOT.zip ) -- just chose the defaults
bang
I guess this is caused by the new Feature (What's new in Play 2.2?) New stage and dist tasks that changed the packaging of the app. This could cause cloud foundry problem to detect the application type.
Which cloud foundry version are you targeting on v1 or v2?
Error which you are encountering is because , cf is not having a build pack for play framework.
If you are targeting cloud foundry v2 try pushing application this way:
cf push --buildpack https://github.com/cloudfoundry/java-buildpack
After some trial and error, I got it working using the following manifest.yml to deploy on cloud foundry v2:
---
env:
JAVA_HOME: .java
applications:
- name: <APP_NAME>
memory: 512M
instances: 1
host: <AP_HOST_NAME>
domain: cfapps.io
path: <PATH_TO_ZIP_FILE>
command: ./<DIR_PACKAGE_NAME>/bin/<APP_NAME>
buildpack: https://github.com/cloudfoundry/java-buildpack
You have to fill in the info between <> for your app, and config other information as well, but the core solution is to provide the JAVA_HOME env variable, and the correct path to the start command.
Perhaps we should consider a SBT task to create this file as a permanent fix, or maybe update the java-buildpack... I'm not sure which one is the best approach.
Edit: You also will need to place a script called start in <DIR_PACKAGE_NAME>/start, or else cloud foundry will try to compile the app and fail miserably - I suppose this needs to be fixed in java-buildpack as well.
This has been confirmed as a bug. Should be fixed soon.