Roots Discourse

Deploy Hooks > build-before.yml error

ansible
trellis
sage9

#1

I am currently having issues with deployment to production server.

the provision and the deploy went ok, I am having problems with the deploy-hook.

this is the error that the console gives to me

I am using bitbucket, I have checked my public key and permissions and I am able to ssh onto the server without problem.

I am using sage 9, and this is my build-before.yml (I only uncommented the code, my theme is called sage, so I didn’t change the theme name).

if I comment the build-before.yml, no errors, but of course without this, I can’t upload the /dist/ directory in the production server.

What I am doing wrong?
What I can try to do?


#2

it was my error, I deleted the - before the name

- name: Install npm dependencies
  command: yarn
  connection: local
  args:
    chdir: "{{ project_local_path }}/web/app/themes/sage"

- name: Install Composer dependencies
  command: composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts
  args:
    chdir: "{{ deploy_helper.new_release_path }}/web/app/themes/sage"

- name: Compile assets for production
  command: yarn build:production
  connection: local
  args:
    chdir: "{{ project_local_path }}/web/app/themes/sage"

- name: Copy production assets
  synchronize:
    src: "{{ project_local_path }}/web/app/themes/sage/dist"
    dest: "{{ deploy_helper.new_release_path }}/web/app/themes/sage"
    group: no
    owner: no
    rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r

#3

You need the --- at the top also. Make sure you read the opening comments on that file: “Uncomment the lines below” means all the lines below not just some of them.


#4

thanks @MWDelaney, i corrected that file.

I can do the deploy correctly, i can see the /dist/ directory on the production server.

I am trying to do some css changes, just to test if everything work correctly, but I can’t see these css changes on the production server.
I inspect and open the css from the live website and I can’t see the css that I wrote.
I can see on my local correctly, but not on my production link.

So i tried to add in the js an alert, just to understand, if I have the same problem with the js, but the js on the live website works. I can see the alert prompt.

am I missing a step?

I am doing like this:

  • write some css rules (i can see the change on my mysite.test local)
  • run yarn && yarn run build:production from the theme directory
  • commit this changes to bitbucket
  • run ./bin/deploy.sh production mysite.com from the trellis directory

but as i said, the css is not updated.


#5

I found a workaround with this


#6

This issue is now resolved in Sage: