I am thinking of setting up Google Cloud Run to host Docker container services. If the existing service is a Node - Express REST service listening on a port, do I need to remove Express, so it isn't constantly running / listening and charged?
No, your container is only scaled up when it is receiving incoming requests. See "Cloud Run container instances" in the Cloud Run Resource model docs.
If your existing service is an Express app, you are all set.
You will not be charged when you are not receiving any request.
Just package it in a container using a Dockerfile and you can deploy it to Cloud Run. Take a look at the Node.js sample in the quickstart
Related
I am working with GCP Cloud Tasks API on localhost at the moment. I am able to enqueue tasks in Google from localhost by injecting my default credentials.
I am passing a localhost URL as the callback when the task is to execute. Is this possible to do for development?
Or does the callback URL have to be a hosted endpoint?
See Cloud Tasks documentation:
With this release of HTTP Targets, Cloud Tasks handlers can now be run on any HTTP endpoint with a public IP address, such as Cloud Functions, Cloud Run, GKE, Compute Engine, or even an on-prem web server. Your tasks can be executed on any of these services in a reliable, configurable fashion.
Meaning, it's currently not possible to pass a localhost URL as a callback when executing tasks. For development purposes, Cloud Tasks doesn't have an official emulator yet but a feature request already exists. Please make sure to "star" it so it can gain traction.
As an alternative to your objective, here's a few third-party Cloud Task emulators so you can test locally. Check out the following links:
https://gitlab.com/potato-oss/google-cloud/gcloud-tasks-emulator
https://github.com/aertje/cloud-tasks-emulator
Can anyone point me in the direction of some demo code/app that I can use for a demo.
The app should have the ability to connect to a relational database and ideally be able to demonstrate the persistence of having the DB.
I.e. You can save values into the DB from the web app
I'm planning to deploy this onto AWS ECS for testing, alongside RDS.
Thanks in advance
Here is an AWS tutorial that shows how to write a Java Spring Boot Web app that is deployed to Elastic Beanstalk ( Elastic Beanstalk is an AWS service that leverages Amazon EC2 and S3 and deploys, manages and scales your web applications for you. It uses managed containers that support Node. js, Java, Ruby, Docker and more) and uses RDS to store and update data.
Creating the Amazon Relational Database Service item tracker
So most of what you are looking for is there - including how to setup the RDS instance and interact with it from a web app deployed to the cloud. If you follow this step by step (there is a lot of Java code) -- you will get this Sample Web App running on the cloud and it will teach you how to interact with RDS from a web app.
Also - this covers invoking additional services such as Simple Email Service from the web app.
I have been trying to build an Azure DevOps Pipeline for CI/CD for my Django project. The code is being pulled from a github repo (and is actually deployed already on Azure app service). However, when I run the test on the Pipeline I get the following error when it runs python manage.py test:
Creating test database for alias 'default'...
pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
##[error]Bash exited with code '1'.
I tried extensively to whitelist Azure DevOps but the error has persisted. How can I resolve this so that the Pipeline can run tests for CI/CD?
Which agent are you using? Hosted agent or self-hosted agent?
If you are using hosted agent, since we are running the code in the pipeline via hosted agent, we should add hosted agent IP addresses to the whitelist instead of Azure DevOps Services IPs. The whitelist Azure DevOps you used is Azure DevOps Service IP. About hosted agent IP, we publish a weekly JSON file listing IP ranges for Azure data centers, broken out by region. To obtain the complete list of possible IP ranges for your agent, you must use the IP ranges from all of the regions that are contained in your geography.
If you are using self-hosted agent. Please check your local agent server IP and then add it.
I used the cloud formation template provided by Docker for AWS setup & prerequisites to set up a docker swarm.
I created a REST service using Tibco BusinessWorks Container Edition and deployed it into the swarm by creating a docker service.
docker service create --name aka-swarm-demo --publish 8087:8085 akamatibco/docker_swarm_demo:part1
The service starts successfully but the CloudWatch logs show the below exception:
I have tried passing the JVM environment variable in the Dockerfile as :
ENV JAVA_OPTS= "-Dbw.rest.docApi.port=7778"
but it doesn't help.
The interesting fact is at the end the log says:
com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300006: Started BW Application [SFDemo:1.0]
So I tried to access the application using CURL -
curl -X GET --header 'Accept: application/json' 'URL of AWS load balancer : port which I exposed while creating the service/resource URI'
But I am getting the below message:
The REST service works fine when I do docker run.
I have checked the Security Groups of the manager and load-balancer. The load-balancer has inbound open to all traffic and for the manager I opened HTTP connections.
I am not able to figure out if anything I have missed. Can anyone please help ?
As mentioned in Deploy services to swarm, if you read along, you will find the following:
PUBLISH A SERVICE’S PORTS DIRECTLY ON THE SWARM NODE
Using the routing mesh may not be the right choice for your application if you need to make routing decisions based on application state or you need total control of the process for routing requests to your service’s tasks. To publish a service’s port directly on the node where it is running, use the mode=host option to the --publish flag.
Note: If you publish a service’s ports directly on the swarm node using mode=host and also set published= this creates an implicit limitation that you can only run one task for that service on a given swarm node. In addition, if you use mode=host and you do not use the --mode=global flag on docker service create, it will be difficult to know which nodes are running the service in order to route work to them.
Publishing ports for services works different than for regular containers. The problem was; the image does not expose the port after running service create --publish and hence the swarm routing layer cannot reach the REST service. To resolve this use mode = host.
So I used the below command to create a service:
docker service create --name tuesday --publish mode=host,target=8085,published=8087 akamatibco/docker_swarm_demo:part1
Which eventually removed the exception.
Also make sure to configure the firewall settings of your load balancer so as to allow communications through desired protocols in order to access your applications deployed inside the container.
For my case it was HTTP protocol, enabling port 8087 on load balancer which served the purpose.
Hi We have built a java based web services project with using jboss server. How do I host this application with Amazon cloud? This web services act as back end for a mobile android app.
I am looking for PaaS option of Jboss server and Postgres database. I could create a postgres database. But could not find Jboss server.
My understanding is in PaaS, Jboss and Postgres should be able to scale up itself as per demand.
Another option provided by Amazon is EC2 as far as I have understood. But if I go with EC2, I will have install and set up jboss and postgres on my own. Then does it scale up by itself as per demand?
Please guide.
If you want to deploy your web application to AWS and ensure its scalability, you have basically two options:
EC2 instance [IaaS] - The disadvantage is, as you mentioned in your question, that you have to configure everything manually. Some external mechanism for scaling has to be used. Amazon provides its AutoScaling service which can be configured to launch new EC2 instances based on utilization or some other metric.
Elastic Beanstalk [PaaS] - This service has the auto-scaling already built in and manages the EC2 instances with your application on its own (it takes care about launching them, deploying the app etc). The disadvantage is that JBoss server is not support at the moment (you would have to switch to Tomcat).
There is a way, how to make JBoss work on Elastic Beanstalk, however. ELB has newly added the support for Docker so if you make your JBoss API run in Docker, you can deploy it to ELB and scale it without much effort and configuration.
As for the database, mentioned in your question, Amazon has plenty of choices, Postgres included, in their RDS service.