I’ve created post-receive hook for git repository which checkouts commit to web folder /var/www/myproject. Since I’m not committing dependencies (framework files), when checked out I have to install dependencies and init the framework. I see two approaches:
When checked out run the following commands from the project directory:
composer install
php init --env=Development --overwrite=n
#other commands to setup db connection, credentials etc.
Install dependencies one level up of checked out project /var/www and have links one level up. But it seems that with this approach I’ll still need to run php init.
I am not an expert, but I use the advanced template which uses separate web dirs that we can point our server root at.
For the actual deployment, I usually deploy and init a production instance locally and then arhive send and unarchive to the server, with some directories/files excluded.
I don’t want to run any commands on the server (composer/npm/ruby/etc).
Maybe there is an article about this on the wiki?
I should probably write a Python or Nodejs script to automate the deploy, but I am betting my horse that you beat me to that
Similar to Jacob above, but I don’t like to run the deploy scripts on a live server. Also, I wanted to replicate my live config on a testing server, so I have setup separate configs for live and dev.
I like this as i) there is no risk of over-writing configs on the live server, I can just upload the entire protected directory ii) my testing server will often include main-live but common/main-dev and params-dev
Whether this is the “right” way or not is debatable - it’s more about your server setup and your preference.