1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Question Setting environment variables in subscriptions

Discussion in 'Plesk Extensions' started by campsjos, Apr 1, 2017.

  1. campsjos

    campsjos New Pleskian

    5
    20%
    Joined:
    Apr 1, 2017
    Messages:
    10
    Likes Received:
    3
    Location:
    Barcelona
    Hi!
    I deployed a Symfony 3 application using Git extension (I loved it) and then tried to install its dependencies trough Composer in Subscription > Applications > Scan > composer.json but it failed due to a environment variable issue (to build a Symfony application in production you need to run "export SYMFONY_ENV=prod" first. More info here).

    Finally I needed to log in to the server via SSH in order to run this command and then run "composer install --no-dev".

    So my question is: Is there any way to set up environment variables via the UI? If not, can I set those env vars for the plesk user via SSH in order to be able to update dependencies via the UI?

    Thanks!
     
    Last edited: Jul 3, 2017
    Daniel West likes this.
  2. Daniel West

    Daniel West New Pleskian

    1
    20%
    Joined:
    Jan 13, 2017
    Messages:
    3
    Likes Received:
    0
    Location:
    United Kingdom
    Only other thing is that this really only fails in the build scripts. Fortunately you can run scripts in a chrooted environment when git deploys. I've done a custom setup so that PHP7 is included in user's chrooted environments and essentially I can run the asset installs etc. on deployment. It is a pain when running the installs and updates though and it really should be an option.

    I know the composer install scripts will not run in a chrooted environment, because I don't have that, so perhaps we can work out what user it's being run as and add the environment variable to a .bash_profile?
     
Loading...