Roots Discourse

Bedrock + Capistrano. Permissions problem on shared host 403 on web/wp


EDIT: After changing the permissions manually, it seems the problem is with symlinks not being respected when viewing through http even when they are right in the shell. Could it be?

Hi There!

I’m a long time Sage user and have used trellis successfully a few times now. This is my first time using bedrock and bedrock-capistrano though. For my current project I could not dissuade my client to leave his shared host. After a long battle I got my deploy almost running but my web/wp and all below show 403 trying to access from the browser. Also the uploads folder and it’s contents are not being uploaded. Below is my folder structure:

Where ‘webseiten’ ist the home folder.
My deploy.rb:

set :application, 'clientName'
set :repo_url, ''

# Branch options
# Prompts for the branch name (defaults to current branch)
#ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp }

# Hardcodes branch to always be master
# This could be overridden in a stage config file
set :branch, :master

set :deploy_to, -> { "/kunden/someClientNumber/webseiten/#{fetch(:application)}" }

# Use :debug for more verbose output when troubleshooting
set :log_level, :debug

# Apache users with .htaccess files:
# it needs to be added to linked_files so it persists across deploys:
# set :linked_files, fetch(:linked_files, []).push('.env', 'web/.htaccess')
set :linked_files, fetch(:linked_files, []).push('.env')
set :linked_dirs, fetch(:linked_dirs, []).push('web/app/uploads')

SSHKit.config.command_map[:bash] = '/bin/bash'
SSHKit.config.command_map[:composer] = "/usr/local/bin/php5-56STABLE-CLI /kunden/someClientNumber/composer.phar"
SSHKit.config.command_map[:wp] = "/usr/local/bin/php5-56STABLE-CLI /kunden/someClientNumber/wp-cli.phar"

namespace :deploy do
  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      # Your restart mechanism here, for example:
      # execute :service, :apache, :reload

# The above restart task is not run by default
# Uncomment the following line to run it on deploys if needed
# after 'deploy:publishing', 'deploy:restart'

namespace :deploy do
  desc 'Update WordPress template root paths to point to the new release'
  task :update_option_paths do
    on roles(:app) do
      within fetch(:release_path) do
        if test :wp, :core, 'is-installed'
          [:stylesheet_root, :template_root].each do |option|
            # Only change the value if it's an absolute path
            # i.e. The relative path "/themes" must remain unchanged
            # Also, the option might not be set, in which case we leave it like that
            value = capture :wp, :option, :get, option, raise_on_non_zero_exit: false
            if value != '' && value != '/themes'
              as(user: 'un', group: 'grp') { 
                execute :wp, :option, :set, option, fetch(:release_path).join('web/wp/wp-content/themes')

# The above update_option_paths task is not run by default
# Note that you need to have WP-CLI installed on your server
# Uncomment the following line to run it on deploys if needed
after 'deploy:publishing', 'deploy:update_option_paths'

and my production.rb:

set :stage, :production

# Extended Server Syntax
# ======================
server '', user: 'ssh-311816-teamtime', roles: %w{web app db}

# you can set custom ssh options
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
# you can see them in [net/ssh documentation](
# set it globally
 set :ssh_options, {
   keys: %w(~/.ssh/id_rsa)

fetch(:default_env).merge!(PATH: '$PATH:/usr/local/bin/php5-56STABLE-CLI')
fetch(:default_env).merge!(wp_env: :production)

following erros appear in the deploy but dont stop it:
Running /usr/bin/env [ -L /kunden/someClientNumber/webseiten/clientName/releases/20170401213159/.env ] on Running /usr/bin/env [ -f /kunden/someClientNumber/webseiten/clientName/releases/20170401213159/.env ] on ... Running /usr/bin/env [ -L /kunden/someClientNumber/webseiten/clientName/releases/20170401213159/web/app/uploads ] on ... Running /usr/local/bin/php5-56STABLE-CLI /kunden/someClientNumber/wp-cli.phar option get stylesheet_root on Running /usr/local/bin/php5-56STABLE-CLI /kunden/someClientNumber/wp-cli.phar option get template_root on
All fail with status 1.

Any Idea what could be happening? Any help is more than appreciated!