question stringlengths 11 28.2k | answer stringlengths 26 27.7k | tag stringclasses 130
values | question_id int64 935 78.4M | score int64 10 5.49k |
|---|---|---|---|---|
Does Keycloak support basic Authentication (Authorization header that contains the word Basic word followed by a space and a base64-encoded string username:password ) and if so how I can configure realm and client settings for it ?
I want to secure my rest api with Keycloak and support also basic Authentication as an o... | Yes that's possible for clients with Access Type: confidential and Direct Access Grants Enabled. You can find more details on these settings in the documentation.
You also need to enable enable-basic-auth and supply your credentialsin your application settings. Consult the documentation for more details.
| Keycloak | 57,808,046 | 11 |
I know how to deploy custom KeyCloak theme in Windows using both ways as stated here:
Copy-paste theme in themes directory
Using archive deploy
Can someone please suggest how to do this in docker?
| This is what I did:
Created Dockerfile like below
FROM jboss/keycloak
COPY ./themes/<yourThemeName>/ /opt/jboss/keycloak/themes/<yourThemeName>/
Built new docker image from this file
docker build -t <yourDockerHubUserName>/keycloak .
Run this docker image
docker container run --name <someContainerName> -p 8080:... | Keycloak | 52,641,379 | 11 |
A 2-year old keycloak-user list question w/o an answer:
there’s a protected resource called Project
and an owner - a Project Manager
Each project manager has access to only their own projects (owner-only policy).
Project Managers in turn report to one or more Portfolio Managers. A Portfolio Manager should be able to a... | It turned out to be rather easy. I've decided to keep the info about managers in another database, and then the app (service-nodejs) needs to pass this info as a claim to keycloak. I've tested this on the service-nodejs keycloak quickstart. Here are the relevant pieces:
// app.js route:
app.get('/service/project/:id'... | Keycloak | 52,166,711 | 11 |
How does the access token differ from user info token when using Keycloak?
From OAuth2/OpenIDConnect I have understood that the access token gives information that the user has been authenticated
and that you need to use the user info token to get more infomation about the user and its profile/roles etc.
When I look... | The access token is meant to provide you access to the resources of your application. In order to get an access token, you have to authenticate yourself with any of the flows defined by the spec. In keycloak, access token contains the username and roles, but you can also add custom claims using the admin panel. Adding ... | Keycloak | 48,827,811 | 11 |
I'm trying to figure out, what is import/export best practices in K8S keycloak(version 3.3.0.CR1). Here is keycloak official page import/export explanation, and they example of export to single file json. Going to /keycloak/bin folder and the run this:
./standalone.sh -Dkeycloak.migration.action=export -Dkeycloak.migra... | Basically, you just have to start the exporting Keycloak instance on ports that are different from your main instance. I used something like this just now:
bin/standalone.sh -Dkeycloak.migration.action=export -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=keycloak-export.json -Djboss.http.port=8888 ... | Keycloak | 46,281,416 | 11 |
I'm creating a Keycloak extension with dependencies. I added the entry on the pom.xml like this:
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
Then I deployed it to Keycloak:
mvn clean install wildfly:deploy
But when I run it, I got the er... | You have to create your SPI dependencies as jboss modules.
Steps:
Add a jboss-deployment-structure.xml file in src/main/resources/META-INF directory or your SPI with something like this (oficial documentation):
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.json.json" />
</d... | Keycloak | 46,205,475 | 11 |
I am using a client to create a new keycloak user. Something like this:
keycloak.realm(realm)
.users()
.create(user);
The user variable is a UserRepresentation object, and I'm trying to add an Update Password required action:
user.setRequiredActions(singletonList("Update Password"))
User gets created... | Figured out what was up.
Keycloak has an enum to represent various user actions:
public static enum RequiredAction {
VERIFY_EMAIL, UPDATE_PROFILE, CONFIGURE_TOTP, UPDATE_PASSWORD, TERMS_AND_CONDITIONS
}
So the value should be "UPDATE_PASSWORD" not "Update password"
| Keycloak | 45,328,003 | 11 |
when I access keycloak admin console (!remotely) and create client:
the keycloak OIDC JSON doesn't have public key
I would expect having in JSON something like:
"realm-public-key": "MIIBIjANBg....
| keycloak.json in newest keycloak doesn't have any realm public key. Actually, it appears that you are using keycloak version 2.3.x. There have been some changes in it. Basically, you can rotate multiple public keys for a realm.
The document says:
In 2.3.0 release we added support for Public Key Rotation. When admin ro... | Keycloak | 40,503,697 | 11 |
I know keycloak has exposed below api,
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services</artifactId>
<version>2.0.0.Final</version>
</dependency>
With complete documentation here. I cannot find the required api here to fetch all users with specific role mapped to them.
Problem Sta... | Based on the documentation it appears to be this API:
GET /{realm}/clients/{id}/roles/{role-name}/users
It is there for a while. In this older version however it was not possible to get more than 100 users this way. It was fixed later and pagination possibility was added.
| Keycloak | 38,371,943 | 11 |
I'm just a beginner in Spring Security, but I would like to know is it possible to configure keycloak in a way that I can use @PreAuthorize, @PostAuthorize, @Secured and other annotations.
For example, I've configured the keycloak-spring-security-adapter and Spring Security in my simple Spring Rest webapp so that I hav... | here is example code:
@EnableWebSecurity
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true,
securedEnabled = true,
jsr250Enabled = true)
@ComponentScan(basePackageClasses = KeycloakSecurityComponents.class)
public class WebSecurityConfig extends KeycloakWeb... | Keycloak | 34,552,125 | 11 |
I am creating a simple SpringBoot application and trying to integrate with OAuth 2.0 provider Keycloak. I have created a realm, client, roles (Member, PremiumMember) at realm level and finally created users and assigned roles (Member, PremiumMember).
If I use SpringBoot Adapter provided by Keycloak https://www.keycloak... | By default, Spring Security generates a list of GrantedAuthority using the values in the scope or scp claim and the SCOPE_ prefix.
Keycloak keeps the realm roles in a nested claim realm_access.roles. You have two options to extract the roles and map them to a list of GrantedAuthority.
OAuth2 Client
If your application ... | Keycloak | 69,331,013 | 10 |
I have a local test installation of keycloak 12 and unfortunately I've lost the admin password, any idea on how to reset it or reset the keycloak configuration without losing the realms ?
I already used add-user cli command to add a user but even with that one I can't access
| For me, I had to find the user in the user_entity table. Then delete rows in related tables. After this, I restarted the pod, and the admin user login became the one passed through the environment variables KEYCLOAK_USER and KEYCLOAK_PASSWORD.
Find the user id
select * from user_entity
Delete rows
delete from credenti... | Keycloak | 69,000,968 | 10 |
I'd like to add a new auth method in keycloak. To be precise - I'd like the keycloak to ask external API for some specific value. I have read about flows in keycloak but they seem to be poorly documented and I have a feeling that it is not very intuitive.
During login I would like the keycloak to send request to extern... | There are multiple things you need to do to achieve that. I will go over them:
Implement Authenticator and AuthenticatorFactory interfaces.
Copy an existing Authentication Flow
Bind flow
I assume you know how to write and deploy a keycloak extension.
1. Implement Authenticator and AuthenticatorFactory interfaces.
T... | Keycloak | 67,800,071 | 10 |
I have setup Keycloak as a SAML broker, and authentication is done by an external IdP provided by the authorities. Users logging in using this IdP are all accepted and all we need from Keycloak is an OAuth token to access our system.
I have tried both the default setup using H2 and running with an external MariaDB.
The... |
Do I need a database, and if not how do I run Keycloak without it?
Yes, however, out-of-the-box Keycloak runs without having to deploy any external DB. From the Keycloak official documentation section Relational Database Setup one can read:
Keycloak comes with its own embedded Java-based relational database
called H... | Keycloak | 66,801,793 | 10 |
I am trying to integrate Keycloak for my client side application using javascript adapter keycloak-js.
However, I can't seem to make it work. This is my code
const keycloak = new Keycloak({
realm: 'my-realm',
url: 'http://localhost:8080/auth/',
clientId: 'my-client',
});
try {
const authenticated = awa... | It's probably a version mismatch between keycloak-js and your keycloak server. I was using the newest keycloak-js version 11.0.0 with a keycloak server version of 10.0.1, which lead to this exact error. Downgrading keycloak-js on the client side to 10.0.2 did the trick for me. (Haven't tried to upgrade the keycloak ser... | Keycloak | 63,073,772 | 10 |
Step 1. Get Access Token:
curl --location --request POST 'https://localhost/auth/realms/master/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-url## Heading ##encoded' \
--data-urlencode 'username=*******' \
--data-urlencode 'password=*******' \a
--data-urlencode 'grant_type=*******' \
-... | This url: POST /{realm}/groups/{id}/role-mappings/realm is used to assign a realm role to a group where {id} is the group id.
To assign a realm role to a user, use:
# Get the role lists
GET /{realm}/roles
# Get the user lists
GET /{realm}/users
# Assign your role to user
POST /{realm}/users/{userId}/role-mappings/rea... | Keycloak | 60,812,831 | 10 |
My application consists of:
backend/resource server
UI webapp
keycloak
The UI is talking with the backend server via RESTful API using the keycloak client with authorization code grant flow. This is working fine.
Now, I need the additional possibility to access resource of the backend using a system/service account (... | Yes, you can use OAuth 2.0 Client Credentials flow and Service Accounts.
Keycloak suggest 3 ways to secure SpringBoot REST services:
with Keycloak Spring Boot Adapter
with keycloak Spring Security Adapter
with OAuth2 / OpenID Connect
Here is a good explanation about this with an example in the OAuth2/OIDC way:
Tutor... | Keycloak | 57,974,630 | 10 |
I have logged in to virtual machine in docker but I can't find standalone.sh It isn't in /bin. I don't know also how to write dockerfile which set -Djboss.socket.binding.port-offset=100
| You can pass port as -Djboss.http.port parameter, for example:
docker run --name keycloak -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -p 11111:11111 jboss/keycloak -Djboss.http.port=11111
| Keycloak | 57,430,811 | 10 |
I need to configure Keycloak so that it creates a JWT with claim "sub" populated with the username, instead of the default userId in sub.
It means that instead of this token:
{
"jti": "b1384883-9b59-4788-b09f-98b40b7e3c3b",
...
"sub": "fbdb4e4a-6e93-4b08-a1e7-0b7bd08520a6",
"preferred_username": "m123456... | or this way: with User Property Mapper type.
{
"id": "5d45fe41-83c6-4457-807b-5240ff7c09b9",
"name": "UsernameInSubject",
"protocol": "openid-connect",
"protocolMapper": "oidc-usermodel-property-mapper",
"consentRequired": false,
"config": {
"userinfo.token.claim": "true... | Keycloak | 56,666,054 | 10 |
We need to export & import configuration from an old version 3.4 to new Keycloak version 5. But it shows error on import:
{"errorMessage":"App doesn't exist in role definitions: realm-management"}
Is there any option to import realm to new version?
| For me, I needed to create the realm using the Add Realm button and use the export file as the import file on the realm creation screen. I think the realm just needs to be created alongside the import.
| Keycloak | 55,634,189 | 10 |
I started with Using OpenID/Keycloak with Superset and did everything as explained. However, it is an old post, and not everything worked. I'm also trying to implement a custom security manager by installing it as a FAB add-on, so as to implement it in my application without having to edit the existing superset code.
I... | I ended up figuring it out myself.
The solution I ended up with does not make use of a FAB add-on, but you also don't have to edit existing code/files.
I've renamed the manager.py file to security.py, and it now looks like this:
from flask import redirect, request
from flask_appbuilder.security.manager import AUTH_OID
... | Keycloak | 54,010,314 | 10 |
How do you correctly configure NGINX as a proxy in front of Keycloak?
Asking & answering this as doc because I've had to do it repeatedly now and forget the details after a while.
This is specifically dealing with the case where Keycloak is behind a reverse proxy e.g. nginx and NGINX is terminating SSL and pushing to K... | The key to this is in the docs at
https://www.keycloak.org/docs/latest/server_installation/index.html#identifying-client-ip-addresses
The proxy-address-forwarding must be set as well as the various X-... headers.
If you're using the Docker image from https://hub.docker.com/r/jboss/keycloak/ then set the env. arg -e PR... | Keycloak | 53,564,499 | 10 |
I have a keycloak user with custom attributes like below.
I use Reactjs for front-end. I want to retrieve the custom attribute from the javascript side. Like this answer states.
https://stackoverflow.com/a/32890003/2940265
But I can't find how to do it on the javascript side.
I debugged in Chrome but I can't find a su... | I found the answer.
I will post here, because someone may find it useful.
Well, You can add custom attributes to the user but you need extra configurations to retrieve it from the javascript side. For Beginner ease, I will write the answer from Adding customer to retrieving the attribute from javascript (in my case re... | Keycloak | 53,224,680 | 10 |
How to view/configure access logs of HTTP server Keycloak uses?
I'm trying to investigate connection_refused_error to Keycloak admin UI.
| Try adding the following <access-log/> tag to your server configuration file, for example: standalone/configuration/standalone.xml.
<subsystem xmlns="urn:jboss:domain:undertow:4.0">
<buffer-cache name="default"/>
<server name="default-server">
...
<host na... | Keycloak | 51,728,612 | 10 |
TL;DR
Objective: Java authorization server:
OAuth2.0 authorization code grant flow with fine-grained permissions (not a mere SSO server)
User management and authentication: custom database
Client management and authentication: Keycloak
Questions: What are the best practices for implementing a Java authorizatio... | Building Java OAuth2.0 authorization server with Keycloak
This is possible but is bit tricky and there is lot of thing which needs to be customised.
You can derive some motivation from below repo.
keycloak-delegate-authn-consent
Building custom Java OAuth2.0 authorization server with MITREid
If you are open to use othe... | Keycloak | 49,150,219 | 10 |
Situation: We use keycloak to authenticate users in our web application (A) through normal browser authentication flow using the JavaScript adapter. This works perfectly!
Goal: Now, a new group of users should be able to access A. But they log in with username and password in a trusted third-party application (B) witho... | So I was finally able to solve it with the Authentication SPI mentioned in the question.
In Keycloak, I made a copy of the "browser" authentication flow (since you can not modify built-in flows) and introduced an additional step "Portal JWT" (see picture below). I then bound it to "Browser Flow" in the "Bindings" tab
... | Keycloak | 48,638,584 | 10 |
I'm using Identity Brokering feature and external IDP. So, user logs in into external IDP UI, then KeyCloak broker client receives JWT token from external IDP and KeyCloak provides JWT with which we access the resources. I've set up Default Identitiy Provider feature, so external IDP login screen is displayed to the us... | The problem was that KeyCloak has no information about passwords from initial identity provider. They have a token exchange feature which should be used for programmatic token exchange.
External Token to Interanal Token Exchange should be used to achieve it.
Here is an example code in Python which does it (just place c... | Keycloak | 47,557,433 | 10 |
First of all I'm using
keycloak-authz-client-3.3.0.Final
spring boot 1.5.8.RELEASE
spring-boot-starter-security
I've been playing with Keycloak spring adapter exploring the examples since we want to adopt it to our project.
I was able to make it run for Roles easily using this tutorial:
https://dzone.com/articles/... | I've managed to get it working by adding uma_protection role to the Service Account Roles tab in Keycloak client configuration
More information about it here:
http://www.keycloak.org/docs/2.0/authorization_services_guide/topics/service/protection/whatis-obtain-pat.html
Second part of the solution:
It's mandatory to h... | Keycloak | 47,199,243 | 10 |
I want to create keycloak client role programmatically and assign to user created dynamically. Below is my code for creating user
UserRepresentation user = new UserRepresentation();
user.setEmail("xxxxx@xxx.com");
user.setUsername("xxxx");
user.setFirstName("xxx");
user.setLastName("m");
user.setEnabled(true);
Respons... | Here is a solution to your request (not very beautiful, but it works):
// Get keycloak client
Keycloak kc = Keycloak.getInstance("http://localhost:8080/auth",
"master", "admin", "admin", "admin-cli");
// Create the role
RoleRepresentation clientRoleRepresentation = new RoleRepresentation();
clientRoleR... | Keycloak | 43,222,769 | 10 |
I'm using Node.JS (express) and an NPM called keycloak-connect to connect to a keycloak server.
When I'm implementing the default mechanism as described to protect a route:
app.get( '/about', keycloak.protect(), function(req,resp) {
resp.send( 'Page: ' + req.params.page + '<br><a href="/logout">logout</a>');
} );
... | I guess you added a port to your client URLs in your client settings tab.
e.g.
root url: https://demo.server.biz:443/cxf
just remove the port
root url: https://demo.server.biz/cxf
the same goes for Valid Redirect URIs and Web Origins
1 Update
2 Update with your url
| Keycloak | 37,115,626 | 10 |
JBoss keycloak offers an admin url in the client settings, where you can react on logout push events or other events. Unfortunatly I cannot find any documentation about how to use this url? Can you give me a hint, if this is e.g. part of OpenID Spec or if a API Doc exists for this.
Especially I want to know how I can r... | AFAIK the use of the Admin URL is Keycloak specific, and not part of Open ID Connect or OAuth.
I suppose you'll need to take a look at the code, i.e. PreAuthActionsHandler#handleRequest handles URLs ending with k_logout and k_push_not_before.
The easiest way to handle these events is to use a Keycloak client adapter. ... | Keycloak | 35,704,546 | 10 |
I'm using Keycloak auth mechanism for my angular/node/typescript application .I could not find a definitelyTyped d.ts file for Keycloak.js
Is there a typescript equivalent/work in progress for this JBOSS Keycloak.js adapter or do I have to write one ? any inputs/pointers would be much appreciated
| There is an official type definition at:
https://github.com/keycloak/keycloak/blob/master/adapters/oidc/js/src/main/resources/keycloak.d.ts and https://www.npmjs.com/package/@types/keycloak-js
Update:
https://www.npmjs.com/package/keycloak-js
From @types/keycloak-js:
keycloak-js provides its own type definitions, so y... | Keycloak | 34,430,049 | 10 |
I'd like to calculate a point on a quadratic curve. To use it with the canvas element of HTML5.
When I use the quadraticCurveTo() function in JavaScript, I have a source point, a target point and a control point.
How can I calculate a point on the created quadratic curve at let's say t=0.5 with "only" knowing this thre... | Use the quadratic Bézier formula, found, for instance, on the Wikipedia page for Bézier Curves:
In pseudo-code, that's
t = 0.5; // given example value
x = (1 - t) * (1 - t) * p[0].x + 2 * (1 - t) * t * p[1].x + t * t * p[2].x;
y = (1 - t) * (1 - t) * p[0].y + 2 * (1 - t) * t * p[1].y + t * t * p[2].y;
p[0] is the sta... | Curve | 5,634,460 | 64 |
How can I find the point B(t) along a cubic Bezier curve that is closest to an arbitrary point P in the plane?
| I've written some quick-and-dirty code that estimates this for Bézier curves of any degree. (Note: this is pseudo-brute force, not a closed-form solution.)
Demo: http://phrogz.net/svg/closest-point-on-bezier.html
/** Find the ~closest point on a Bézier curve to a point you supply.
* out : A vector to modify to be t... | Curve | 2,742,610 | 54 |
I want to create an animation with css that simulate a wave movement.
I need to change a line-or div- to a curve for this...
The CSS rules that I'm familiar to, make the entire div to semicircular or change element border.
For example:
border-radius, or perspective or border-top-radius...
This image show you what I wan... | You could use an asymmetrical border to make curves with CSS.
border-radius: 50%/100px 100px 0 0;
VIEW DEMO
.box {
width: 500px;
height: 100px;
border: solid 5px #000;
border-color: #000 transparent transparent transparent;
border-radius: 50%/100px 100px 0 0;
}
<div class="box"></div>
| Curve | 20,803,489 | 48 |
I have the following code to calculate points between four control points to generate a catmull-rom curve:
CGPoint interpolatedPosition(CGPoint p0, CGPoint p1, CGPoint p2, CGPoint p3, float t)
{
float t3 = t * t * t;
float t2 = t * t;
float f1 = -0.5 * t3 + t2 - 0.5 * t;
float f2 = 1.5 * t3 - 2.5 * t2 ... | I needed to implement this for work as well. The fundamental concept you need to start with is that the main difference between the regular Catmull-Rom implementation and the modified versions is how they treat time.
In the unparameterized version from your original Catmull-Rom implementation, t starts at 0 and ends w... | Curve | 9,489,736 | 45 |
I have been playing around with canvas recently and have been drawing several shapes (tear drops, flower petals, clouds, rocks) using methods associated with these curves. With that said, I can't seem to figure out the difference between the use cases of these different curves.
I know the cubic bezier has 2 control poi... | As you've discovered, both Quadratic curves and Cubic Bezier curves just connect 2 points with a curve.
Since the Cubic curve has more control points, it is more flexible in the path it takes between those 2 points.
For example, let’s say you want to draw this letter “R”:
Start drawing with the “non-curvey” parts of ... | Curve | 18,814,022 | 44 |
I have a file that contains 4 numbers (min, max, mean, standard derivation) and I would like to plot it with gnuplot.
Sample:
24 31 29.0909 2.57451
12 31 27.2727 5.24129
14 31 26.1818 5.04197
22 31 27.7273 3.13603
22 31 28.1818 2.88627
If I have 4 files with one column, then I can do:
gnuplot "file1.txt" with lines, "... | You can plot different columns of the same file like this:
plot 'file' using 0:1 with lines, '' using 0:2 with lines ...
(... means continuation). A couple of notes on this notation: using specifies which column to plot i.e. column 0 and 1 in the first using statement, the 0th column is a pseudo column that translates... | Curve | 16,073,232 | 40 |
I have three points in 2D and I want to draw a quadratic Bézier curve passing through them. How do I calculate the middle control point (x1 and y1 as in quadTo)? I know linear algebra from college but need some simple help on this.
How can I calculate the middle control point so that the curve passes through it as wel... | Let P0, P1, P2 be the control points, and Pc be your fixed point you want the curve to pass through.
Then the Bezier curve is defined by
P(t) = P0*t^2 + P1*2*t*(1-t) + P2*(1-t)^2
...where t goes from zero to 1.
There are an infinite number of answers to your question, since it might pass through your point for any val... | Curve | 6,711,707 | 39 |
I have been using scipy.optimize.leastsq to fit some data. I would like to get some confidence intervals on these estimates so I look into the cov_x output but the documentation is very unclear as to what this is and how to get the covariance matrix for my parameters from this.
First of all it says that it is a Jacobia... | OK, I think I found the answer. First the solution:
cov_x*s_sq is simply the covariance of the parameters which is what you want. Taking sqrt of the diagonal elements will give you standard deviation (but be careful about covariances!).
Residual variance = reduced chi square = s_sq = sum[(f(x)-y)^2]/(N-n), where N is n... | Curve | 14,854,339 | 37 |
One example for curve is shown as below. The elbow point might be x=3 or 4.
How to compute the elbow for a curve automatically and mathematically?
| I created a Python package that attempts to implement the Kneedle algorithm.
To recreate the function above and detect the point of maximum curvature:
x = range(1,21)
y = [0.065, 0.039, 0.030, 0.024, 0.023, 0.022, 0.019, 0.0185, 0.0187,
0.016, 0.015, 0.016, 0.0135, 0.0130, 0.0125, 0.0120, 0.0117, 0.0115, 0.0112, 0... | Curve | 4,471,993 | 32 |
I want to create a rainbow circle, like the picture below:
How can I draw the curved and multiple color stop gradient?
Here's my current code:
<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="test">
<stop offset="0%" s... | This approach won't work. SVG doesn't have conical gradients. To simulate the effect, you would have to fake it with a large number of small line segments. Or some similar technique.
Update:
Here is an example. I approximate the 360deg of hue with six paths. Each path contains an arc which covers 60deg of the circle... | Curve | 18,206,361 | 29 |
I have a data frame created with this code:
require(reshape2)
foo <- data.frame( abs( cbind(rnorm(3),rnorm(3, mean=.8),rnorm(3, mean=.9),rnorm(3, mean=1))))
qux <- data.frame( abs( cbind(rnorm(3),rnorm(3, mean=.3),rnorm(3, mean=.4),rnorm(1, mean=2))))
bar <- data.frame( abs( cbind(rnorm(3,mean=.4),rnorm(3, mean=.3),rno... | Try this:
ggplot(data=alldf.m, aes(x=variable, y = value, colour = ID, group = ID)) +
geom_line() + facet_wrap(~fn)
| Curve | 14,640,872 | 26 |
I have a list of points that make a curve, and I would like to reduce the number of points, but still keep the overall shape of the curve.
Basically, I want to go from this:
To this:
So the algorithm would remove the points that are redundant but preserve those that really define the shape (like the points at the bot... | Consider Douglas–Peucker_algorithm
| Curve | 7,980,586 | 24 |
I want to plot individual data points with error bars on a plot, but I don't want to have the curve. How can I do this? Are there some 'invisible' line style or can I set the line style colourless (but the marker still has to be visible)?
So this is the graph I have right now:
plt.errorbar(x5,y5,yerr=error5, fmt='o')
p... | You can use scatter:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2*np.pi, 10)
y = np.sin(x)
plt.scatter(x, y)
plt.show()
Alternatively:
plt.plot(x, y, 's')
EDIT: If you want error bars you can do:
plt.errorbar(x, y, yerr=err, fmt='o')
| Curve | 27,773,057 | 22 |
Suppose I want to plot x^2. I can use curve() as follows.
curve(x^2, -5, 5)
However, I would like the axes to go through (0, 0). I could do something as follows:
curve(x^2, -5, 5, axes=FALSE)
axis(1, pos=0)
axis(2, pos=0)
abline(h=0)
abline(v=0)
And I end up getting something like below, which looks OK. But the only... | By default, axis() computes automatically the tick marks position, but you can define them manually with the at argument. So a workaround could be something like :
curve(x^2, -5, 5, axes=FALSE)
axis(1, pos=0, at=-5:5)
axis(2, pos=0)
Which gives :
The problem is that you have to manually determine the position of each... | Curve | 14,539,785 | 18 |
I'm trying to draw a curve in canvas with a linear gradient stoke style along the curve, as in this image. On that page there is a linked svg file that gives instructions on how to accomplish the effect in svg. Maybe a similar method would be possible in canvas?
| A Demo: http://jsfiddle.net/m1erickson/4fX5D/
It's fairly easy to create a gradient that changes along the path:
It's more difficult to create a gradient that changes across the path:
To create a gradient across the path you draw many gradient lines tangent to the path:
If you draw enough tangent lines then the eye... | Curve | 24,027,087 | 16 |
Ok pretty self explanatory. I'm using google maps and I'm trying to find out if a lat,long point is within a circle of radius say x (x is chosen by the user).
Bounding box will not work for this. I have already tried using the following code:
distlatLng = new google.maps.LatLng(dist.latlng[0],dist.latlng[1]);
var latL... | Unfortunately Pythagoras is no help on a sphere. Thus Stuart Beard's answer is incorrect; longitude differences don't have a fixed ratio to metres but depend on the latitude.
The correct way is to use the formula for great circle distances. A good approximation, assuming a spherical earth, is this (in C++):
/** Find th... | Curve | 4,463,907 | 15 |
I've managed to implement quadratic and cubic Bezier curves.They are pretty straightforward since we have a formula. Now I want to represent an n-th order Bezier curve using the generalization:
Where
and
I'm using a bitmap library to render the output, so here is my code:
// binomialCoef(n, k) = (factorial(n) / (fac... | The sum in your formula...
...runs from 0 to n, ie for an n-th order bezier you need n+1 points.
You have 4 points, so you're drawing a 3rd-order bezier.
The error in your code is here:
for(int j = 0; (unsigned int)j < nbPoint; j++)
it should be:
for(int j = 0; (unsigned int)j <= nbPoint; j++)
otherwise you're only ... | Curve | 15,599,766 | 14 |
I need to draw a symmetrically curved line between the centers of two circles.
<svg>
<circle class="spot" id="au" cx="1680" cy="700" r="0"></circle>
<circle class="spot" id="sl" cx="1425" cy="525" r="0"></circle>
<line id="line1" stroke-width="2" stroke="red"/>
</svg>
This is the code I wrote so far. < li... | An SVG quadratic curve will probably suffice. To draw it, you need the end points (which you have) and a control point which will determine the curve.
To make a symmetrical curve, the control point needs to be on the perpendicular bisector of the line between the end points. A little maths will find it.
So, from two po... | Curve | 49,274,176 | 14 |
I'm using OpenCV (Canny + findCountours) to find external contours of objects. The curve drawn is typically almost, but not entirely, closed. I'd like to close it - to find the region it bounds.
How do I do this?
Things considered:
Dilation - the examples I've seen show this after Canny, although it would seem to me... | Using PolyLine method to draw contours
cv2.PolyLine(img, points, is_closed=True, 255, thickness=1, lineType=8, shift=0)
Read the docs for further details: http://docs.opencv.org/2.4/modules/core/doc/drawing_functions.html
Mark answered if it resolved your problem. If not then let me know.
| Curve | 21,469,409 | 13 |
I'm creating a graph in JavaFX which is supposed to be connected by directed edges. Best would be a bicubic curve. Does anyone know how to do add the arrow heads?
The arrow heads should of course be rotated depending on the end of the curve.
Here's a simple example without the arrows:
import javafx.application.Applicat... | Since you're already dealing with shapes (curves), the best approach for the arrows is just keep adding more shapes to the group, using Path.
Based on this answer, I've added two methods: one for getting any point of the curve at a given parameter between 0 (start) and 1 (end), one for getting the tangent to the curve ... | Curve | 26,702,519 | 13 |
Within R, I want to interpolate an arbitrary path with constant distance
between interpolated points.
The test-data looks like that:
require("rgdal", quietly = TRUE)
require("ggplot2", quietly = TRUE)
r <- readOGR(".", "line", verbose = FALSE)
coords <- as.data.frame(r@lines[[1]]@Lines[[1]]@coords)
names(coords) <- c("... | How about regular splines using the same method you used for approx? Will that work on the larger data?
xy.int.sp <- as.data.frame(with(coords, list(x = spline(x)$y,
y = spline(y)$y)))
| Curve | 11,356,997 | 12 |
I have
plot(rnorm(120), rnorm(120), col="darkblue", pch=16, xlim=c(-3,3), ylim=c(-4,4))
points(rnorm(120,-1,1), rnorm(120,2,1), col="darkred", pch=16)
points(c(-1,-1.5,-3), c(4,2,0), pch=3, cex=3)
I want to delineate a part of a graph, by drawing a smooth curve passing through a set of points.I can define 3-4 set of p... | if I understood the question right, drawing a spline through control points should do the job:
xspline(c(-1,-1.5,-3), c(4,2,0), shape = -1)
| Curve | 14,303,251 | 12 |
I am working on a black&white image just like the first one from the link :
http://imageshack.us/g/33/firstwm.png/
It has a lot of "noise" so I applied a Median filter over it to smooth it, thus getting the second picture.
cvSmooth(TempImage, TempImage, CV_MEDIAN, 5, 0);
After this i get the contours and draw them on ... |
If this is the smoothing result you're after, it can be obtained by doing a Gaussian blur, followed by a thresholding. I.e. using cvSmooth with CV_GAUSSIAN as the paramater. Followed by a cvThreshold.
If you want a smoother transition than thresholding (like this), you can get that with adjusting levels (remapping the... | Curve | 7,416,025 | 11 |
Given the points of a line and a quadratic bezier curve, how do you calculate their nearest point?
| There exist a scientific paper regarding this question from INRIA: Computing the minimum distance between two Bézier curves (PDF here)
| Curve | 8,473,572 | 11 |
I am trying to find an algorithm to calculate the bounding box of a given cubic bezier curve. The curve is in 3D space.
Is there a mathematic way to do this except of sampling points on the curve and calculating the bounding box of these points?
| Most of this is addressed in An algorithm to find bounding box of closed bezier curves? except here we have cubic Beziers and there they were dealing with quadratic Bezier curves.
Essentially you need to take the derivatives of each of the coordinate functions. If the x-coord is given by
x = A (1-t)^3 +3 B t (1-t)^2 + ... | Curve | 24,809,978 | 11 |
I've been working on this for several weeks but have been unable to get my algorithm working properly and i'm at my wits end. Here's an illustration of what i have achieved:
If everything was working i would expect a perfect circle/oval at the end.
My sample points (in white) are recalculated every time a new control ... | Your algorithm seems to work for any inputs I tried it on. Your problem might be a that a control point is not where it is supposed to be, or that they haven't been initialized properly. It looks like there are two control-points, half the height below the bottom left corner.
| Curve | 15,944,532 | 10 |
Minio has policies for each bucket. Which contains:
ReadOnly
WriteOnly
Read+Write
None
How are these related to the anonymous/authorized access to the folders?
Like say I want to make a bunch of files available as read-only to users without credentials (access key and secret key). How can I do it?
| Bucket policies provided by Minio client side are an abstracted version of the same bucket policies AWS S3 provides.
Client constructs a policy JSON based on the input string of bucket and prefix.
ReadOnly means - anonymous download access is allowed includes being
able to list objects on the desired prefix
WriteOnly... | MinIO | 42,616,518 | 27 |
I'm new to minio and I want to use it in a Django app, I read the documentation of minio python library and there is fields for MINIO_ENDPOINT, MINIO_ACCESS_KEY, MINIO_SECRET_KEY. I read the Quickstart documentation of minio but I didn't figure out how to find these parameters.
| If you use docker:
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
Note that these two equivalent variables are now deprecated:
MINIO_ACCESS_KEY[=MINIO_ROOT_USER]
MINIO_SECRET_KEY[=MINIO_ROOT_PASSWORD]
| MinIO | 67,285,745 | 24 |
I have installed minio in docker. It installed successfully and below are logs of the minio server:
I think all is well but when I invoke localhost:9000 url in browser it redirects to localhost:40793 with error message site can't be reached.
I don't know the issue. Can anyone help ? Thanks in advance.
| Addressing the warning about the dynamic port worked for me. I think the issue is that minio serves the API on port 9000, but tries to redirect you to the console when that address visited in the browser (e.g. localhost:9000). The console is on a dynamic port that isn't exposed by docker.
Instead, we can specify the co... | MinIO | 68,317,358 | 20 |
I am running a Minio server using its docker image.
docker run -p 9000:9000 --name minio1 \
-e "MINIO_ACCESS_KEY=user" \
-e "MINIO_SECRET_KEY=pass" \
-v /home/me/data:/data \
minio/minio server /data
I have a couple of folders with files in the mount point. How do I make them available in Minio, do I need to u... | For what its worth, it appears you have to use the minio command line client to accomplish this: the maintainers explicitly declined to add an option to do this internal to Minio (see https://github.com/minio/minio/issues/4769). The easiest option I'd see is basically do something like this:
docker run -p 9000:9000 --n... | MinIO | 55,496,594 | 14 |
If we want to copy a bucket to another MiniO cluster, should we use "mc cp" or "mc mirror"? I have done some simple experiments and it seems that they are the same.
Thank~!
| Short answer
Yes, mc cp --recursive SOURCE TARGET and mc mirror --overwrite SOURCE TARGET will have the same effect (to the best of my experience as of 2022-01).
mc cp allows for fine-tuned options for single files (but can bulk copy using --recursive)
mc mirror is focussed on bulk copying and can create buckets
Look... | MinIO | 59,558,166 | 13 |
I have Minio server hosted locally.
I need to read file from minio s3 bucket using pandas using S3 URL like "s3://dataset/wine-quality.csv" in Jupyter notebook.
I tried using s3 boto3 library am able to download file.
import boto3
s3 = boto3.resource('s3',
endpoint_url='localhost:9000',
... | Pandas v1.2 onwards allows you to pass storage options which gets passed down to fsspec, see the docs here: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html?highlight=s3fs#reading-writing-remote-files.
To pass in a custom url, you need to specify it through client_kwargs in storage_options:
df = pd.read_... | MinIO | 67,093,837 | 10 |
I am trying to redirect a example.com/minio location to minio console, which is run behind a nginx proxy both run by a docker compose file. My problem is that, when I'm trying to reverse proxy the minio endpoint to a path, like /minio it does not work, but when I run the minio reverse proxy on root path in the nginx re... | minio doesn't work under non default path like location /minio
You need to use
location / {
....
proxy_pass http://localhost:9001;
}
or add another server block to nginx with subdomain like this
server{
listen 80;
server_name minio.example.com;;
location / {
proxy_set_header X-Real-IP $remote_addr;
... | MinIO | 72,020,904 | 10 |
I would like to know if there is a difference between gVisor and Weave Ignite in terms of their use-cases (if there is any). To me, both of them seem to try a similar thing: make the execution of code in virtualized environments more secure.
gVisor is doing this by introducing runsc, a runtime that enables sandboxed c... | Both Firecracker and gVisor are technologies which provide sandboxing / isolation but in a different way.
Firecracker (orange box) is a Virtual Machine Manager.
gVisor (green box) has an architecture which controls/filters the system calls that reach the actual host.
Weave Ignite is a tool that helps you use Firecrac... | Firecracker | 56,996,602 | 14 |
I'd like to comprehensively understand the run-time performance cost of a Docker container. I've found references to networking anecdotally being ~100µs slower.
I've also found references to the run-time cost being "negligible" and "close to zero" but I'd like to know more precisely what those costs are. Ideally I'd li... | An excellent 2014 IBM research paper “An Updated Performance Comparison of Virtual Machines and Linux Containers” by Felter et al. provides a comparison between bare metal, KVM, and Docker containers. The general result is: Docker is nearly identical to native performance and faster than KVM in every category.
The exce... | containerd | 21,889,053 | 783 |
Am exploring on how to use containerd in place of dockerd. This is for learning only and as a cli tool rather than with any pipelines or automation.
So far, documentation in regards to using containerd in cli (via ctr) is very limited. Even the official docs are using Go lang to utilize containerd directly.
What I have... | The ctr run command creates a container and executes it
ctr run <imageName> <uniqueValue>
e.g., ctr run --rm docker.io/library/hello-java-app:latest mypod
This executes my basic docker java image with a print statement:
~~~~
HelloWorld from Java Application running in Docker.
~~~~
Steps followed:
1 - A java file:
p... | containerd | 59,393,496 | 23 |
Kubernetes documentation describes pod as a wrapper around one or more containers. containers running inside of a pod share a set of namespaces (e.g. network) which makes me think namespaces are nested (I kind doubt that). What is the wrapper here from container runtime's perspective?
Since containers are just processe... | The main difference is networking, the network namespace is shared by all containers in the same Pod. Optionally, the process (pid) namespace can also be shared. That means containers in the same Pod all see the same localhost network (which is otherwise hidden from everything else, like normal for localhost) and optio... | containerd | 67,966,607 | 13 |
I have read many links similar to my issue, but none of them were helping me to resolve the issue.
Similar Links:
Failed to exec into the container due to permission issue after executing 'systemctl daemon-reload'
OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not p... | This issue may relate to docker, first drain your node.
kubectl drain <node-name>
Second, SSH to the node and restart docker service.
systemctl restart docker.service
At the end try to execute your command.
| containerd | 73,434,226 | 10 |
As I understand,
Kata Containers
Kata Container build a standard implementation of lightweight Virtual Machines (VMs) that feel and perform like containers but provide the workload isolation and security advantages of VMs
On the other hand, gvisor
gVisor is a user-space kernel for containers. It limits the host kern... | From what I gather:
Kata Containers
Full Kernel on top of a lightweight QEMU/KVM VM
Kernel has been optimized in newer releases.
Lets system calls go through freely
Performance penalty due to the VM layer. Not clear yet how slower or faster than gVisor
On paper, slower startup time.
Can run any application.
Can run... | gVisor | 50,143,367 | 25 |
Questions
How does lxd provide Full operating system functionality within containers, not just single processes?
How is it different from lxc/docker + wrappers?
Is it similar to a container that is launched with docker + supervisor/wrapper script to contain multiple processes in one container?
In other words:
Wha... |
How does lxd provide Full operating system functionality within containers, not just single processes?
Containers are Isolated Linux systems using the cgroups capabilities for limit cpu/memory/network/etc in the Linux kernel, without the need for starting a full virtual machine.
LXD uses the capabilities provided by... | lxd | 30,430,526 | 25 |
I am setting up LXD to play around with conjure-up. I would like to the storage to be mounted only on my RAID device, so it would be good to remove the default storage or replace/redirect it.
I cannot remove the default storage because the default profile uses it.
How can I use the RAID storage with conjure-up and be s... | The default storage cannot be deleted because it is part of the default profile. The default profile cannot be removed. So the way around this is to push a blank profile to the default profile with;
printf 'config: {}\ndevices: {}' | lxc profile edit default
Then the default storage will be removed from the default pr... | lxd | 42,678,979 | 12 |
I want to enable a Fedora Copr repository with Ansible. More specifically I want to convert this command:
dnf copr enable ganto/lxd
Using an Ansible command module I overcome this problem but break the task's idempotence (if run again, the role should not make any changes) (changed_when: false is not an option).
- nam... | You can use creates to make your command idempotent; if the .repo file already exists then the task won't run:
- name: Enable Fedora Copr for LXD
command:
cmd: dnf copr enable -y ganto/lxd
creates: /etc/yum.repos.d/_copr_ganto-lxd.repo
(You'd have to check that enabled=1 manually)
$ cat /etc/yum.repos.d/... | lxd | 42,651,026 | 10 |
How do these two compare?
As far as I understand, runc is a runtime environment for containers. That means that this component provides the necessary environment to run containers. What is the role of containerd then?
If it does the rest (networking, volume management, etc) then what is the role of the Docker Engine? A... | I will give a high level overview to get you started:
containerd is a container runtime which can manage a complete container lifecycle - from image transfer/storage to container execution, supervision and networking.
container-shim handle headless containers, meaning once runc initializes the containers, it exits han... | runc | 41,645,665 | 82 |
I'm trying to understand the Docker world a little better, and can't quite seem to wrap my brain around the differences between these. I believe that OCF is an emerging container standard being endorsed by OpenContainers, and I believe that Docker is set to be the first reference implementation of that standard. But ev... | The Open Container Format (OCF) specification is a written document (or set of documents) defining what a "standard container" is, in terms of filesystem, available operations and execution environment. The document seems to be backed up with Go code. This specification is currently (July 2015) a work-in-progress.
Runc... | runc | 31,213,126 | 17 |
I have read many links similar to my issue, but none of them were helping me to resolve the issue.
Similar Links:
Failed to exec into the container due to permission issue after executing 'systemctl daemon-reload'
OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not p... | This issue may relate to docker, first drain your node.
kubectl drain <node-name>
Second, SSH to the node and restart docker service.
systemctl restart docker.service
At the end try to execute your command.
| runc | 73,434,226 | 10 |
Is there way to specify a custom NodePort port in a kubernetes service YAML definition?
I need to be able to define the port explicitly in my configuration file.
| You can set the type NodePort in your Service Deployment. Note that there is a Node Port Range configured for your API server with the option --service-node-port-range (by default 30000-32767). You can also specify a port in that range specifically by setting the nodePort attribute under the Port object, or the system ... | Flannel | 43,935,502 | 37 |
Issue Redis POD creation on k8s(v1.10) cluster and POD creation stuck at "ContainerCreating"
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 30m de... | Ensure that /etc/cni/net.d and its /opt/cni/bin friend both exist and are correctly populated with the CNI configuration files and binaries on all Nodes. For flannel specifically, one might make use of the flannel cni repo
| Flannel | 51,169,728 | 34 |
First I start Kubernetes using Flannel with 10.244.0.0.
Then I reset all and restart with 10.84.0.0.
However, the interface flannel.1 still is 10.244.1.0
That's how I clean up:
kubeadm reset
systemctl stop kubelet
systemctl stop docker
rm -rf /var/lib/cni/
rm -rf /var/lib/kubelet/*
rm -rf /run/flannel
rm -rf /etc/cni/
... | Because your ip link have the old record
look by
ip link
you can see the record, and if you want to clean the record of old flannel and cni
please try
ip link delete cni0
ip link delete flannel.1
| Flannel | 46,276,796 | 17 |
Is there a way to define in which interface Flannel should be listening? According to his documentation adding FLANNEL_OPTIONS="--iface=enp0s8" in /etc/sysconfig/flanneld should work, but it isn't.
My master node configuration is running in a xenial(ubuntu 16.04) vagrant:
$ sudo kubeadm init --pod-network-cidr 10.244.... | I've the same problem, trying to use k8s and Vagrant.
I've found this note in the documentation of flannel:
Vagrant typically assigns two interfaces to all VMs. The first, for
which all hosts are assigned the IP address 10.0.2.15, is for external
traffic that gets NATed.
This may lead to problems with flannel. By ... | Flannel | 47,845,739 | 16 |
I used kubeadm to initialize my K8 master. However, I missed the --pod-network-cidr=10.244.0.0/16 flag to be used with flannel. Is there a way (or a config file) I can modify to reflect this subnet without carrying out the re-init process again?
| Override PodCIDR parameter on the all k8s Node resource with a IP source range 10.244.0.0/16
$ kubectl edit nodes nodename
Replace "Network" field under net-conf.json header in the relevant Flannel ConfigMap with a new network IP range:
$ kubectl edit cm kube-flannel-cfg -n kube-system
net-conf.json: | { "Network": "1... | Flannel | 60,940,447 | 16 |
To install kubernetes using flannel, one initially needs to run:
kubeadm init --pod-network-cidr 10.244.0.0/16
Questions are:
What is the purpose of "pod-network-cidr"?
What's the meaning of such IP "10.244.0.0/16"?
How flannel uses this afterwards?
| pod-network-cidr is the virtual network that pods will use. That is, any created pod will get an IP inside that range.
The reason of setting this parameter in flannel is because of the following: https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml
Let us take a look at the configuration:
net... | Flannel | 48,984,659 | 15 |
Overview
kube-dns can't start (SetupNetworkError) after kubeadm init and network setup:
Error syncing pod, skipping: failed to "SetupNetwork" for
"kube-dns-654381707-w4mpg_kube-system" with SetupNetworkError:
"Failed to setup network for pod
\"kube-dns-654381707-w4mpg_kube-system(8ffe3172-a739-11e6-871f-000c2912631c... | It looks like you have configured flannel before running kubeadm init. You can try to fix this by removing flannel (it may be sufficient to remove config file rm -f /etc/cni/net.d/*flannel*), but it's best to start fresh.
| Flannel | 40,534,837 | 12 |
I have a problem trying exec'ing into a container:
kubectl exec -it busybox-68654f944b-hj672 -- nslookup kubernetes
Error from server: error dialing backend: dial tcp: lookup worker2 on 127.0.0.53:53: server misbehaving
Or getting logs from a container:
kubectl -n kube-system logs kube-dns-598d7bf7d4-p99qr kubedns
Err... |
I have a problem trying exec'ing into a container
As you see, Kubernetes is trying to connect to your nodes use the names like worker1, which cannot be resolved in your network.
You have 2 ways to fix it:
Use real FQDN for all your nodes which can be resolved. Usually, VMs in clouds have resolvable DNS names, but it... | Flannel | 50,468,354 | 12 |
i have been trying to setup k8s in a single node,everything was installed fine. but when i check the status of my kube-system pods,
CNI -> flannel pod has crashed, reason -> Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: x.x.x.x x.x.x.x x.x.x.x
CoreDNS pods status... | In short, you have too many entries in /etc/resolv.conf.
This is a known issue:
Some Linux distributions (e.g. Ubuntu), use a local DNS resolver by default (systemd-resolved). Systemd-resolved moves and replaces /etc/resolv.conf with a stub file that can cause a fatal forwarding loop when resolving names in upstream s... | Flannel | 59,890,834 | 11 |
i update my system by:
$ apt-get upgrade
then bad things happened, when i reboot the system, i had it get a timeout about network connection.
i am pretty sure that, my network connection is fine (it unchanged during update), i can get ip allocated (both ethernet and wlan)
i have consulted google:
# anyway, i was told ... | i have solved this problem
netplan apply says ovsdb-server.service is not running, then i just install this openvswitch
since i run ubuntu server in raspberry pi, i need to install extra lib:
# run this first
$ sudo apt-get install linux-modules-extra-raspi
# run this then
$ sudo apt-get install openvswitch-switch-dpdk... | Open vSwitch | 77,352,932 | 17 |
My terraform remote states and lockers are configured on s3 and dynamodb under aws account, On gitlab runner some plan task has been crashed and on the next execution plan the following error pops up:
Error: Error locking state: Error acquiring the state lock: ConditionalCheckFailedException:
The conditional request fa... | According to reference of terraform command: force-unlock
Manually unlock the state for the defined configuration.
This will not modify your infrastructure. This command removes the
lock on the state for the current configuration. The behavior of this
lock is dependent on the backend being used. Local state files cann... | Terraform | 71,940,888 | 12 |
I'm trying to set up Terrafom validation on Gitlab CI.
However a build fails with an error: "Terraform has no command named "sh". Did you mean "show"?"
Why does it happen? How could it be fixed?
My .gitlab-ci.yml
image: hashicorp/terraform:light
before_script:
- terraform init
validate:
script:
- terraform va... | You need to override the entrypoint in the terraform image so you have access to the shell.
image:
name: hashicorp/terraform:light
entrypoint: [""]
before_script:
- terraform init
validate:
script:
- terraform validate
You can also take a look at the official gitlab documentation how to integrate terraf... | Terraform | 67,115,574 | 12 |
Running Terraform v0.11.3 and I am trying to merge two maps into a single map using the merge() function. However I can't get the syntax right. Does merge() support using dynamic variables?
tags = "${merge({
Name = "${var.name}"
Env = "${var.environment}"
AutoSnapshot = "${var.auto_snapsh... | In Terraform > 0.12 this can be done as:
tags = merge(tomap({
Name = var.name,
Env = var.environment,
AutoSnapshot = var.auto_snapshot }),
var.tags,
)
| Terraform | 66,180,680 | 12 |
terraform {
backend "s3" {
bucket = "mybucket"
key = "path/to/my/key"
region = "us-east-1"
}
}
Is it not possible to provide values for bucket and key above through variables file?
Because when I try doing the same like this:
terraform {
backend "s3" {
bucket = var.bucket
key = var.key
... | Create a file named backend.tfvars with content:
bucket = "mybucket"
key = "path/to/my/key"
Specify this file name in a command line option to the terraform init command:
terraform init -backend-config=backend.tfvars
You need a separate backend config file instead of your usual tfvars file because these values are... | Terraform | 66,139,798 | 12 |
I'm creating a series of s3 buckets with this definition:
resource "aws_s3_bucket" "map" {
for_each = local.bucket_settings
bucket = each.key
...
}
I'd like to output a list of the website endpoints:
output "website_endpoints" {
# value = aws_s3_bucket.map["example.com"].website_endpoint
value = ["${keys(... | If you just want to get a list of website_endpoint, then you can do:
output "website_endpoints" {
value = values(aws_s3_bucket.map)[*].website_endpoint
}
This uses splat expression.
| Terraform | 65,840,607 | 12 |
I'm trying to create elasticsearch cluster using terraform, But i'm getting this error
11:58:07 * aws_cloudwatch_log_resource_policy.elasticsearch-log-publishing-policy: Writing CloudWatch log resource policy failed: LimitExceededException: Resource limit exceeded.
11:58:07 * aws_elasticsearch_domain.es2: 1 error(s) oc... |
does AWS have a limit on number of custom policies we create, I could not find an option to request an increase.
Yes, the limit can't be change and it is:
Up to 10 CloudWatch Logs resource policies per Region per account. This quota can't be changed.
| Terraform | 65,615,449 | 12 |
How do you parse a map variable to a string in a resource value with Terraform12?
I have this variable:
variable "tags" {
type = map
default = {
deployment_tool = "Terraform"
code = "123"
}
}
And want this: {deployment_tool=Terraform, code=123}
I've tried the following witho... | Replacing ":" with "=" is not a perfect solution, just consider a map with such a value: https://example.com - it becomes https=//example.com. That's not good.
So here is my solution:
environment_variables = join(",", [for key, value in var.environment_variables : "${key}=${value}"])
| Terraform | 64,134,699 | 12 |
I am trying to create IAM binding for Bigquery dataset using the resource - google_bigquery_dataset_iam_binding. The requirement is I read the parameters in this resource (dataset_id, role, members) using a variable of the following structure -
bq_iam_role_bindings = {
"member1" = {
"dataset1" : ["role1","r... | You could re-organize it into more for_each friendly list of objects and store it in a local helper_list.
For example:
variable "bq_iam_role_bindings" {
default = {
"member1" = {
"dataset1" : ["role1","role2", "role5"],
"dataset2" : ["role3","role2"],
},
"member2" = {
"dataset3" : ["rol... | Terraform | 63,500,554 | 12 |
Terraform version: 0.11
I am running multiple eks clusters and trying to enable IAM Roles-based service account in all cluster following this doc:
https://www.terraform.io/docs/providers/aws/r/eks_cluster.html#enabling-iam-roles-for-service-accounts
This works when I hardcode the cluster name in the policy statement an... | You only want one policy, so you should not use the count argument in your policy.
What you want to have instead is multiple statements, like this
data "aws_iam_policy_document" "example" {
statement {
# ...
}
statement {
# ...
}
}
Now you could hard-code this directly (maybe that would be a good start... | Terraform | 62,184,180 | 12 |
In my Terraform AWS Docker Swarm module I use cloud-init to initialize the EC2 instance. However, Terraform says the resource is ready before cloud-init finishes. Is there a way of making it wait for cloud-init to finish, ideally without SSHing or checking for a port to be up using a null resource?
| Your managers and workers both use template_cloudinit_config. They also have ec2:CreateTags.
You can use an EC2 resource tag like trajano/terraform-docker-swarm-aws/cloudinit-complete to indicate that the cloudinit has finished.
You could add this final part to each to invoke a tagging script:
part {
filename =... | Terraform | 62,116,684 | 12 |
Does anyone know if it is possible to have a Terraform script that uses multiple provider versions?
For example azurerm version 2.0.0 to create one resource, and 1.4.0 for another?
I tried specifying the providers, as documented here: https://www.terraform.io/docs/configuration/providers.html
However it doesn't seem to... | How to use multiple version of the same Terraform provider
This allowed us a smooth transition from helm2 to helm3, while enabling new deployments to use helm3 right away, therefore reducing the accumulation of tech debt.
Of course you can do the same for most providers
How we've solved this
So the idea is to download ... | Terraform | 61,774,501 | 12 |
I've been trying to setup a terraform module to create private cluster, and I'm struggling with a strange situation.
When creating a cluster with a master authorized network, if I do it through the GCP console, I can create the private cluster just fine. But when I do it with Terraform, I get a strange error:
Invali... | According to Google Cloud Platform documentation here, it should be possible to have both private and public endpoints, and the master_authorized_networks_config argument should have networks which can reach either of those endpoints.
If setting the enable_private_endpoint argument to false means that the private endpo... | Terraform | 57,548,376 | 12 |
I want to set up a Terraform module that assigns a policy to an Azure resource according to Terraforms policy assignment example.
In order to assign the allowed locations policy, I want to pass the list of allowed locations as a list of strings from the variables.tf file to the main.tf, where the assignment is execute... | When you are interpolating a value into a string that value must itself be convertible to string, or else Terraform cannot join the parts together to produce a single string result.
There are a few different alternatives here, with different tradeoffs.
The option I personally would choose here is to not use the <<PARA... | Terraform | 57,218,755 | 12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.