today I implemented a multilanguage-feature for my project and it works just great. But just the point I was trying to login again. Everytime I want to login this is the error:
No route found for "GET /login_check/" (from "http://localhost:8000/de/")
I googled a lot but found little.
My routing.yml:
project:
resource: "#AeTmProjectBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
cms:
resource: "#AeTmCMSBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
donation:
resource: "#AeTmDonationBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
homepage:
resource: "#AeTmHomepageBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
mailer:
resource: "#AeTmMailerBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
user:
resource: "#AeTmUserBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
sponsor:
resource: "#AeTmSponsorBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
statistics:
resource: "#AeTmStatisticsBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
fos_user:
resource: "#FOSUserBundle/Resources/config/routing/all.xml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
fos_js_routing:
resource: "#FOSJsRoutingBundle/Resources/config/routing/routing.xml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
BladeTesterCalendarBundle:
resource: "#BladeTesterCalendarBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: '%app.locales%'
My security.yml firewall:
firewalls:
main:
pattern: ^/
form_login:
#provider: fos_userbundle
#csrf_token_generator: security.csrf.token_manager
success_handler: redirect.after.login
remember_me:
secret: '%secret%'
lifetime: 604800 # 1 week in seconds
always_remember_me: true
logout: true
anonymous: true
switch_user: { role: ROLE_ADMIN }
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
And my config.yml framework:
framework:
#esi: ~
translator: { fallback: de }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: false }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
fragments: ~
http_method_override: true
assets: ~
Parameters.yml:
locale: de
app.locales: "|de|en"
locale_supported:
en_EN: en
de_DE: de
If anyone has an idea, I would be very thankfull!
I think you have add a prefix to FosUserBundle routes in your routing.yml. Maybe this is the problem. Try to change the check path of your form login in your firewall.
Related
NOT WORKING SCENARIO:
I am trying to deploy spring-boot application in EKS cluster.
spring-config-server helps to load myapplication(project) properties from repository
myapplication-dev.yml (From repository)
spring:
config:
import: optional:configtree:/usr/src/apps/secrets/database/postgresql/ # not effective while loading into application by configserver
datasource:
url: jdbc:postgresql://{xxxxxxxxxxxxxx}:{5444}/postgres
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
hikari:
schema: mydbschema
spring-config-server is up and running!
When i am trying to deploy myapplication with deployment.yaml file in EKS then configtree:/usr/src/apps/secrets/database/postgresql/ property not showing any effect in order to set env props.
deployment.yaml
volumes:
- name: tmpfs-1
emptyDir: {}
- name: secret-volume-postgresql
secret:
secretName: db_secrets
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "--server.port=8080"
- {{ default "dev" .Values.applicationActiveProfiles }}
env:
- name: ACTIVE_PROFILES
value: {{ .Values.applicationActiveProfiles }}
- name: DB_USERNAME
value: {{ .Values.db.userName }}
- name: NAME_SPACE
value: {{ default "dev" .Values.selectedNamespace }}
ports:
- name: http
containerPort: {{ .Values.containerPort }}
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /actuator/health/readiness
port: http
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
livenessProbe:
failureThreshold: 3
httpGet:
path: /actuator/health/liveness
port: http
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
volumeMounts:
- name: secret-volume-postgresql
mountPath: /usr/src/apps/secrets/database/postgresql
- name: tmpfs-1
mountPath: /tmp
myapplication(project)
application.yml
---
spring:
application:
name: myapplication
config:
import: optional:configserver:http://config-server.dev.svc:8080/
cloud:
config:
label: develop
profiles:
active:
- dev
Working scenario:
With one additional change in deployment.yaml file, that setting up spring.config.import as arg.
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "--server.port=8080"
- {{ default "dev" .Values.applicationActiveProfiles }}
# ******It's working after adding the below line******
- "--spring.config.import=optional:configtree:/usr/src/apps/secrets/database/postgresql/"
Question: Why it's not considering the property that i set in myapplication-dev.yml file ? What is missing here ?
I have a docker_container which I want to deploy for multiple users and name traefik routes after the users. But i'm confused on how I can achieve this.
Here is what I have:
- name: Run syncthing
docker_container:
name: "{{ item.name }}-syncthing"
image: "lscr.io/linuxserver/syncthing"
state: started
restart_policy: "always"
env:
PUID: "1000"
PGID: "1000"
volumes:
- "{{ item.data_dir }}:/data"
... other volumes
labels:
traefik.enable: true
"traefik.http.routers.{{ item.name }}-syncthing.entrypoints": websecure
"traefik.http.routers.{{ item.name }}-syncthing.rule": Host(`{{ item.name }}.{{ fqdn_real }}`)
"traefik.http.routers.{{ item.name }}-syncthing.tls": true
"traefik.http.routers.{{ item.name }}-syncthing.tls.certresolver": le
"traefik.http.routers.{{ item.name }}-syncthing.service": "{{ item.name }}-syncthing"
"traefik.http.routers.{{ item.name }}-syncthing.middlewares": "{{ item.name }}-basicauth"
"traefik.http.services.{{ item.name }}-syncthing.loadbalancer.server.port": 8080
"traefik.http.middlewares.{{ item.name }}-syncthing-basicauth.basicauth.users": "{{ item.auth }}"
with_items: "{{ syncthing_containers_info }}"
And a syncthing_config_info like this:
syncthing_containers_info:
- { name: "c1", data_dir: "/mnt/data/c1/data", auth: "..." }
- { name: "c2", data_dir: "/mnt/data/c2/data", auth: "..." }
- { name: "c3", data_dir: "/mnt/data/c3/data", auth: "..." }
That snippet doesn't work because ansible doesn't like the syntax so I have tried this with a with_nested but I faced a similar problem there with the nested loop issue while trying to set_fact as in the example since the set of labels depends on syncthing_containers_info. Is there a better way for me to do this?
It sounds like you need the labels: to be an actual dict since yaml keys are not subject to jinja2 interpolation
labels: >-
{%- set key_prefix = "traefik.http.routers." ~ item.name ~"-syncthing" -%}
{{ {
"traefik.enable": True,
key_prefix ~ ".entrypoints": "websecure",
key_prefix ~ ".rule": "Host(`" ~ item.name ~"."~ fqdn_real ~"`)",
key_prefix ~ ".tls": True,
key_prefix ~ ".tls.certresolver": "le",
key_prefix ~ ".service": item.name ~ "-syncthing",
key_prefix ~ ".middlewares": item.name ~ "-basicauth",
"traefik.http.services." ~ item.name ~ "-syncthing.loadbalancer.server.port": 8080,
"traefik.http.middlewares." ~ item.name ~"-syncthing-basicauth.basicauth.users": item.auth,
} }}
(be aware I didn't test that, just eyeballed it from your question, but that's the general idea)
I am using alertmanager for notification purpose and by default alaertmanager only have one webhook, As per my requirement one more webhook is required.
Before
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: {{ getsdcv "system" "group_wait" "10s"}}
group_interval: {{ getsdcv "system" "group_interval" "10s"}}
{{- $repeat_interval := getsdcv "system" "repeat_interval" "" }}
{{- if not (eq $repeat_interval "") }}
repeat_interval: {{ $repeat_interval }}
{{- end }}
receiver: 'web.hook'
receivers:
- name: 'web.hook'
webhook_configs:
- url: 'http://{{ getsdcv "system" "ip" "localhost"}}:{{ getsdcv "system" "port" "8005"}}/'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']
Expected output after adding new Webhook
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: {{ getsdcv "system" "group_wait" "10s"}}
group_interval: {{ getsdcv "system" "group_interval" "10s"}}
{{- $repeat_interval := getsdcv "system" "repeat_interval" "" }}
{{- if not (eq $repeat_interval "") }}
repeat_interval: {{ $repeat_interval }}
{{- end }}
receiver: 'web.hook'
routes:
- receiver: "web.hook"
continue: true
- receiver: "web.hook1"
match:
alertname: BusinessKpiDown
continue: true
receivers:
- name: 'web.hook'
webhook_configs:
- url: 'http://{{ getsdcv "system" "ip" "localhost"}}:{{ getsdcv "system" "port" "8005"}}/'
- name: 'web.hook1'
webhook_configs:
- url: 'http://0.0.0.0:8010/hooks/my-webhook'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']
I tried doing it through shell script but failed
awk -v RS='^$' '{$0=gensub(/(receivers:\s+users:)(\s+)/,"\\1\\2- name:
'web.hook2'\\2",1)}1'
I also tried with sed:
sed -i "/receivers:/a- name: 'webhook1'\n webhook_configs:\n - url:
''" config.yaml
I'm not allowed to use yq library due to restricted environment.
I get stuck and hope you can help me
I want to build file based on the following yml file with vars:
---
users:
- name: "user1"
db:
- name: "main"
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
schema:
- name: "public"
owner: no
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
- name: "notpublic"
owner: no
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
- name: "user2"
db:
- name: "main2"
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
schema:
- name: "public"
owner: no
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
- name: "nonpublic"
owner: no
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
How can I iterate through declared schema list in the Jinja template?
If I'm using the following construct
{% for user in users %}
{% for userdb in user.db %}
{% for s in userdb.schema %}
{{ s.name }}
{% endfor %}
{% endfor %}
{% endfor %}
I get the following error during the execution:
FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'schema'"}
The following playbook f.yml
---
- hosts: localhost
connection: local
gather_facts: False
vars:
users:
- name: "user1"
db:
- name: "main"
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
schema:
- name: "public"
owner: no
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
- name: "notpublic"
owner: no
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
- name: "user2"
db:
- name: "main2"
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
schema:
- name: "public"
owner: no
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
- name: "nonpublic"
owner: no
default_privileges:
tables: ['ALL']
sequences: ['ALL']
functions: ['EXECUTE']
types: ['USAGE']
tasks:
- name: templating
template:
src: "f.jj"
dest: "f.txt"
with this template f.jj
{% for user in users %}
{% for userdb in user.db %}
{% for s in userdb.schema %}
{{ s.name }}
{% endfor %}
{% endfor %}
{% endfor %}
produces with
$ ansible-playbook f.yml
PLAY [localhost] ***************************************************************
TASK [templating] **************************************************************
ok: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0
the output file f.txt
public
notpublic
public
nonpublic
I have a problem with vue router when I reload the page.
The link http://example.com/admin/home/page1
changes to this
http://example.com/admin/home/page1/page1 .
NB : this project is in laravel's public directory
vue version 3.9.2
os win 10 x64
router.js
const router = new Router({
mode: ‘history’,
base: process.env.VUE_APP_LINK,
routes: [
{
path: ‘/home’,
name: ‘home’,
component: Home,
children: [
{
path: ‘page1’,
name: ‘page1’,
component: () => import(’#/components/contents/page1.vue’),
},
{
path: ‘page2’,
name: ‘page2’,
component: () => import(’#/components/tools/page2.vue’),
},
{
path: ‘page3’,
name: ‘page3’,
component: () => import(’#/components/contents/page3.vue’),
},
{
path: ‘page4’,
name: ‘page4’,
component: () => import(’#/components/contents/page4.vue’),
}]},
{
path: ‘/login’,
name: ‘login’,
component: Login
},
{
path: '*',
redirect: '/home/page1'
}
]
})```
<li class="nav-item"><router-link to="page1" class="nav-link">page1</router-link></li>
<li class="nav-item"><router-link to="page2" class="nav-link">page2</router-link></li>
<li class="nav-item"><router-link to="page3" class="nav-link">page3</router-link></li>
<li class="nav-item"><router-link to="page4" class="nav-link">page4</router-link></li>
Try to use /page1 or /home/page1 instead of page1 in your path values.