josdem / vetlog-spring-boot

Maintain your pet history organized
https://vetlog.org
Apache License 2.0
21 stars 23 forks source link

Pet's image is aligned to the left in the give in adoption view #409

Closed josdem closed 2 weeks ago

josdem commented 2 weeks ago

Preconditions

Steps to reproduce

Expectation

Actual result

Screenshot give_in_adoption

tkim602 commented 2 weeks ago

if it is not fixed yet, can I give it a try?

josdem commented 2 weeks ago

if it is not fixed yet, can I give it a try?

Absolutely, thank you! let me know if any questions.

tkim602 commented 2 weeks ago

@josdem Hi, I’m trying to run the project, but I keep encountering a database connection error:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Failed to determine a suitable driver class

I’ve verified that my application-development.yml has the correct database configuration, and I’ve set -Dspring.config.location=$HOME/.vetlog/application-development.yml as the config path.

Could you advise on what I might be missing to resolve this?

josdem commented 2 weeks ago

Hi @tkim602 according to the wiki page the command you should use to run the app is:

./gradlew -Dspring.config.location=$HOME/.vetlog/application-development.yml -Dflyway.user=${username} -Dflyway.password=${password} bootRun

Where:

Please find here a copy from my local computer application-development.yml file:

spring:
  datasource:
    url:  jdbc:mysql://localhost:3306/vetlog
    username:  username
    password:  password
    driverClassName: com.mysql.jdbc.Driver
    maxActive:  50
    maxIdle: 5
    minIdle: 25
    initialSize: 10
    validationQuery: SELECT 1
    testOnBorrow: true
    testOnReturn: false
    testWhileIdle: true
    timeBetweenEvictionRunsMillis: 5000
    minEvictableIdleTimeMillis: 60000
    maxWait: 10000
    template:
    cache: false
  jpa:
    hibernate:
      DdlAuto: validate
  profiles:
    include: development
  messages:
    basename: i18n/messages
  servlet:
    multipart:
      maxFileSize: 10MB
      maxRequestSize: 10MB
  cloud:
    gcp:
      projectId: vetlog-357216
      core:
        enabled: true
      credentials:
        location: classpath:vetlog.json
message: Hello Vetlog!
jmailer:
  url: https://jmailer.josdem.io/emailer/
  path: message
baseUrl: https://vetlog.org/
template:
  register:
    name: register.ftl
    path: recovery/activate/
  forgot:
    name: forgotPassword.ftl
    path: recovery/forgot/
  adoption:
    name: adoption.ftl
breedsByTypeUrl: https://vetlog.org/breed/list
imageBucket: vetlog-bucket
prescriptionBucket: prescription-bucket
gcpUrl: https://storage.googleapis.com/
defaultImage: default-image.png
token: jmailer-user-token
management:
  endpoints:
    web:
      exposure:
        include: "health,info"

Also make sure you are able to connect to your local database computer using any client such as command line or MySQL Workbench. I hope this helps, let me know if you still are facing issues.

tkim602 commented 2 weeks ago

@josdem I don't know it is just me but when I try to upload a photo, I encounter the following error:

Oops! 403 Forbidden POST https://storage.googleapis.com/upload/storage/v1/b/vetlog-bucket/o?projection=full&uploadType=multipart { "error": { "code": 403, "message": "vetlog-test@vetlog-357216.iam.gserviceaccount.com does not have storage.objects.create access to the Google Cloud Storage object. Permission 'storage.objects.create' denied on resource (or it may not exist).", "errors": [ { "message": "vetlog-test@vetlog-357216.iam.gserviceaccount.com does not have storage.objects.create access to the Google Cloud Storage object. Permission 'storage.objects.create' denied on resource (or it may not exist).", "domain": "global", "reason": "forbidden" } ] } }

It appears that the service account vetlog-test@vetlog-357216.iam.gserviceaccount.com does not have a storage.objects.create permission to upload objects to the Google Cloud Storage bucket. I can register pets without conflicts when I register them without images. I appreciate your support.

josdem commented 2 weeks ago

Hi @tkim602 that is expected, the reason is becasue you need credentials to upload photos to Google cloud, however, do not worry, I created a dump file where you can see images for a pet registered with the name "Amigo". You can use this credentials to login in your local computer: username: josdem password: 12345678

vetlog20241109.txt Let me know if any questions.

tkim602 commented 2 weeks ago

Hi @josdem, I just added a few lines to fix the issue and created a PR. Let me know if anything else needs to be adjusted. Thanks for all the guidance. I've learned a lot from you 👍