How can I avoid loading buildpack components from cache on Bluemix? - ibm-cloud

I want to automatically download all components of my buildpack from the internet every time I push or re-stage my application to be assured I have the latest versions.
Currently I am seeing cached buildpack components being picked up for
jboss buildpack :https://github.com/cloudfoundry-community/jboss-buildpack.
-----> Downloaded app package (14M)
-----> Downloaded app buildpack cache (181M)
Cloning into '/tmp/buildpacks/jboss-buildpack'...
-----> Java Buildpack Version: b96641c | https://github.com/cloudfoundry-community/jboss-buildpack#b96641c
-----> Downloading Open Jdk JRE 1.8.0_45 from https://download.run.pivotal.io/openjdk/trusty/x86_64/openjdk-1.8.0_45.tar.gz (found in cache)

I discovered that certain buildpacks are written with code to avoid loading stale components alleviating this concern.
For example :
Cloudfoundry Java buildpack : https://github.com/cloudfoundry/java-buildpack has a built-in mechanism to make sure it always uses latest version of the binaries it needs. https://github.com/cloudfoundry/java-buildpack/blob/master/docs/extending-caches.md explains this in detail.
Cloudfoundry Node buildpack : https://github.com/cloudfoundry/nodejs-buildpack has similar functionality using environment variables. You can create a CF environment variable : "NODE_MODULES_CACHE false"
which will force the Node.js buildpack will download node modules from the internet every time.
If you are in not sure the buildpack you are using doesn't offer this mechanism , perform following steps :
1) Fork null buildpack : https://github.com/ryandotsmith/null-buildpack
2) add : " rm -rfv $2/* " to null-buildpack/bin/compile file and commit
3) push your application with modified buildpack from Step #2, this step will completely delete contents in cache folder
4) push your application with your desired build pack.
(Reference : https://github.com/perplexes/heroku-buildpack-clearcache)

Related

Local Development Server for Lightning Web Components

I'm trying to set a Local Development Server for Lightning Web Components according to this link but when I try to install the plugin #salesforce/lwc-dev-server I get this error message :
Code: ShellParseError
and a .js file named npm-cli.js opens in my editor with this content:
#!/usr/bin/env node
require('../lib/cli.js')(process)
Anyone knows what to do? Thanks in advance.
In general, the local development for Lightning Web Components still has beta status: Local Development (Beta)
However, even the beta version can now be used relatively reliably. To set up local development you only need to authorize an org and install the development server. This allows you to develop locally without the need to push your components to an org first.
The local development server and its configuration are provided by a Salesforce CLI plugin. Before you install the plugin make sure you are using the latest Salesforce CLI version by running:
sfdx update
Then the lwc-dev-server plugin can be installed as follows:
sfdx plugins:install #salesforce/lwc-dev-server
After installing the plugin, to start the server on http://localhost:3333 and access all components of the project just run:
sfdx force:lightning:lwc:start
There is even a short official guide on how to set it up: Set Up LWC Local Development

Deploy new version to google app engine not work

I m a new user in the google cloud platform,
I followed the jhipster tutorial to deploy the jhipster web application to Google App Engine.
(https://www.jhipster.tech/gcp/)
I can deploy the original version of jhipser to GCP app engine, but when I deploy again it was not updated to the new version even my local was updated.
Does anyone know how to deploy new version to Google app engine??
I don't know much about jhipster, but if it is a classical java web application on app engine, as stated in the link you provided, you just need to re-deploy again:
./mvnw package appengine:deploy -DskipTests -Pgae,prod-gae
if you want to deploy as a new version, you should check what is the version parameter provided. You can find that in app.yaml, application-web.xml or pom.xml file depending on how the application is built.
If who built the application decided to automatically increment the version each deploy, you should have already everything set, but in App Engine > Version page in GCP you should migrate the traffic to your latest version.

Play 2.5.6 application on Tomcat or any alternative?

I have created an application on Play framework 2.5.6. I am trying to find out what is the best way to deploy the application on production. I have tomcat installed on my Ubuntu machine. How to create war file and How to deploy on tomcat? I am using Scala Eclipse IDE for development.
Have a look at this other thread which is very similar to what you're asking here (albeit directed at GAE).
In a nutshell, the disadvantages of deploying your app to Tomcat are:-
you have extra work to do to package your application as a WAR
extra work to deploy it
your application may not be fully asynchronous running in Tomcat
As that outdated documentation suggests - the simplest way of deploying your app in production is just using the version of Netty which is packaged as part of a Play application. See the relevant version of the docs to create a distribution. You only need a relevant version of a JVM on your prod server in this case.
The flow is generally:-
Run $ dist to build the binary (this is a zip by default, but you can also build a tar if you prefer using $ universal:packageZipTarball instead of dist).
Move it into your Linux production environment
Unpack it
Set permissions if you build a zip $ chmod +x /path/to/bin/<project-name> (not required if you created the tar)
Run the app start script (created by the dist task) eg. $ target/universal/stage/bin/<project-name>

Scala application on CF

I tried to launch our Scala application on the Swisscom Cloud Foundry (CF) infrastructure. To do so, the matching Heroku buildpack was used:
https://github.com/heroku/heroku-buildpack-scala
As this did not work, I tried to deploy the 'hello-scala' example using this buildpack.
My fork to be able to build the slightly outdated example:
https://github.com/AlwinEgger/hello-scala
I have to underline that I am fetching the port I have to use as env variable 'PORT'.
Unfortunately, there is not much on the log. "failed to accept connections within health check timeout" message indicates that there is no one listening...
My questions: Did anyone succeed in deploying Scala apps on CF infrastructures (# Swisscom)?
A workaround I found:
I'm not using the scala- but the java-buildback. This with the major advantage and inconvenience that the project is not any more build on the instance.
Advantage: It speeds up the whole process considerably
Inconvenience: A build server is needed
So what do we have to do?
An example may be found here (this is the actual application):
https://github.com/OpenOlitor/openolitor-server
Add the sbt-native-packager to your project
Execute the action 'universal:packageBin' building by hand or configure your build server to do so
Change the buildpack in the manifest.yml and add some parameters, if necessary. Configure the path of the artifact to deploy.
Run cf push or let the build server do so.

WASdev Liberty Openshift cartridge with local repository

The WASdev Liberty Openshift cartridge uses the liberty buildpack to download all the necessary components (liberty runtime, jre etc.).
I wonder if it's possible to package all the components ready within the cartridge so that at the point of application creation (rhc app-create or via the web console) the buildpack hasn't got to download all this stuff?
The motivation for that is a faster provisioning of the application and the prevention of timeouts. Concerning components, the websphere liberty runtime and openJDK is all we need so far.
If you are using your own Openshift deployment then packaging all the components within the cartridge is possible. I've updated the cartridge README with instructions for doing this.
For OpenShift Online, downloading the binaries for every app is the only way.