Jhipster - Error while starting a jhipster mysql project - jhipster

I am trying jhipster and ran into the following error while starting the application which is configured to use mysql as the backend:
Your database connection pool configuration is incorrect! The applicationcannot start. Please check your Spring profile, current profiles are: [dev]
I have the database created and mysql is up and running at the right ports
From troubleshooting this in my IDE, it appears that the datasource properties are null while trying to configure liquibase.
My application-dev.yml
server:
port: 8080
spring:
profiles: dev
datasource:
dataSourceClassName: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
url: jdbc:mysql://localhost:3306/test
databaseName:test
serverName:localhost
username: admin
password: xxxxx
cachePrepStmts: true
prepStmtCacheSize: 250
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
jpa:
database-platform: org.hibernate.dialect.MySQLInnoDBDialect
database: MYSQL
openInView: false
show_sql: true
Any thoughts on what should I try next to get past this erorr?

I don't think you should write the database name in the url AND in the databaseName properties.
-> can you remove the databaseName configuration and see what happens?
Otherwise, please send the stacktrace.

If you're using Eclipse, it may be that the source folders configuration is wrong. When I imported the project, for some reason the src/main/resources and src/test/resources folders had all files excluded.
Check your build path and make sure all files are included.

Related

Connect to google cloud SQL postgres instance from node typeorm application

I'm getting this error when I try and connect caught error # main Error: connect ENOENT /cloudsql/<PROJECT ID>:us-central1:<DB NAME>/.s.PGSQL.5432
This is what my typeorm config file looks like
const config2 = {
database: <DB NAME>,
entities: Object.values(entities),
host: '/cloudsql/<project id>:us-central1:<db name>',
extra: {
socketPath: '/cloudsql/<project id>:us-central1:<db name>',
},
password: ...,
port: 5432,
type: process.env.POSTGRES_CONNECTION as DatabaseType,
username: ...,
synchronize: false,
dropSchema:
process.env.NODE_ENV !== 'production' &&
process.env.POSTGRES_DROP_SCHEMA === 'true',
migrations: ['dist/migrations/*.js'],
migrationsRun: true,
cache: shouldCache(),
} as PostgresConnectionOptions;
I also tried to connect via a connection URL in Postico 2 and I'm getting the error Hostname not found.
I have cloud SQL API enabled in my google project
Did you add your network? If not, postgres will not allow to connect.
Try to use 'Connections'.
To connect via Postico to your Google Cloud SQL instance, you'll need to tunnel over SSH on port 15432 using the downloadable cloud_sql_proxy executable.
https://cloud.google.com/sql/docs/mysql/sql-proxy
The user you're signed-in as in your terminal needs IAM permissions of:
Service Account Admin (or Service Account User may suffice)
If you aren't sure which user to give this IAM permissions to, run:
gcloud config get account
Once those permissions are confined, a command similar to this would establish the tunnel (note the & at the end, which is purposeful!)
./cloud_sql_proxy -instances=<CONNECTION_NAME>:<DB_NAME>=tcp:15432 &
The CONNECTION_NAME can be found inside your cloud console under SQL > 'Connect to this instance' section.
Now with the tunnel open, you should be able to connect inside of Postico.
To ensure your app can connect, you may just need to assign Cloud SQL Client IAM permission to your app in the same way you assigned service account permissions to your local user.
I hope this helps!

Not able to run windows scheduler from Azure Devops Pipeline. Getting error like The WinRM client cannot process the request

I got the below error:
[error]System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server MYSERVER01 failed with the following error message : The WinRM client cannot process the request.
If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts.
Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.
##[error]PowerShell script completed with 1 errors.
- task: StopWindowsScheduledTask#2
inputs:
ScheduledTaskFullName: 'TestService_Development'
ComputerNames: 'MYSERVER01'
Username: 'MYSERVER01\admin'
Password: 'xxxxxxx'
AuthenticationOptions: 'Default'
ProtocolOptions: 'HTTP'
I have looked for few solution https://www.hemalekanayake.com/2016/07/solved-winrm-client-cannot-process.html but not worked. https://learn.microsoft.com/en-us/microsoft-365/enterprise/urls-and-ip-address-ranges?view=o365-worldwide this also we used using 80, 443, 5986 port in proxy but not worked. Please help me in resolving this.
steps:
- task: WinRM - IIS Web App Management
displayName: 'Stop $(AppName) Application Pool on $(webserver)'
inputs:
machinesList: '$(webserver)'
AdminUserName: '$(username)'
AdminPassword: '$(password)'
ActionIISWebsite: StopWebsite
StartStopWebsiteName: 'UserAPI'

Jhipster Registry Release 3.2.4 - can't change admin password

