vcap | Cloud Foundry - the open platform as a service project | Microservice library
kandi X-RAY | vcap Summary
kandi X-RAY | vcap Summary
Cloud Foundry is an open platform-as-a-service (PaaS). The system supports multiple frameworks, multiple application infrastructure services and deployment to multiple clouds.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of vcap
vcap Key Features
vcap Examples and Code Snippets
Community Discussions
Trending Discussions on vcap
QUESTION
I'm trying to make a healthcheck for my service in New Relic. So I just want to call one of my APIs every x minutes and see if it returns 200. In New Relic I created a new synthetic monitor and now I'm trying to write a script for that monitor.
The script is supposed to make a post request to our service and receive a token in the response with status 200. In Postman this post request works and returns the token + Status 200 (I replaced the sensitive strings with <...>):
...ANSWER
Answered 2021-May-07 at 06:03I had to replace 'body' with 'form' like in this example.
I aslo added now the call to the API after the token was received. The final script was:
QUESTION
Hi this is my first experience trying to deploy a Python app on cloud using CF. I am having issues deploying my app; I sincerely appreciate if anyone can help me or point me to the right direction to solve the issue.
The main problem is the app that I am trying to deploy is large size due to a lot of python dependencies. The size of my app directory is 200 Kb. The first error I observed was: Staging fails due to "Failed to upload payload for droplet" . I think the reason is when all Python dependencies are downloaded from requirements.txt file and finally the droplet is created its size is too large for upload. The droplet size=982. 3 Mb.
The first solution I tried was vendoring app where I created a vendor directory containing all python dependencies but the size of vendor directory was greater that 1Gb, which causes the upload size exceed 1Gb limit and leads to failure in uploading app files.
The second solution I am working on is to upload all installed Python libraries on an object store (in my case S3 bucket which is bounded to my app) and then download the dependencies folder called Pypackages to the app's root directory: /home/vcap/app, so I want to have /home/vcap/app/Pypackages exist before my app starts on the cloud. But I couldn't do it successfully yet. I have included a python script in my app directory which downloads files from S3 bucket successfully. (I have put the correct absolute path for download in downloadS3.py script ie, /home/vcap/app/Pypackages) I want to run this script using "python downloadS3.py" as a one-off task. First I tried the solution here : Can I have multiple commands run in a manifest.yml file? and although I can see the status of the task is SUCCEED via '$cf tasks my-app-name' , /home/vcap/app/Pypackages does not exist.
I also tried to run one-off task as the steps below:
1-
$ cf push -c 'python downloadS3.py && sleep infinity' -i 1 --no-route
2-
$ cf push -c 'null'
I have printed the contents of /home/vcap/app on my app, ie when app is started and I enter the url in my browser (I don't know what is the right way to see the contents of root directory). Anyway, the problem is Pypackages are not downloaded to the correct root directory. I am not sure if I am running the one-off task in a wrong way or if there is a better solution to make my app work.
I appreciate any helps! (edited)
ANSWER
Answered 2021-Apr-05 at 16:10Diego Cells stage apps and upload droplet to blobstore via cloud controller, the max file can be uploaded is configurable at Ops Manager > TAS for VMs > Application Developer Control > Maximum File Upload Size (MB), default is 1024MB. Seems this is causing restriction, if you can get it increased with your admin help...
Tasks run in their own containers so possibly not an option. I think Python buildpack collects and install the packages before creating the droplet, so don't think copying packages directly to /app directory will be of much help.
If you have data files then you can use .profile
file and do some scripting to copy them from S3 or server/NFS location into the /app directory. Something like
QUESTION
I have a pre-built node app that must not attempt to access the network if npm install
is run prior to startup - the intent is for everything to already be present in the node_modules
directory. It is being deployed in a cloud foundry environment.
This is not a proxy problem - there must be no attempt to access registry url's during cloud foundry app staging. I'm looking for ideas why it's trying to do this.
When this app is deployed to cloud foundry, even though it detects the presence of the node_modules
directory during staging, it still tries to retrieve basic dependency modules (like @node/types) that are already present in node_modules
, and of course it times out trying to reach a registry that is not permitted in these environments. There are hundreds of other dependencies that it does not attempt to retrieve, but for some reason it thinks it does need some modules. For example:
ANSWER
Answered 2021-Mar-18 at 12:56Not 100% sure this will resolve the issue, but here's what I've seen commonly trip people up trying to vendor Node.js dependencies:
First, review the instructions from the docs: https://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring
- Run
npm install
(you've done this) - Make sure you have a
package-lock.json
file (you probably have this). That locks in the versions to use and should guarantee what's innode_modules/
matches what will be installed. If you don't have this, you'll seeWarning: package-lock.json not found.
output from the buildpack. - Make sure you're pushing up
package.json
,package-lock.json
, and the fullnode_modules/
directory, along with all your application code.
These are not documented, but some tips from what I've observed working with others on this:
Make sure you don't have a
.cfignore
file, as that could accidentally causenode_modules/
to not be pushed. You can typically tell ifnode_modules/
is not being pushed because the number of files & size of what is being pushed will be much, much larger with this. You will also see the messageIt is recommended to vendor the application's Node.js dependencies
if thenode_modules/
directory doesn't exist.When you run
npm install
locally, you need to be running it in an Ubuntu Bionic VM or container. This is because NPM will often install modules that require native code. It will automatically handle this, but what's innode_modules/
is specific for the OS & architecture where you runnpm install
. Thus If you runnpm install
on a non-Ubuntu Bionic OS (say Windows or MacOS), it will compile the native code for your local machine. When you push this up, it won't match and NPM will try to reinstall the package which can trigger access to the Internet.Make sure you're using the latest Node.js buildpack & Node.js version as possible. It always helps to have the latest code with bug fixes.
NODE_ENV=production
will be set by the buildpack, and this can sometimes cause difference in behavior. It also skips installing dev dependencies. Not likely the issue here, but worth mentioning as this trips up some people.
QUESTION
I have a Spring Boot application which has some encrypted values in its property file
e.g. spring.security.user.password=ENC(ZUkuSkFAiu/k7v7G1538ouQmuSWeAuOucAVuvxLCDwwJ0mgnIdfl3N/RgiZMGeBm)
I am using jasypt to decrypt these on the fly. This works fine running locally.
However when I deploy the app on Cloud Foundry my property file now pulls the value from vcap env variables.
e.g.
spring.security.user.password=${vcap.services.myconfig.credentials.user.password}
in PCF the value is added as
user.password = ENC(ZUkuSkFAiu/k7v7G1538ouQmuSWeAuOucAVuvxLCDwwJ0mgnIdfl3N/RgiZMGeBm)
However now my app fails to start and i get an error saying
ERROR 22 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'securityFilterChainRegistration' defined in class path resource [org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfiguration.class]: Unsatisfied dependency expressed through method 'securityFilterChainRegistration' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.security-org.springframework.boot.autoconfigure.security.SecurityProperties': Could not bind properties to 'SecurityProperties' : prefix=spring.security, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.security.user.password' to java.lang.String
Is there any reason I am missing why this works locally but not on Cloud Foundry?
UPDATE
...ANSWER
Answered 2021-Mar-14 at 14:02Try this once:
QUESTION
After deployment in IBM Cloud - App Cloud Foundry using Python - Django I found the follow error running the container:
...ANSWER
Answered 2021-Mar-13 at 14:09Your Dockerfile is for running the app as container. With Cloud Foundry you need to really have a requirements.txt with all the modules your app depends on. You also need a runtime.txt to specify the Python version. Check out this Cloud Foundry documentation on the Python buildpack and the required configuration files.
QUESTION
I am experiencing this issue even having a higher version of bundler in my gemfile. What could be the issue causing this?
...ANSWER
Answered 2021-Feb-28 at 18:59The Ruby buildpack cannot carry every single version of Ruby & bundler, it would make for an extremely large buildpack. Due to this, all buildpacks will only retain a select set of versions of the software they include in each version of the buildpack. Buildpacks are meant to encourage you to keep up with the latest versions of your software, so buildpacks will drop older versions of software as the buildpacks are updated & new releases are cut.
This means you have three choices:
You can look at the release notes for your buildpack or the build pack dependency viewer to see buildpack versions contain the specific versions of software you require.
For example, if you must have bundler 2.1.4, then you'd need to look and find the latest buildpack version which contains it. Hint, it's v1.8.27. You can confirm the same info using the buildpack release notes also.
Once you find the specific buildpack version, then you need to tell Cloud Foundry that you want that version of the buildpack, which contains the version of the software you require. For example:
cf push -b https://github.com/cloudfoundry/ruby-buildpack#v1.8.27
.This has some drawbacks though, a.) Cloud Foundry must be able to talk to the Internet and download that buildpack and b.) you're stuck with the versions of software in that buildpack, so your app may be vulnerable to security issues that have already been resolved in newer versions of software installed by the buildpack.
Most of the time you don't care about the exact specific version of Ruby, Bundler, or other libraries, and what you want is to declare a more flexible version in your project, like "I want Bundler 2". At which point, you'll just get the latest Bundler 2.x.y version supported, so long as the buildpack you're using still includes some version of Bundler 2 (even major versions will roll-off over time).
If you feel like you do need to continue specifying an exact version of Bundler (or other software), you will need to periodically update your application and the versions of software it uses to work with the more recent versions installed by the buildpack.
For example, the latest Ruby buildpack as I write this, 1.8.32, includes Bundler 2.2.11. That would mean you'd need to update your app to expect and work with this version.
In general, the most friction-free & safe option is #2. You'll continue to get updates to your software and it should continue to deploy without issue. The downside is that you may over time get an update that's incompatible with your app. You'd then have to fix that before you can continue deploying your app.
Option #3 is also OK, but it requires a lot of micromanagement. If you don't really need that level of control, I would suggest going with option #2. You'll get similar results and it'll be less effort.
Option #1 should be a last resort and only used if your app absolutely has no other option, or perhaps you need to buy some time as you upgrade the app to be compatible with newer versions. This version, over time, will leave your app susceptible to security vulnerabilities.
You might be thinking that this all sounds like a tremendous pain, but it's not. It's the buildpack forcing you to think about your software dependencies and forcing good upgrade hygiene. That is a very good thing, as it will keep your software up-to-date and keep your application protected from vulnerabilities in the software it consumes.
QUESTION
I've a webcam filming my water meter and a Python script on a raspberry is converting this picture in several steps so that i could read out the consumption.
Now my problem. After a while (sometimes it runs for weeks, sometimes after some hours and today sometimes after minutes) I'm getting this error:
...ANSWER
Answered 2021-Jan-15 at 19:37I think the first thing that you should do is to check the ret
. From this tutorial:
cap.read()
returns abool
(True/False). If the frame is read correctly, it will be True
If it is False
you have several alternatives: continue the while loop, sleep for some time, terminate the program, release the video capture and create it again, etc. You can also combine them.
Example to release the video capture and create it again:
QUESTION
I have been trying to migrate from a mysql database (version 5.7.26-29-31.37-log - output from SELECT VERSION()) to a mariadb (version 10.5.8-MariaDB-log - output from SELECT VERSION())
Also, I saw and updated django from version 2.2 to version 3.1.5, as mariadb is officially supported from version 3.0. With this, I also updated the mysqlclient library to 2.0.3.
But when on the server the "migrate" command is run, it fails with this error when doing it with the new DB: decimal.InvalidOperation: []
Here is the stack-trace:
...ANSWER
Answered 2021-Jan-13 at 13:44In the end, to exchange the driver / db connector worked for me:
Remove the mysqlclient from the dependencies
Add mysql-connector-python~=8.0 to the dependencies (insert into requirements.txt)
Adapt your DATABASES config like this in the settings.py file
QUESTION
I would like to deploy an application on a cloudfoundry instance, consisting of an Rmarkdown file which should contain both R and python chunks. I'd like to render the document on cloudfoundry, rather than doing so locally and just pushing up the HTML file.
For knitr
to work with python, it uses the reticulate
package which states in the docs:
Note that for reticulate to bind to a version of Python it must be compiled with shared library support (i.e. with the --enable-shared flag).
I tried to use the cloudfoundry python buildpack to provide python for reticulate, but got the error Python shared library not found, Python bindings not loaded
, and reticulate::py_discover_config()
on the cloudfoundry app gives:
ANSWER
Answered 2020-Dec-18 at 10:11I have found that I can install a version of python that reticulate is happy to work with, using reticulate itself. Ahead of rendering the Rmarkdown document, I can use:
QUESTION
I have data coming from Kafka, and the data will look like this:
...ANSWER
Answered 2020-Oct-13 at 07:42Don't know anything about Kafka but what your screenshoys shows is in Ruby a Hash (map) although only the keys are visible on the image.
In Ruby, if the name of the Hash is event (I'm guessing here) then you can get to the value of the x-vcap-request-id key like this event["x-vcap-request-id"]
I use a string as key because your screeenshot suggests it is but in Ruby keys are most of the time Symbols (a kind of unique fixed string) so it could also be event[:x-vcap-request-id]
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
Install vcap
Once the system is installed, you can run the following Yeti cases(Yeti stands for "Yeti Extraordinary Test Infrastructure") to ensure that major functionality is working.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page