filestash icon indicating copy to clipboard operation
filestash copied to clipboard

[bug] Bcrypt Hashed Password for Admin Causing AWS Deployment Issues

Open cricksmaidiene opened this issue 1 year ago • 0 comments

Description of the bug

I'm trying to setup a self hosted version of Filestash on AWS Elastic Beanstalk. I am using the bcrypt hashed admin password environment variable within the docker-compose.yml file, to automatically set an admin password upon successful deployment. I am unable to deploy the docker-compose file with the bcrypt hash password since the $ characters in the bcrypt hash are considered invalid by elastic beanstalk.

Step by step instructions to reproduce the bug

  1. Create a .ebextensions folder within the docker folder of filestash
  2. Create a 01_multicontainer.config within .ebextensions file with the following value:
option_settings:
  aws:elasticbeanstalk:application:environment:
    COMPOSE_FILE: "docker-compose.yml"
  1. Let the docker-compose file be the following:
version: '2'
services:
  app:
    container_name: filestash
    image: machines/filestash
    restart: always
    environment:
      - APPLICATION_URL=
      - ADMIN_PASSWORD='<bcrypt_hash_password>'
    ports:
      - "80:8334"
  1. Run eb init from elastic beanstalk cli (installable through brew or pip)
  2. Run eb create filestash-env
  3. For subsequent deployments, use eb deploy

Can you replicate that error from the demo?

N/A

Observed behavior

Elastic Beanstalk Returns the following error:

An error occurred during execution of command [app-deploy] - 
[Docker Specific Build Application]. Stop running the command. 

Error: Command /bin/sh -c docker-compose config failed with error exit status 1.
 Stderr:Invalid interpolation format for "environment" option in service 
"app": "ADMIN_PASSWORD="<bcrypt_hash_password>"

Expected behavior

App should deploy as usual, with admin password already configured based on the bcrypt hash.

What I've tried

  1. Tried using $$ within the docker-compose file to escape the $ character, but that results in a different hash. The app deploys successfully but the password is not accepted anymore.
  2. Tried escaping with \$ - but deployment fails
  3. Tried setting the environment variable for ADMIN_PASSWORD directly through elastic beanstalk environment and plugged in to the filestash app on deployment, but that doesn't work either.

The main reason this is a problem is because upon subsequent deployments of elastic beanstalk, the filestash app restarts and requests a new admin password to be set upon redeployment.

P.S

  1. I think you've made a great open source application, so kudos and many thanks
  2. Since this is clearly more of an elastic beanstalk issue than a filestash issue, I understand if that's not under your purview. I would still appreciate any tips for trial and error.

cricksmaidiene avatar May 06 '23 20:05 cricksmaidiene