Run Clojure GraalVM native image on AWS Lambda custom runtime - clojure

Is there an easy way to deploy a Clojure application compiled with GraalVM native-image tool to AWS Lambda custom runtime?

There is a Leiningen template that could help with this problem.
Example:
lein new clojure-graalvm-aws-lambda your-lambda
cd your-lambda
make deploy-lambda-via-container
This example assumes that you have make and Docker installed in your system.
Note that the generated project is not a Leiningen project but a tools-deps project.

Related

How to build a Windows Qt/MSBuild C++ application inside a Jenkins docker container

First of all, I'm completely new in CI.
I am trying to set up a Jenkins to build several C++ projects I am hosting on my own Gitea instance.
The applications I want to add to my Jenkins build pipeline are mostly Qt or MSBuild projects.
I have installed the MSBuild plugin for Jenkins, however I couldn't find a Qt plugin.
Since the Jenkins docker container runs inside a Linux environment and runs on Linux itself too, I couldn't find out how to make Jenkins build MSBuild (.sln) or qt (.pro) projects.
How do I have to configure Jenkins to make it build MSBuild or Qt repositories?
Do I have to create makefile or CMakeLists files?
My goal is to have automated release builds inside my repositories built using my Jenkins docker container running on my Linux machine.
I really couldn't find a useful tutorial or explanation on this.
Thanks a lot in advance.

How to run C++ files on the Google Cloud Functions?

From what I am aware, Google Cloud Functions only allows you to deploy NodeJs or Python scripts.
Question: How would I be able to deploy a simple Hello_World.cpp on Google Cloud Functions? For example, writing a hello world HTTP function.
What are alternate methods to do this? I want to use serverless approach, since it's cheapest method. Therefore, that is why I'm going with Google Cloud Functions. Would I have to use docker in order to run C++ files? I've been stuck on this for a while and any guidance or help would be appreciated.
You can compile your C++ function into a WebAssembly module using emscripten. Then you can call it from a small nodejs glue code.
I built an example for you here:
https://github.com/ArthurSonzogni/gcloud-cpp-starter
You can run C++ Code by node.js on google cloud functions (tested with node.js 10)
how to using C++ and N-API (node-addon-api) https://medium.com/#atulanand94/beginners-guide-to-writing-nodejs-addons-using-c-and-n-api-node-addon-api-9b3b718a9a7f
use https://console.cloud.google.com/functions and click CREATE FUNCTION to upload .zip or gcloud functions deploy --runtime nodejs10 --trigger-http
The trick is when you zip file you need to remove /build and /node_modules folder then use command line by cd to folder of index.js and 'zip your_name.zip -r *'
ps. when I use firebase deploy --only functions it will error because it doesn't know file addon.node format (in fact it shouldn't read this file because it need to be recompiled) but I think if we using gcloud functions command line with .gcloudignore for /build and /node_modules it will success https://cloud.google.com/functions/docs/deploying/filesystem
HOW DOES IT WORK
I think when you deploy node.js source code to cloud functions it will run npm install and your C++ code will be compiled too (like npm run build will be auto run after npm install)
You can't use C++ on Cloud Functions, period. You can only use Node.js 6.14, Node.js 8.11.1 (beta) and Python 3.7 (also beta).
If you wish to use C++ in GCP with a serverless approach, my best suggestion would be running your own Custom Runtime in App Engine. You would still need to configure some instances options, but you don't have to manage servers and so on.
You can only use App Engine Flexible Environment (or, of course, standard VM architecture, Compute Engine). Extract from the docs (https://cloud.google.com/appengine/docs/flexible/):
Runtimes - The flexible environment includes native support for Java 8
(with no web-serving framework), Eclipse Jetty 9, Python 2.7 and Python 3.6,
Node.js, Ruby, PHP, .NET core, and Go. Developers can customize these
runtimes or provide their own runtime by supplying a custom Docker image
or Dockerfile from the open source community.
As an interesting side note, Google Serverless Containers will give you the chance to deploy your dockerized application but in a serverless flavour (in fact it's built on top of Google Cloud Functions technology). It's currently in Alpha stage.

Use Leiningen to build frontend with Gulp

I have a pretty standard Ring application with some Compojure RESTfull endpoints. We also have a frontend application based on Polymer, Bower and Gulp. So I thought it would be nice to distribute this application in one package (which means having a build which will in the end produce a WAR file consisting of both backend and frontend part which can be uploaded anywhere without any other dependencies).
However I started to dig into the Leiningen and apparently there is no plugin which would support this need. So before I am gonna build something like that on my own, is there some other way how to do this? Or am I thinking about the problem in the wrong way?
P.S. The ultimate goal is to deploy application to AWS, I've done it already via elastic-beanstalk plugin and it seemd to me pretty smooth (just build the WAR, pass it to the plugin and it will take care about the rest).
I have built projects with similarities. I avoided using leiningen/lein-plugins to build the frontend and instead built it with webpack, while letting lein compile the clojure into an uberjar. The build artifacts from webpack were output to the resources path that was declared in project.clj and packaged into an uberjar. The web server was also bundled in the uberjar and was configured to serve from that path. I used luminus as a project template.
It seems like you could do something similar here. Use gulp to build the frontend and package into a war that can be deployed to elastic beanstalk. My build script from package.json was this: npm install && NODE_ENV=production webpack -p && lein uberjar.
So, you don't need to have a lein plugin to build your frontend. I found it easier to let another build tool do that work.

How can I use a Leiningen plugin before I deploy it to Clojars?

I'm developing a Leiningen plugin. Actually, I'm working on a patch to an existing Leiningen plugin. I've made some changes, and now I want to see if they work.
What do I do?
I made these changes to support another project I'm working on. I'd like to point that project at my local working copy of the plugin to test my changes, but I don't see a way to do that.
Leiningen offers checkout dependencies, which solve this problem for dependencies, but not for plugins. Is there an equivalent for plugins?
Publish your forked version with a different group-id, either to clojars or to your local repo (with lein install). Then, in the project that uses the plugin, depend on your new artifact-id instead of the public one.

Missing build.xml when creating project with ClickStart?

I am using Eclipse EE version and CloudBees plugin to create a ClickStart JBoss 7 project. However, I am not very familiar with the EE version of Eclipse, and used Netbeans to edit my JSP.
Then I used CloudBees SDK to run and deploy my new project but it failed (the command prompt):
D:\Personel\Java EE\HelloCloudBees>bees run
ERROR: java.io.FileNotFoundException: D:\Personel\Java
EE\HelloCloudBees\build.xml (The system cannot find the file
specified)
I found no build.xml file in my folder. How can I create it?
bees run command expect an ant-based project structure, so the build.xml. As documented
CloudBees project commands are only available for applications
generated using the Bees wizard (on the web), built using the
CloudBees SDK style.
This is more or less some legacy stuff, as is now superseded by ClickStart. Equivalent command would be bees app:run but require your app to first be packaged as a WAR and only support the default tomcat6 runtime. So for your specific use-case would be simpler to package and deploy on a local JBoss 7 server. To deploy on RUN#Cloud, use bees app:deploy or just git push and let DEV#Cloud Jenkins build and deploy for you (assuming you created app with a clickstart).
Also, there's no need to use Eclipse if you're familiar with NetBeans.
Have you tried out maven?If yes you can download it and then use mvn eclipse:eclipse and then you can import your project in your workspace using eclipse import capabilities.File -> Import -> Maven -> Existing Maven Project...you point to the file where your pom.xml file is..and is imported. Take into accoutn m2eclipse plugin in eclipse must be installed prior.
regards
\n\m