How do I connect the local SQL Server database for the ASP.NET Core application running inside either local Docker or Kubernetes? - sql-server

I created an ASP.NET Core Web API using VS2017. After that I enabled the Docker support for my application.
Next, I was implemented the EF Core feature. After that I tested application locally then it’s working fine, database also created. But whenever I run the application inside local Docker or local Kubernetes the application won't work properly as I expected. because I used the Local SQL Server so, whatever the container running inside either Docker or Kubernetes it doesn't know the SQL Server or SQL Server database.
Can anyone suggest how to use the local database in the container running inside either Docker or Kubernetes?

You need to give the host's IP. In linux, you can use "host.docker.internal" hostname to connect to the host machine. It is supposedly working in Windows, however it has many, many, far too many problems in Windows.
If this hostname does not work for you, you have 2 IP addresses. One is the docker's gateway, that should start with 10...* or 172...* depending on how you set it up. Normally to learn this one, use docker inspect <container> and you can see the default gateway in the network section. However, Kubernetes might change these and it might be providing a better means to access the host. I did not use Kubernetes, so I don't know.
The other option is to use the IP address of the host, assigned by your network using DHCP. It should normally start with 192.168...
Your containers should be able to access applications on your host using these IP addresses. If the problem persists, turn off your firewall, and try pinging from inside the containers.

Related

HOW TO ACCESS ORACLE APEX APPLICATION OVER A LOCAL NETWORK

I just want my ORACLE APEX APPLICATION along with Database installed in PC-1, and then rest of PC's just access this application via LAN cable or Wi-Fi. How can i do it without using any hosting service!?
And also want to know about the ORDS Restful Services
how to configure it for the other client systems and for the server side!?
Thanks in advance!
Oracle Apex doesn't differ to any other wesite from this point of view.
You need to setup Apex/ORDS listeners, and then you can access it from your local network like :
IpOfThePCWhereApexIsInstalled:PortConfiguredWithApex/Apex
for Example
192.178.160.1:443/Apex (if Apex is configured on port 443)
192.178.160.1:80/Apex (if Apex is configured on port 80)
This way, the browser will search for the ip inside your local network and access it.

How to run my PHP API and React UI on my PC that is living on a remote environment I am accessing through SSH?

I am working on a job interview exercise to create a React CRUD application and a PHP API that accesses a mySQL database. The work is to be done on their work server environment that I have to SSH into.
How do I choose which port of their that I want my API to "live" on and then run it so that it accesses their phpmyadmin mySQL server? Then my React application must then run and access the API. They have given me their phpmyadmin port, and a port to use for my UI, and say I must choose the API port.
I was able to create the React app and API on my local machine and have it access my own local my phpmyadmin mySQL running on my local WAMP server. However when trying to run it on their remote environment I ran into a few problems. One of them I believe was running the PHP API through SSH. Do I have to set up tunneling or something? How can I run them both through SSH and have them know which ports theirs to use?
Do you foresee any other potential issues I have not mentioned? More details inc.
Thanks

Hawtio remote connect configuration parameters not correct for monitoring remote machine

My goal is to confirm that one can use a Hawtio instance to monitor an instance running on a different machine.
I am using this example https://github.com/hawtio/hawtio-camel-wiki .
right now i have it running on my local machine in OSX and on a remote Ubuntu 18 machine. I try to connect them however i cant seem to monitor the instance on the other machine.
I then tried to just use the hawtIO jar to connect to that example running on the remote machine.
I first set my hawtio.proxyWhitelist or hawtio.proxyAllowList (i also tried using the hawtio JAR on my local machine) to whitelist the endpoints. (2.10 uses the former)
java -Dhawtio.proxyAllowlist=* -jar hawtio-app.jar
My issue is i am not sure what to put in the connection tabs. I have been trying port 61613 and the path as /api/jolokia but i cant seem to figure out where its running to connect to it.
hawtio-camel-wiki is an outdated project which was archived quite a while ago and is not relevant any longer. As to what info you need to put in the Connection tab, it depends on what remote JVMs you'd like to connect to. Generally speaking, they should provide a Jolokia endpoint with a specific port (e.g. 8080) and path (e.g. /jolokia) which you should input to the connection info.
For how to incorporate a Jolokia endpoint into your application, you can check https://jolokia.org/reference/html/agents.html. If you already have something to run, the JVM agent should be the easiest option.
You can also check some Spring Boot examples here:
https://github.com/hawtio/hawtio/tree/hawtio-2.10.1/examples

How to use my local database when developing an Openshift application?

I'm giving a try to the openshift platform but I don't get how to configure it to use my local database instance (mySql, postgres, mongodb...) when doing local testing
Should I use environment variables like OPENSHIFT__DB_HOST in my local machine?
Could I use maven profiles or something like that to use a different datasource depending on the environment?
thanks
I have a python/mongodb app. I use
import os
if 'OPENSHIFT_DATA_DIR' in os.environment :
use Openshift's environment variables to setup database connection
else
use local DB or connect to OPenshift DB via port forward
To tell if I'm running on OPENSHIFT or my local PC system.
I have have two separate databases. My local small one for testing and the actual one on OPENSHIFT.
If on OPENSHIFT I just use their environment variables. If on my pc I just connect to my local development database.
You could also use port forward command 'rhc port -forward -a ' and then connect to your OPENSHIFT DB instance. You still would have to determine if your are local or OPENSHIFT to connect correctly.

how to access database on laptop using api on mobile

I have developed an application using sql anywhere database as back end and powerbuilder as front end. it is working on my laptop very well and i have also used this app on network server (without internet ) using wifi on another laptop. in which the program is installed on that other laptop and it connects database stored on my laptop .
now i want to develop a mobile app which should connect to my laptop and use database stored on it. It should connect the database using WIFI network.
i have knowledge of powerbuild simple programing, SQL and Visual basic. but i dont know any thing about mobile app developing.
Please help me to solve my problem.
This shouldn't be too challenging, it sounds like you want the app to connect to a network (or your laptop) database vs. the client machine like any web application and this shouldn't be a challenge other than making sure you've opened up the proper ports for the database in windows firewall AND/OR if you are on the INTERNET you'll probably need to set up port forwarding on your local router so that the database requests to your laptop from the "internet" get forwarded from your router to your local subnet (network).
So for example mySQL uses port 3306 (I think.. memory?) so you'd need a port forward in your router that forwards incoming 3306 requests to your laptop IP address, mac address, or machine name (better to use machine or mac).
HTH

Resources