I have an SpringBoot app. 2.1.3.RELEASE securized by JWT, I want to add an actuator. I added this dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
I have added this properties to the application.properties file
management.endpoints.web.exposure.include=health,info
management.endpoint.health.show-details=always
when I access to /actuator I got this response:
{
"_links": {
"self": {
"href": "http://127.0.0.1:1133/tdk/actuator",
"templated": false
},
"health": {
"href": "http://127.0.0.1:1133/tdk/actuator/health",
"templated": false
},
"health-component": {
"href": "http://127.0.0.1:1133/tdk/actuator/health/{component}",
"templated": true
},
"health-component-instance": {
"href": "http://127.0.0.1:1133/tdk/actuator/health/{component}/{instance}",
"templated": true
},
"info": {
"href": "http://127.0.0.1:1133/tdk/actuator/info",
"templated": false
}
}
}
but when I access to http://127.0.0.1:1133/tdk/actuator/info , I got only
{}
You need to add build-info goal to generate build information. see doc here for more info.
Related
In my react project the code quality checker CodeClimate, using advanced configuration just stop some silly code quality factors/thresholds like 50 line of code, :
Function `AutocompleteCombobox` has 50 lines of code (exceeds 25 allowed). Consider refactoring.
what I did I create .codeclimate.yml besides my package.json and upload that to the repo (connected with CodeClimate on branch DEV), following documentation.
this is the example of the .yml file:
version: "2" # required to adjust maintainability checks
checks:
argument-count:
enabled: true
config:
threshold: 4
complex-logic:
enabled: true
config:
threshold: 4
The Question is: CodeClimate doesn’t changes the records and metrics based on my configuration file!! I CHANGED THE RECORDS via .yml file; but still not updated on CodeClimate website ?!! the metrics are same as default.
*** TIP: Nothing to do from CodeClimate website settings we stop every condition, nothing apply except default! and I don’t want to delete and re-add the repo's because I'ill lose my tracking records in enhancement.
The problem is simple, the server make file called .codeclimate.json because I edit the configurations via the website, but in my repo I made I file called .codeclimate.yml, when I convert the configuration from .yml to .json I override the one on the server that works perfectly.
Example for may configuration .codeclimate.json:
{
"version": "2",
"checks": {
"argument-count": {
"enabled": false,
"config": {
"threshold": 4
}
},
"complex-logic": {
"enabled": true,
"config": {
"threshold": 15
}
},
"file-lines": {
"enabled": false,
"config": {
"threshold": 250
}
},
"method-complexity": {
"enabled": true,
"config": {
"threshold": 15
}
},
"method-count": {
"enabled": false,
"config": {
"threshold": 20
}
},
"method-lines": {
"enabled": false,
"config": {
"threshold": 25
}
},
"nested-control-flow": {
"enabled": true,
"config": {
"threshold": 4
}
},
"return-statements": {
"enabled": true,
"config": {
"threshold": 4
}
},
"similar-code": {
"enabled": false,
"config": {
"threshold": null
}
},
"identical-code": {
"enabled": true,
"config": {
"threshold": null
}
}
},
"exclude_patterns": [
"config/",
"db/",
"dist/",
"features/",
"**/node_modules/",
"script/",
"**/spec/",
"**/test/",
"**/tests/",
"Tests/",
"**/vendor/",
"**/*_test.go",
"**/*.d.ts"
]
}
If you face the same issue probably the configuration is duplicated on CodeClimate, you need to use one file only.
How can we do to set up the consul use a previous certificate created for the tomcat?
We only have server.jks file used in tomcat, and we need to use the same tomcat certification.
How can we do to extract this information below?
"ca_file": "cert/ca.pem",
"cert_file": "cert/server.pem",
"key_file": /cert/serverkey.pem",
The server.conf
{
"bootstrap": true,
"server": true,
"datacenter": "dc1",
"data_dir": "data",
"verify_incoming": true,
"verify_outgoing": true,
"verify_server_hostname": true,
"auto_encrypt": {
"allow_tls": true
},
"log_level": "INFO",
"enable_agent_tls_for_checks": true,
"enable_syslog": false,
"ui_config": {
"enabled": true
},
"ports": {
"http": -1,
"https": 8500
}
}
Calling GET /actuator/logfile returns 404 error.
How can i get log via actuator/logfile?
$ curl -XGET localhost:8001/actuator/logfile -i
HTTP/1.1 404
Content-Length: 0
Date: Tue, 22 Sep 2020 08:43:44 GMT
I have the configuration below.
I launched the application with 'local' profile.
I have log file in log folder( ex. api_log.2020-09-22-0.log ).
application.yml
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: always
logging:
file:
path: log
logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="log/console.xml"/>
<include resource="log/file.xml"/>
<root level="info">
<springProfile name="dev">
<appender-ref ref="dailyRollingFileAppender"/>
</springProfile>
<springProfile name="local">
<appender-ref ref="dailyRollingFileAppender"/>
</springProfile>
</root>
</configuration>
log/file.xml
<?xml version="1.0" encoding="UTF-8"?>
<appender name="dailyRollingFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/api_log.%d{yyyy-MM-dd}-%i.log</fileNamePattern>
<maxHistory>10</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
/actuator/logfile endpoint enables.
curl -XGET localhost:8001/actuator
{
"_links": {
"self": {
"href": "http://localhost:8001/actuator",
"templated": false
},
"beans": {
"href": "http://localhost:8001/actuator/beans",
"templated": false
},
"caches": {
"href": "http://localhost:8001/actuator/caches",
"templated": false
},
"caches-cache": {
"href": "http://localhost:8001/actuator/caches/{cache}",
"templated": true
},
"health-path": {
"href": "http://localhost:8001/actuator/health/{*path}",
"templated": true
},
"health": {
"href": "http://localhost:8001/actuator/health",
"templated": false
},
"info": {
"href": "http://localhost:8001/actuator/info",
"templated": false
},
"conditions": {
"href": "http://localhost:8001/actuator/conditions",
"templated": false
},
"configprops": {
"href": "http://localhost:8001/actuator/configprops",
"templated": false
},
"env-toMatch": {
"href": "http://localhost:8001/actuator/env/{toMatch}",
"templated": true
},
"env": {
"href": "http://localhost:8001/actuator/env",
"templated": false
},
"logfile": {
"href": "http://localhost:8001/actuator/logfile",
"templated": false
},
"loggers-name": {
"href": "http://localhost:8001/actuator/loggers/{name}",
"templated": true
},
"loggers": {
"href": "http://localhost:8001/actuator/loggers",
"templated": false
},
"heapdump": {
"href": "http://localhost:8001/actuator/heapdump",
"templated": false
},
"threaddump": {
"href": "http://localhost:8001/actuator/threaddump",
"templated": false
},
"metrics": {
"href": "http://localhost:8001/actuator/metrics",
"templated": false
},
"metrics-requiredMetricName": {
"href": "http://localhost:8001/actuator/metrics/{requiredMetricName}",
"templated": true
},
"scheduledtasks": {
"href": "http://localhost:8001/actuator/scheduledtasks",
"templated": false
},
"mappings": {
"href": "http://localhost:8001/actuator/mappings",
"templated": false
}
}
}
Update application.yml
logging:
file:
path: log
to
logging:
path: log
I created a module with Laravel Module and I want to install a package in a this module. The package was installed in a module's vendor but the problem is that its class is not defined somewhere else in the project.
Here is my composer.json :
{
"name": "nwidart/audit",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart#gmail.com"
}
],
"extra": {
"laravel": {
"providers": [
"Modules\\Audit\\Providers\\AuditServiceProvider"
],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Audit\\": "Modules/Audit/"
}
},
"require": {
"owen-it/laravel-auditing": "^9.2",
}
}
You cannot use the package inside a module. You should use "composer merge plugin" for this problem or add it to the root of the project.
i use this package for merge composer.json files
https://github.com/wikimedia/composer-merge-plugin
just note :
{
"require": {
"wikimedia/composer-merge-plugin": "dev-master"
},
"extra": {
"merge-plugin": {
"include": [
"composer.local.json",
"Modules/*/composer.json"
],
"require": [
"Modules/Audit/composer.json"
],
"recurse": true,
"replace": false,
"ignore-duplicates": false,
"merge-dev": true,
"merge-extra": false,
"merge-extra-deep": false,
"merge-scripts": false
}
},
I have a Django app, which uses a postgres database hosted on heroku. I'm trying to create a review app based on this Django app. However, I can't seem to access my DB on the review app. I've added a postdeploy script as shown in the app.json below but it doesn't seem to solve it:
{
"name": "bookapp",
"scripts": {
"postdeploy": "pg_dump $DATABASE_URL | psql $DATABASE_URL && python
./manage.py migrate"
},
"env": {
"DATABASE_URL": {
"required": true
},
"QV_CLOUDINARY_API_KEY": {
"required": true
},
"QV_CLOUDINARY_API_SECRET": {
"required": true
},
"QV_CLOUDINARY_CLOUD_NAME": {
"required": true
},
"QV_DATABASE_NAME": {
"required": true
},
"QV_DATABASE_PASSWORD": {
"required": true
},
"QV_DATABASE_USER": {
"required": true
},
"QV_SECRET_KEY": {
"required": true
}
},
"formation": {
"web": {
"quantity": 1
}
},
"addons": [
"heroku-postgresql"
],
"buildpacks": [
{
"url": "heroku/python"
}
]
}
Found the solution!.
The app.json file above is correct. Apparently the post-deploy script only runs the first time the app is created. I had to close the Pull Request for the review app and re-open a new one so that a new review app is created. Doing that executed the post-deploy script and i was able to access my DB.