sql-docker | Demo code used in Michael 's talk | SQL Database library
kandi X-RAY | sql-docker Summary
kandi X-RAY | sql-docker Summary
Demo code used in Michael's talk entitled "Death to SQL Server! Long live SQL Server! How containerized SQL Server makes development easier" talk
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sql-docker
sql-docker Key Features
sql-docker Examples and Code Snippets
Community Discussions
Trending Discussions on sql-docker
QUESTION
I have been trying to connect my FastAPI server and MySQL Database using Docker-compose. However, it keeps showing the following error when I run docker-compose up --build
.
Some of the posts (e.g., Post1) on the Internet and StackOverflow suggest changing the value of DB_HOST
similar to the MySQL service name, specified in the docker-compose.yml
file. I tried that option as well, but I am still getting the same error.
Could you please help me, with what changes I need to make in order to run MySQL and FastAPI server using docker-compose?
The following is my docker-compose.yml
file
ANSWER
Answered 2022-Mar-22 at 14:44As stated in the log, the database server refuse to connect, so it seems like the problem is with neither FastAPI
nor docker-compose
; because your configurations are correct.
(Assuming that you tried to connect MySQL database from some other code or server. In other words, you are sure you can connect to database from a client.)
You are using PyMySQL
connection for SQLAlchemy
. So, as stated in the documentation, your database connection string should be like:
QUESTION
I am trying to migrate my python changes to my docker project, however when I try to run the command python manage.py db migrate
I get the error unknown database 'main'
, however when I look inside of my docker-compose.yml file I see that main is indeed defined inside of the MYSQL_DATABASE
variable inside of the container db. I have tried some solutions found on StackOverflow as well as Github like getting the restart: always
out of my docker-compose.yml script and making a Windows PowerShell script that will run to restart my docker container as found here: MYSQL Docker container gives "unknown database" error, and trying to change my DATA_SAVE_PATH
variable and other such variables in my docker-compose.yml: https://github.com/laradock/laradock/issues/1017 and I have also tried to change the MYSQL_DATABASE
variable to a different name but that doesn't work either.
Here is the full error that I am receiving when I run my code:
...ANSWER
Answered 2022-Mar-02 at 19:43I solved this problem by looking in my .dbdata folder and found my service, I then changed the MYSQL_DATABASE
variable and the app configuration to the same variable as MYSQL_DATABASE
which was vegatest
instead of main
.
So I ran the same command python manager.py db migrate
and I got a successful migration.
QUESTION
I am creating a FastAPI server with simple CRUD functionalities with Postgresql as database. Everything works well in my local environment. However, when I tried to make it run in containers using docker-compose up
, it failed. I was getting this error:
ANSWER
Answered 2021-Sep-29 at 20:31First, the SQLALCHEMY_DATABASE_URI
in database.py
should match the user, password and database name suplied in Your docker-compose.yaml
. Ensure that You are running docker-compose up
with correct environ. In Your case, the environ for docker-compose up
should be:
QUESTION
I have Django application deployed in GKE. (Done with this tutorial)
My configuration file: myapp.yaml
...ANSWER
Answered 2022-Feb-28 at 16:14It looks like the sidecar for the proxy is terminating, and not letting you clean up before the application does.
Consider using the -term-timeout
flag to give yourself some time: https://github.com/GoogleCloudPlatform/cloudsql-proxy#-term_timeout30s
QUESTION
I have an application running on my local machine that uses React -> gRPC-Web -> Envoy -> Go app and everything runs with no problems. I'm trying to deploy this using GKE Autopilot and I just haven't been able to get the configuration right. I'm new to all of GCP/GKE, so I'm looking for help to figure out where I'm going wrong.
I was following this doc initially, even though I only have one gRPC service: https://cloud.google.com/architecture/exposing-grpc-services-on-gke-using-envoy-proxy
From what I've read, GKE Autopilot mode requires using External HTTP(s) load balancing instead of Network Load Balancing as described in the above solution, so I've been trying to get that to work. After a variety of attempts, my current strategy has an Ingress, BackendConfig, Service, and Deployment. The deployment has three containers: my app, an Envoy sidecar to transform the gRPC-Web requests and responses, and a cloud SQL proxy sidecar. I eventually want to be using TLS, but for now, I left that out so it wouldn't complicate things even more.
When I apply all of the configs, the backend service shows one backend in one zone and the health check fails. The health check is set for port 8080 and path /healthz which is what I think I've specified in the deployment config, but I'm suspicious because when I look at the details for the envoy-sidecar container, it shows the Readiness probe as: http-get HTTP://:0/healthz headers=x-envoy-livenessprobe:healthz. Does ":0" just mean it's using the default address and port for the container, or does indicate a config problem?
I've been reading various docs and just haven't been able to piece it all together. Is there an example somewhere that shows how this can be done? I've been searching and haven't found one.
My current configs are:
...ANSWER
Answered 2021-Oct-14 at 22:35Here is some documentation about Setting up HTTP(S) Load Balancing with Ingress. This tutorial shows how to run a web application behind an external HTTP(S) load balancer by configuring the Ingress resource.
Related to Creating a HTTP Load Balancer on GKE using Ingress, I found two threads where instances created are marked as unhealthy.
In the first one, they mention the necessity to manually enable a firewall rule to allow http load balancer ip range to pass health check.
In the second one, they mention that the Pod’s spec must also include containerPort. Example:
QUESTION
I have a Kubernetes Cluster with pods autoscalables using Autopilot. Suddenly they stop to autoscale, I'm new at Kubernetes and I don't know exactly what to do or what is supposed to put in the console to show for help.
The pods automatically are Unschedulable and inside the cluster put his state at Pending instead of running and doesn't allow me to enter or interact.
Also I can't delete or stop them at GCP Console. There's no issue regarding memory or insufficient CPU because there's not much server running on it.
The cluster was working as expected before this issue I have.
...ANSWER
Answered 2021-Nov-28 at 21:04Pods failed to schedule on any node because none of the nodes have cpu available.
Cluster autoscaler tried to scale up but it backoff after failed scale-up attempt which indicates possible issues with scaling up managed instance groups which are part of the node pool.
Cluster autoscaler tried to scale up but as the quota limit is reached no new nodes can be added.
You can't see the Autopilot GKE VMs that are being counted against your quota.
Try by creating the autopilot cluster in another region. If your needs are not no longer fulfilled by an autopilot cluster then go for a standard cluster.
QUESTION
I've created a Kubernetes cluster on Google Cloud and even though the application is running properly (which I've checked running requests inside the cluster) it seems that the NEG health check is not working properly. Any ideas on the cause?
I've tried to change the service from NodePort to LoadBalancer, different ways of adding annotations to the service. I was thinking that perhaps it might be related to the https requirement in the django side.
...ANSWER
Answered 2021-Sep-22 at 12:26I'm still not sure why, but i've managed to work when moved the service to port 80 and kept the health check on 5000.
Service config:
QUESTION
I am facing some issues on I believe to be my .yaml file. Docker-compose works fine and the containers ran as expected. But after kompose convert on the file did not yield desired result on k8s, and I am getting com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure.
There are no existing container in docker containers and docker-compose down was used prior in kompose convert.
mysql pod work fine, and able to access. spring is however unable to connect to it....
in docker-compose.yaml
...ANSWER
Answered 2021-Sep-15 at 05:43The mysql-docker-container
service port is 3307, can you try:
QUESTION
The end game is to create a database when building a docker container, and persist the data so that if the container is removed, I can start the container again and have my database with my persisted data.
I'm using microsoft/mssql-server-windows-developer with Windows containers with docker-compose.
The relevant part of my docker-compose file is (other services removed):
...ANSWER
Answered 2021-Aug-06 at 22:38You're spot on, volumes
can (And should!) be used to persist your data.
Microsoft themselves have docs on how to persist data from containerised SQL servers, including the required commands: https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-docker-container-configure?view=sql-server-ver15&pivots=cs1-bash#persist
However, this is for Linux, not Windows, so the paths will be different (Very likely the defaults for non-containerised work)
To find that location, you could probably use a query found below, or hop into the container while it is running (using docker exec
) and navigate around:
https://www.netwrix.com/how_to_view_sql_server_database_file_location.html
When using volumes with docker-compose
the spec can be found here, and is really simple to follow:
https://docs.docker.com/storage/volumes/#use-a-volume-with-docker-compose
(Edit) Proof of ConceptI played around with the Windows container and managed to get the volumes working fine.
I ditched your Dockerfile, and just used the base container image, see below.
QUESTION
I'm trying to get real client ip from using kubernetes. Many people said i should put externalTrafficPolicy: Local on my kubernetes settings, the question is i dont even know where to put it and keep getting errors. Here is my code yaml file
...ANSWER
Answered 2021-Jul-04 at 15:25externalTrafficPolicy
belongs under service spec:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sql-docker
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page