I created a spring boot application (simple with database connection) and I would like to put it on a openshift. It's not a problem for me to generate docker image and put it into openshift, but I also want a mongodb database instance on openshift. I already created it on a openshift but know I have no idea how to connect to it from the spring boot application. I recently heard that I need to type a pod name as a connection string. Is that correct? How exactly should I connect to mongodb pod from the spring boot pod. Should I create some route between those two? I am new with playing around docker and openshift, so please try to give me as much info as you can.
Are you using your own OS3 vm?
I'm no expert on the matter, but on OS3 web console, once you create a database from templates already provided by OpenShift, OS3 shows a connection string at the end of the process.
I'm pretty sure OS3 creates a service for your db, the link looks like this:
mysql://servicename:3306/database
Related
I'm working on trying to get a MongoDB replicaset deployed into Kubernetes with a default set of collections and data. The Kubernetes piece isn't too pertinent but I wanted to provide that for background.
Essentially in our environment we have a set of collections and data in the form of .js scripts that we currently build into our MongoDB image by copying them into /docker-entrypoint-initdb.d/. This works well in our current use case where we're only deploying MongoDB as a single container using Docker. Along with revamping our entire deployment process to deploy our application into Kubernetes, I need to get MongoDB deployed in a replicaset (with persistent storage) for obvious reasons such as failover.
The issue I've run into and found recognized elsewhere such as this issue https://github.com/docker-library/mongo/issues/339 is that scripts in /docker-entrypoint-initdb.d/ do not run in the same manner when configuring a replicaset. I've attempted a few other things such as running a seed container after the mongo replicaset is initialized, building our image with the collections and data on a different volume (such as /data/db2) so that it persists once the build is finished, and a variety of scripts such as those in the github link above. All of these either don't work or feel very "hacky" and I don't particularly feel comfortable deploying these to customer environments.
Unfortunately I'm a bit limited with toolsets and have not been approved to use a cloud offering like MongoDB Atlas or tooling such as the Enterprise Kubernetes Operator. Is there any real supported method for this use case or is the supported method to use a cloud offering or one of the MondoDB operators?
Thanks in advance!
I will host my Spring Boot/ MongoDB application, developed with Java-8 in the cloud (in Europe and if possible in Germany - a demand of the customer).
I did a research and I really found a lot of possibilities.
The one that I think fits best are
Microsoft Azure and
AWS
honestly I dont know how to start. Does anyone know if there is a good tutorial to start - e.g. for installing MongoDB, than for uploading my jar file.
And than I would start my application with java -jar myApp.jar.
Is there a good how to do link?
If you're open to using Kubernetes then you could look at the example of https://github.com/nhatthai/spring-mongodb-minikube or https://github.com/elizabetht/kubernetes-mongo-docker-spring-boot You could use Azure's AKS as I'm guessing you wouldn't want to spend much time on cluster management. (AWS's EKS offering is still in preview mode at the moment.) If you did go this route you could test on a local cluster with minikube. It sounds like you're looking for a cloud provider but you might instead want to use Kubernetes as a cloud-agnostic orchestrator for your application. (On this you might want to look at Is Kubernetes + Docker + AWS = Azure + Service Fabric? ) This is just a suggestion - you could instead choose to go for something provider-specific e.g. using Azure's CosmosDB https://github.com/Azure-Samples/azure-cosmos-db-mongodb-spring
I have installed Mongodb 3.0 database instance on AWS EC2 using AWS CloudFormation.
I have following 2 queries :-
During the installation, I chose the instance type as 't2.micro'
and if I'm not wrong, this should be covered up under AWS Free-Tier
usage for evaluation purpose. But may I know where exactly, I can
see and confirm that my instance is running under free-tier usage?
I have deployed a web application too using Elastic Beanstalk
services and it is running fine with one of the EC2 instances. I can
test my application on cloud very well with static data (means no DB
interface yet). I want to open the port between my Web App on 1 EC2
instance and MongoDB (which I installed recently) running on another
EC2 instance. Can somebody advise on this?
Thank you
I really want to use mongoDB as my server backend for my android application/ web app that im hosting on the cloud. I ( think ) I installed it on my instance but Im confused as when I run my app its not showing up.
I ssh'd into my EC2 instance ( I am running Elastic Beanstalk on ssh) and I installed mongoDb and created all my tables and when I exit and ssh back into it the same tables are there however after reading up on it, I think the process is a little more complicated than that and more expensive.
Can anyone tell me if what I did was correct and if there actually a way to get mongoDb for free like this on Elastic Beanstalk? Its for my Computer Science masters.
EDIT:
I have now used Cloud Formation and installed mongo DB but now have no idea how to deploy my app without elastic beanstalk as my app runs on apache.
Thank you
No, keypoints to keep in mind:
When you SSH to your Elastic Beanstalk EC2 instances you can see a big message that says that any change that you make directly to your EC2 instances won't be saved anywhere. What I mean, you don't make ANY changes in your EC2s if you are using Elastic Beanstalk.
AWS has a MongoDB on the AWS Cloud: Quick Start Reference Deployment Guide. This document guides you through the process of installing MongoDB (includes a nice CloudFormation template -and it takes only about 15 mins to be ready-)
I'm currently trying to setup a mongo replica set in a VPC via this quick start guide https://s3.amazonaws.com/quickstart-reference/mongodb/latest/doc/MongoDB_on_the_AWS_Cloud.pdf.
I have a grails app that runs on an AWS instance which used to also host the mongo instance. Now I want to seperate the web app from mongo. I already followed the guide above and have my replica set setup with a NAT instance that I can access via ssh. Now I'm wondering how to configure grails so that it connects to this mongo instance rather than the one on its own instance.
I used to just set the db host and everything in the DataSource.groovy file and everything was fine, but I can't seem to find how to set it up to go through the NAT to the primary replica node.
Do you guys have any idea what I should do next?
Cheers,
Tobias