I'm using registry release 3.2.4 on Windows environnement (dev).
I want to change the default admin password.
According the documentation I just need to define security.user.password on my application-*.yml file.
So my central-config/application-dev.yml become
jhipster:
security:
authentication:
jwt:
secret: my-secret-token-to-change-in-production
registry:
password: admin123
I start my registry java -jar jhipster-registry/jhipster-registry-3.2.4.war --spring.profiles.active=swagger,dev,native (the parameter --spring.profiles.activeis set here just to be sure my config file is correctly load).
I try to connect on http://127.0.0.1:8761/#/ with admin user...but my new password doesn't work (just the default "admin" password still work).
When the registry launch, i've got these warnings
WARN 1152 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
WARN 1152 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with key 'zuulEndpoint' has been registered as an MBean but has no exposed attributes or operations
And when i try to connect, this warning
WARN 1152 --- [ XNIO-2 task-1] o.s.c.n.zuul.web.ZuulHandlerMapping : No routes found from RouteLocator
When i look the config load on my application, it's look all right
My cloud configuration
I try to add -e JHIPSTER_SECURITY_AUTHENTICATION_JWT_SECRET=my-secret-token-to-change-in-production and -e SECURITY_USER_PASSWORD=admin123 when i launch my registry, but still don't work.
Any ideas?
Thanks
Password has to be set in 2 places; in the application.yml of the registry and in the registry clients (the services and gateways) in their own bootstrap.yml because properties in central-config are read only once the app has been able to connect to the registry.
You can also set it in an environment variable SECURITY_USER_PASSWORD and use placeholders in those files to avoid exposing it in your git repo while managing it in a single place.
I just had to cope with the same issue with JHipster Registry 4.1.1. As the documentation and the command line option stated to use spring.security.user.password property I've updated my application.yml as follow
jhipster:
security:
authentication:
jwt:
secret: my-secret-token-to-change-in-production
spring:
security:
user:
password: admin1234
It works as expected for me.

Running jhipster-registry in native profile: central-config folder not rode

I am currently trying to run jhipster-registry in dev profile to serve the configurations to a jhipster microservice application.
I've followed this official jhipster registry doc and:
have built it from sources, and launched it as follow:
./jhipster-registry-3.0.0.war --spring.profiles.active=dev
And as the doc states, i have put the central-config directory containing <mymicrosericeappname>-dev.yml alongside the jhipster-registry generated war file.
When i launch jhipster-registry, everything is ok,
but when i run my microservice application, it connects to the registry (i can see it in the jhipster-registry dashboard), but i realize that it is reading the application-dev.yml file located at src/main/resources/config/ inside the microservice app.
I dont know if i misplaced the central-config folder...
That said, i really need to know what's wrong.
Thanks
The config directory is specified in bootstrap.yml in search-locations property.
spring:
cloud:
config:
server:
native:
search-locations: file:./central-config
Rather than specifying a relative path (relative to where you launched the regsitry from), you may want to specify an absolute path:
search-locations: file:/home/something/central-config
Also rather than using dev profile, you can use prod with native :
./jhipster-registry-3.0.0.war --spring.profiles.active=prod,native
Thanks to #GaelMarziou, his answer helped me found why the central-config was not being rode.
In fact the Spring Cloud Config bootstrap configuration for the "dev" profile bootstrap.yml file gives this:
cloud:
config:
server:
git:
uri: https://github.com/jhipster/jhipster-registry-sample-config
native:
search-locations: file:./central-config
So each time i ran jhipster-registry, it was pointing the git repo and not the central-config directory.
To get it work, i had to launch the registry in dev,native profile :
./jhipster-registry-3.0.0.war --spring.profiles.active=dev,native
Nevertheless the documentation states this:
Using the dev profile will run the JHipster Registry with the dev and the native profiles.
Which is not really true... considering my struggling.

How to change location of Influxdb storage folder?

I've Installed package from the official site by instruction. By default the physical destination of database folder is /opt/influxdb/shared.
I've tried to change properties of config file and written it properly. But after that I can't start the influxdb service.
[storage]
dir = "/media/alex/Second/InfluxStorage/data/db" //my settings
How I can change the default database directory ?
EDIT: This is for InfluxDB v1.x only. It has been reported to not work for InfluxDB v2.x.
Make a new directory where you want to put your data and set the appropriate permissions, e.g.:
mkdir /new/path/to/influxdb
sudo chown influxdb:influxdb influxdb
Edit the following three lines of your /etc/influxdb/influxdb.conf (/usr/local/etc/influxdb.conf on macOS) so that they point to your new location:
# under [meta]
dir = "/new/path/to/influxdb/meta"
# under [data]
dir = "/new/path/to/influxdb/data"
wal-dir = "/new/path/to/influxdb/wal"
Restart the InfluxDB daemon.
sudo service influxdb restart # Ubuntu/Debian
brew services restart influxdb # macOS/homebrew
Done!
In case you want to move existing data, just simply copy the existing data (location can be found at influxdb.conf; /var/lib/influxdb on Ubuntu/Debian) to your new desired location before editing influxdb.conf and make sure the new folder has the appropriate permissions/ownership.
There is some information about backups/restores on the official docs, however just plain copying worked for me.
The above was tested on InfluxDB v1.2 on macOS/Ubuntu/Raspbian.
For InfluxDB 2.0:
In InfluxDB 2.0 the data directories are below ~/.influxdbv2 by default.
Actually, there are 2 data storages for bolt (various key-value configurations) and engine (the TSM database).
From the documentation, to change the location to the bolt database:
Default: ~/.influxdbv2/influxd.bolt
influxd flag: influxd --bolt-path=~/.influxdbv2/influxd.bolt
Environment variable: export INFLUXD_BOLT_PATH=~/.influxdbv2/influxd.bolt
Configuration file: bolt-path: /users/user/.influxdbv2/influxd.bolt
From the documentation, to change the location to the engine database:
Default: ~/.influxdbv2/engine
influxd flag: influxd --engine-path=~/.influxdbv2/engine
Environment variable: export INFLUXD_ENGINE_PATH=~/.influxdbv2/engine
Configuration file: engine-path: /users/user/.influxdbv2/engine

Resources