Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins not working when mounted as a volume #80

Open
bobweston opened this issue Aug 20, 2020 · 2 comments
Open

plugins not working when mounted as a volume #80

bobweston opened this issue Aug 20, 2020 · 2 comments

Comments

@bobweston
Copy link

bobweston commented Aug 20, 2020

I've discovered that when mounting the plugins directory as a volume, the plugins directory is empty. If I don't mount it as a volume, the ldap plugin included here seems to be available.

Can someone tell me what I'm doing wrong here?

Mounting the log and i18n directories work as expected.

This works (plugin is available to osticket. But not to local file system.)

docker run --name osticket -d -e MYSQL_ROOT_PASSWORD=new_root_password -e MYSQL_USER=new_root_user -e MYSQL_PASSWORD=new_secret -e MYSQL_DATABASE=osticket --link osticket_mysql:mysql -p 8080:80 -e SMTP_HOSTS=xxxxxxxxx -e SMTP_PORT=25 -e SMTP_TLS=0 -e TIMEZONE=America/New_York -v /Users/xxxxxxx/code/rxxxxxxxx/i18n:/data/upload/include/i18n -v /Users/xxxxxxxx/code/xxxxxxx/nginx_logs:/var/log/nginx campbellsoftwaresolutions/osticket
adding this line seems to cause things to go awry. The plugin directory is empty and nothing is available to the osticket app when I go to the plugins section of the app.

-v /Users/xxxxxxxx/code/xxxxxxx/plugins:/data/upload/include/plugins

`docker run --name osticket -d -e MYSQL_ROOT_PASSWORD=new_root_password -e MYSQL_USER=new_root_user -e MYSQL_PASSWORD=new_secret -e MYSQL_DATABASE=osticket --link osticket_mysql:mysql -p 8080:80 -e SMTP_HOSTS=xxxxxxxxx -e SMTP_PORT=25 -e SMTP_TLS=0 -e TIMEZONE=America/New_York -v /Users/xxxxxxxx/code/xxxxxxx/plugins:/data/upload/include/plugins -v /Users/xxxxxxx/code/rxxxxxxxx/i18n:/data/upload/include/i18n -v /Users/xxxxxxxx/code/xxxxxxx/nginx_logs:/var/log/nginx campbellsoftwaresolutions/osticket

I'm hoping this is just some some obvious mistake that I've made that someone can easily point out. I've triple checked that the local plugins directory exists.

Thanks for your work and help.

@bobweston
Copy link
Author

One thing I notice logging into that container is that when it runs without having the plugins directory/volume set specifically to a local directory, the file ownership and group are www-data. But after setting the -v /Users/xxxxxxxx/code/xxxxxxx/plugins:/data/upload/include/plugins it is owned by root.

Oddly, that isn't the case with the /var/log/nginx or /data/upload/include/i18n volumes.

@bobweston
Copy link
Author

bobweston commented Aug 20, 2020

edit:

Noting here is that the problem is that mounting a docker volume wipes out the content of a directory. So the ldap plugin installed in the Dockerfile gets wiped out as soon as you start the container and set the volume.

That's expected Docker behavior.

The work around is to do the plugin install in the start.sh (like was done for the languages).

I did the following in the start.sh file

Set the full path to the include directory as a shell variable:

DATA_INCLUDE_PATH="/data/upload/include"

Then I added the following conditional to the start.sh file

if [ ! -f $DATA_INCLUDE_PATH/plugins/auth-ldap.phar ]; then
  #do the install
  wget -nv -O $DATA_INCLUDE_PATH/plugins/auth-ldap.phar https://s3.amazonaws.com/downloads.osticket.com/plugin/auth-ldap.phar
  wget -nv -O $DATA_INCLUDE_PATH/plugins/audit.phar https://s3.amazonaws.com/downloads.osticket.com/plugin/audit.phar
  wget -nv -O $DATA_INCLUDE_PATH/plugins/auth-passthru.phar https://s3.amazonaws.com/downloads.osticket.com/plugin/auth-passthru.phar
  wget -nv -O $DATA_INCLUDE_PATH/plugins/storage-fs.phar https://s3.amazonaws.com/downloads.osticket.com/plugin/storage-fs.phar
  wget -nv -O $DATA_INCLUDE_PATH/plugins/storage-s3.phar https://s3.amazonaws.com/downloads.osticket.com/plugin/storage-s3.phar
  #set proper permmissions on those files
  chown -R www-data:www-data $DATA_INCLUDE_PATH/plugins/auth-ldap.phar
  chown -R www-data:www-data $DATA_INCLUDE_PATH/plugins/audit.phar
  chown -R www-data:www-data $DATA_INCLUDE_PATH/plugins/auth-passthru.phar
  chown -R www-data:www-data $DATA_INCLUDE_PATH/plugins/storage-fs.phar
  chown -R www-data:www-data $DATA_INCLUDE_PATH/plugins/storage-s3.phar
fi

After rebuilding the image and rebuilding the container, it downloads all those plugins to the volume.

I hope this helps someone else.

-Bob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant