infrastructure | collecting some tools those will be | Object-Relational Mapping library
kandi X-RAY | infrastructure Summary
kandi X-RAY | infrastructure Summary
Collecting some utilities those will be useful when coding a web application with Go.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- start a tunnel
- Pagging creates a new paginator .
- AuthJWT handler for JWT
- generateConfig creates the default configuration .
- Main is the main entry point for testing
- initResourceChecker initializes the database
- Check if the resource checkers is valid
- NewRanker returns a new Ranker .
- NewJSONLogger creates a new Logger
- StructToMap converts a struct to a map .
infrastructure Key Features
infrastructure Examples and Code Snippets
Community Discussions
Trending Discussions on infrastructure
QUESTION
I am using RavenTestDriver
for my .net core unit tests .
Here is my configuration of my RavenTestDriver
in my unit test solution :
ANSWER
Answered 2022-Apr-05 at 07:53You need to create the database before calling OpenAsyncSession
https://ravendb.net/docs/article-page/5.3/csharp/client-api/operations/server-wide/create-database#example
QUESTION
I'm facing a critical issue right now in Romania. So for almost 24 hours my mobile app which is using Firebase Realtime Database can't be used on some ISPs (like Vodafone, DIGI or Telekom) if you are using mobile data (4G or 5G) the app is working fine, but on Wi-fi (on these ISPs the app is getting timeout). I talked like several hours on the phone with multiple ISPs and the Firebase support (right now the app is working using DIGI, but nobody knows why). The ISPs are saying that problem is not on their end and Firebase is saying that the problem is on the ISP side. Firebase support answer:
As this has been caused by network issues, rather than Google's infrastructure, we can't do much about it from our end. I would recommend that you contact the ISP provider directly as they will be able to check deeper on their side.
As far as we can see, the multiple providers are affected by that issue. Our engineering team is already aware of that and looking for solutions. Like I said before, there is nothing we could do with the providers, but our engineers would find any suitable workaround.
So my question is: what can I do? (I saw that Firebase realtime database deployed in europe-west works) but mine is already on united states.
Is there someone having troubles like me? I tested multiple apps which I know are using Firebase and they are having the same issues, the app being unreachable over this type of network.
So the problem is regarding Ukraine and Russia :(. Many apps using Firebase Realtime Database are not working right now.
Below I posted a fix for this and how I handled in order to make my app functional again
...ANSWER
Answered 2022-Mar-29 at 13:21So for someone who is in Europe and has the same issue like me, this is what i did.
I made a new instance of a realtime database on europe-west (because this one works on every ISP). I migrated my old database to the new one. I pushed for release a new iOS and Android build using the new database. I disabled my old instance in order to not have any syncing problems. I made all of this at night hours like 24:00.
I the morning all users would have the new update. If someone is not going to have the update until 10 AM I have set a push notification to announce this changes.
QUESTION
I'm working on a Terraform project that will set up all the GCP resources needed for a large project spanning multiple GitHub repos. My goal is to be able to recreate the cloud infrastructure from scratch completely with Terraform.
The issue I'm running into is in order to setup build triggers with Terraform within GCP, the GitHub repo that is setting off the trigger first needs to be connected. Currently, I've only been able to do that manually via the Google Cloud Build dashboard. I'm not sure if this is possible via Terraform or with a script but I'm looking for any solution I can automate this with. Once the projects are connected updating everything with Terraform is working fine.
TLDR; How can I programmatically connect a GitHub project with a GCP project instead of using the dashboard?
...ANSWER
Answered 2022-Feb-12 at 16:16Currently there is no way to programmatically connect a GitHub repo to a Google Cloud Project. This must be done manually via Google Cloud.
My workaround is to manually connect an "admin" project, build containers and save them to that project's artifact registry, and then deploy the containers from the registry in the programmatically generated project.
QUESTION
hope you all are doing well
I'm facing some problems on testing my Spring Boot application. I created a simple API (currently has only one method, and it's working) and I created the domain tests disabling JPA configurations. When I test with JPA disabled, the tests provide the following error:
...ANSWER
Answered 2022-Feb-06 at 12:04Spring has it's spring application context which is working as a container of beans. The BeanFactory
represents spring's inversion of control container. What it does is exposing beans to the application. When your application requires a bean which is not available then it throws NoSuchBeanDefinitionException
.
I think your question and the root cause is best answered in the below question. Hope it will five you insights of the problem.
What is a NoSuchBeanDefinitionException and how do I fix it?
QUESTION
I've been trying to get over this but I'm out of ideas for now hence I'm posting the question here.
I'm experimenting with the Oracle Cloud Infrastructure (OCI) and I wanted to create a Kubernetes cluster which exposes some service.
The goal is:
- A running managed Kubernetes cluster (OKE)
- 2 nodes at least
- 1 service that's accessible for external parties
The infra looks the following:
- A VCN for the whole thing
- A private subnet on 10.0.1.0/24
- A public subnet on 10.0.0.0/24
- NAT gateway for the private subnet
- Internet gateway for the public subnet
- Service gateway
- The corresponding security lists for both subnets which I won't share right now unless somebody asks for it
- A containerengine K8S (OKE) cluster in the VCN with public Kubernetes API enabled
- A node pool for the K8S cluster with 2 availability domains and with 2 instances right now. The instances are ARM machines with 1 OCPU and 6GB RAM running Oracle-Linux-7.9-aarch64-2021.12.08-0 images.
- A namespace in the K8S cluster (call it staging for now)
- A deployment which refers to a custom NextJS application serving traffic on port 3000
And now it's the point where I want to expose the service running on port 3000.
I have 2 obvious choices:
- Create a LoadBalancer service in K8S which will spawn a classic Load Balancer in OCI, set up it's listener and set up the backendset referring to the 2 nodes in the cluster, plus it adjusts the subnet security lists to make sure traffic can flow
- Create a Network Load Balancer in OCI and create a NodePort on K8S and manually configure the NLB to the ~same settings as the classic Load Balancer
The first one works perfectly fine but I want to use this cluster with minimal costs so I decided to experiment with option 2, the NLB since it's way cheaper (zero cost).
Long story short, everything works and I can access the NextJS app on the IP of the NLB most of the time but sometimes I couldn't. I decided to look it up what's going on and turned out the NodePort that I exposed in the cluster isn't working how I'd imagine.
The service behind the NodePort is only accessible on the Node that's running the pod in K8S. Assume NodeA is running the service and NodeB is just there chilling. If I try to hit the service on NodeA, everything is fine. But when I try to do the same on NodeB, I don't get a response at all.
That's my problem and I couldn't figure out what could be the issue.
What I've tried so far:
- Switching from ARM machines to AMD ones - no change
- Created a bastion host in the public subnet to test which nodes are responding to requests. Turned out only the node responds that's running the pod.
- Created a regular LoadBalancer in K8S with the same config as the NodePort (in this case OCI will create a classic Load Balancer), that works perfectly
- Tried upgrading to Oracle 8.4 images for the K8S nodes, didn't fix it
- Ran the Node Doctor on the nodes, everything is fine
- Checked the logs of kube-proxy, kube-flannel, core-dns, no error
- Since the cluster consists of 2 nodes, I gave it a try and added one more node and the service was not accessible on the new node either
- Recreated the cluster from scratch
Edit: Some update. I've tried to use a DaemonSet instead of a regular Deployment for the pod to ensure that as a temporary solution, all nodes are running at least one instance of the pod and surprise. The node that was previously not responding to requests on that specific port, it still does not, even though a pod is running on it.
Edit2: Originally I was running the latest K8S version for the cluster (v1.21.5) and I tried downgrading to v1.20.11 and unfortunately the issue is still present.
Edit3: Checked if the NodePort is open on the node that's not responding and it is, at least kube-proxy is listening on it.
...ANSWER
Answered 2022-Jan-31 at 12:06Might not be the ideal fix, but can you try changing the externalTrafficPolicy to Local. This would prevent the health check on the nodes which don't run the application to fail. This way the traffic will only be forwarded to the node where the application is . Setting externalTrafficPolicy to local is also a requirement to preserve source IP of the connection. Also, can you share the health check config for both NLB and LB that you are using. When you change the externalTrafficPolicy, note that the health check for LB would change and the same needs to be applied to NLB.
Edit: Also note that you need a security list/ network security group added to your node subnet/nodepool, which allows traffic on all protocols from the worker node subnet.
QUESTION
I'm trying to implement the tracker-enabled-dbcontext package from the documentaion and tracker-enabled-dbcontext git repository But I'm unable to change save changes to target a different database. I've modified my SaveChanges
...ANSWER
Answered 2022-Jan-28 at 13:20You can try leveraging OnAuditLogGenerated
event. Something along this lines:
QUESTION
I have a console application project where i'm using the powershell SDK, it works perfectly fine in debug but on release, everything except powershell works.
The only settings i've found where it works is when releasing the project as framework dependent and portable. Or at least it works on my pc, on other computers it says the dotnet runtime is missing, even when installed via the link provided.
Using self contained, .net6-windows and win-x86 doesn't work. Not quite sure what could be wrong? I've tried cleaning the project, the solution, restarting visual studio and my PC. Everything works as expected in debug but when I publish, powershell just doesn't work.
...ANSWER
Answered 2022-Jan-14 at 20:16Without showing actual code and giving a more descriptive detailing about what's going on aside from "it doesn't work" it's difficult to say exactly what is occurring here but I'll do my best.
Thankfully, according to Microsoft's documentation you most certainly can run the Powershell SDK in a self-contained .Net application.
A self-contained .NET application can use Microsoft.PowerShell.SDK to run arbitrary PowerShell functionality without depending on any external PowerShell installations or libraries.
This leads me to believe that you may not be having an issue with the SDK itself but rather with the compiler.
Single-File deployments
I noticed in your screenshot that you are attempting to perform a single-file deployment. You could potentially be having a few issues here. One is to ensure that you're not using an incompatible API. If you are calling any of these within your application, that could be a factor:
- Assembly.CodeBase
- Assembly.EscapedCodeBase
- Assembly.GetFile
- Assembly.GetFiles
- Assembly.Location
- AssemblyName.CodeBase
- AssemblyName.EscapedCodeBase
- Module.FullyQualifiedName
- Module.Name
As none of these are compatible with single-file deployments.
Trimming
Another issue you may be experiencing is referred to as trimming. This is where the compiler will 'trim' unused assemblies from the project at compile time and tends to happen on release runs. While I believe this is off by default you can add the following to your .csproj file to ensure that trimming is disabled:
QUESTION
One of configuration's in infrastructure layer
CustomerManagementConfigure.cs
...ANSWER
Answered 2022-Jan-11 at 15:55The service collection is available via the WebApplicationBuilder
's Services
property:
QUESTION
I'm running a simple Django application without any complicated setup (most of the default, Django allauth & Django Rest Framework).
The infrastructure for running both locally and remotely is in a docker-compose file:
...ANSWER
Answered 2021-Dec-28 at 16:43Since you're using a proxy that translates https requests into http, you need to configure Django to allow POST requests from a different scheme (since Django 4.0) by adding this to settings.py
:
QUESTION
I have many test classes, and each has dozens of tests. I want to isolate tests, so instead of a mega context MyDbContext
, I use MyDbContextToTestFoo
, MyDbContextToTestBar
, MyDbContextToTestBaz
, etc. So I have MANY DbContext
subclasses.
In my unit tests with EF Core 5 I'm running into the ManyServiceProvidersCreatedWarning
. They work individually, but many fail when run as a group:
System.InvalidOperationException : An error was generated for warning 'Microsoft.EntityFrameworkCore.Infrastructure.ManyServiceProvidersCreatedWarning': More than twenty 'IServiceProvider' instances have been created for internal use by Entity Framework. This is commonly caused by injection of a new singleton service instance into every DbContext instance. For example, calling 'UseLoggerFactory' passing in a new instance each time--see https://go.microsoft.com/fwlink/?linkid=869049 for more details. This may lead to performance issues, consider reviewing calls on 'DbContextOptionsBuilder' that may require new service providers to be built. This exception can be suppressed or logged by passing event ID 'CoreEventId.ManyServiceProvidersCreatedWarning' to the 'ConfigureWarnings' method in 'DbContext.OnConfiguring' or 'AddDbContext'.
I don't do anything weird with DbContextOptionsBuilder
as that error suggests. I don't know how to diagnose "...that may require new service providers to be built". In most tests I create a context normally: new DbContextOptionsBuilder().UseSqlite("DataSource=:memory:")
where TContext
is one of the context types I mentioned above.
I've read many issues on the repo, and discovered that EF does heavy caching of all sorts of things, but docs on that topic don't exist. The recommendation is to "find what causes so many service providers to be cached", but I don't know what to look for.
There are two workarounds:
builder.EnableServiceProviderCaching(false)
which is apparently very bad for perfbuilder.ConfigureWarnings(x => x.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning))
which ignores the problem
I assume that "service provider" means EF's internal IoC container.
What I want to know is: does the fact that I have many DbContext
types (and thus IModel
types), affect service provider caching? Are the two related? (I know EF caches an IModel
for every DbContext
, does it also cache a service provider for each one?)
ANSWER
Answered 2021-Dec-28 at 07:59Service provider caching is purely based on the context options configuration - the context type, model etc. doesn't matter.
In EF Core 5.0, the key according to the source code is
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install infrastructure
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