Skip to content

Elasticsearch credentials returns null no matter that... #104

@ntovarsolorzano

Description

@ntovarsolorzano

Maybe I'm making a mistake somewhere, but after 4h of troubleshooting, and doing in on bonsai.io & locally in the localhost, i give up.

This is my env file:

(more and more variables above, all of them proven correct, no issue there...)
OAUTH2_INTERAAPPS_CLIENT_ID=6n5a...
OAUTH2_INTERAAPPS_CLIENT_SECRET=0gH...

MINIO_SERVER=m4c6.ph.idrivee2-46.com
MINIO_REGION=phoenix
MINIO_BUCKET=pastefy
MINIO_ACCESS_KEY=dbN...
MINIO_SECRET_KEY=AG7M....

ELASTICSEARCH_URL=https://pastefy-6885515420.us-east-1.bonsaisearch.net
ELASTICSEARCH_USER=Gf....
ELASTICSEARCH_PASSWORD=ESLK...

(I have trimmed the users & passwords, but as far as my understanding goes, they are correctly typed in the .env file)

And in the docker-compose.yml file i Have:

services:
    
   db:
     image: mariadb:10.11
     volumes:
       - dbvol:/var/lib/mysql

     environment:
       MYSQL_ROOT_PASSWORD: pastefy
       MYSQL_DATABASE: pastefy
       MYSQL_USER: pastefy
       MYSQL_PASSWORD: pastefy

   pastefy:
     depends_on:
       - db
     image: interaapps/pastefy:latest
     ports:
       - "9999:80"
       
     environment:
       HTTP_SERVER_PORT: 80
       HTTP_SERVER_CORS: "*"
       DATABASE_DRIVER: mysql
       DATABASE_NAME: pastefy
       DATABASE_USER: pastefy
       DATABASE_PASSWORD: pastefy
       DATABASE_HOST: db
       DATABASE_PORT: 3306
       SERVER_NAME: "https://pastefy.mydomain.com"
       PASTEFY_INFO_CUSTOM_LOGO: ${PASTEFY_INFO_CUSTOM_LOGO}
       PASTEFY_INFO_CUSTOM_NAME: ${PASTEFY_INFO_CUSTOM_NAME}
       MINIO_SERVER: ${MINIO_SERVER}
       MINIO_REGION: ${MINIO_REGION}
       MINIO_BUCKET: ${MINIO_BUCKET}
       MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
       MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
       ELASTICSEARCH_URL: ${ELASTICSEARCH_URL}
       ELASTICSEARCH_USER: ${ELASTICSEARCH_USER}
       ELASTICSEARCH_PASSWORD: ${ELASTICSEARCH_PASSWORD}
       # There is INTERAAPPS, GOOGLE, GITHUB, DISCORD, TWITCH
       OAUTH2_INTERAAPPS_CLIENT_ID: ${OAUTH2_INTERAAPPS_CLIENT_ID}
       OAUTH2_INTERAAPPS_CLIENT_SECRET: ${OAUTH2_INTERAAPPS_CLIENT_SECRET}
       # Requires login for read and creation of pastes
       PASTEFY_LOGIN_REQUIRED: false
       # Login-requirements for specific access types
       PASTEFY_LOGIN_REQUIRED_CREATE: true
       # This will disable the raw mode as well for browser users
       PASTEFY_LOGIN_REQUIRED_READ: false
       # Check the encryption checkbox by default
       PASTEFY_ENCRYPTION_DEFAULT: true
       # Requires every new account being accepted by an administrator
       PASTEFY_GRANT_ACCESS_REQUIRED: false
       # Allows /paste route listing all pastes
       PASTEFY_LIST_PASTES: false
       # Makes /app/stats public
       PASTEFY_PUBLIC_STATS: true
       # Disables public pastes section
       PASTEFY_PUBLIC_PASTES: false
       # Disables sql automigration. Then you have to do it manually via pastefy.jar automigrate 
       PASTEFY_AUTOMIGRATE: true
     labels:
       - "com.centurylinklabs.watchtower.enable=true"

volumes:
   dbvol:
  

And this returns the following error in the pastefy container:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
ELASTIC: Using username and password for authentication
Exception in thread "main" java.lang.NullPointerException: Cannot read field "INDEXES" because the return value of "de.interaapps.pastefy.Pastefy.getInstance()" is null
	at de.interaapps.pastefy.helper.elastic.ElasticMigrator.migrateAll(ElasticMigrator.java:88)
	at de.interaapps.pastefy.Pastefy.setupElastic(Pastefy.java:314)
	at de.interaapps.pastefy.Pastefy.<init>(Pastefy.java:102)
	at de.interaapps.pastefy.Pastefy.main(Pastefy.java:540)

I have tried:
Using the complete URL in the format: user:password@pastefy-6885515420.us-east-1.bonsaisearch.net
or
pastefy-6885515420.us-east-1.bonsaisearch.net
or
localhost:9200 (Of course, adding the corresponding docker elasticsearch container)...

And nothing.

Am i doing anything wrong?
I check the website and I see it works properly. So, maybe I am doing a mistake somewhere.

Note:
It works properly if I comment ELASTICSEARCH_{variables}. So, absolutely sure this issue is on ELASTICSEARCH.

Nelson.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions