Starting point for deploys with CircleCI

Hey guys - first time poster!

I’ve been searching for ways to streamline our internal process and came across CircleCI for automatically deploying after running a git push - Any good starting points to run deployments to staging using CircleCI?

I’ve been digging and can’t find that gives a clear outline.

Thank you

https://circleci.com/developer/orbs/orb/itinerisltd/tiller-circleci or https://circleci.com/developer/orbs/orb/itinerisltd/tiller-monorepo-circleci

2 Likes

Thanks @TangRufus Have been running into the error below on multiple jobs - after investigating through ssh, I see the .vault_pass file has been created in the wrong directory

#!/bin/bash -eo pipefail echo ${VAULT_PASSWORD} > ~/projects/trellis/trellis/.vault_pass

/bin/bash: /home/circleci/projects/trellis/trellis/.vault_pass: No such file or directory Exited with code exit status 1

CircleCI received exit code 1

Any advice on how to modify where the .vault_pass is echoed out?

I’d start by searching the repo for that orb for vault_pass, which is what I did and it lead me here: https://github.com/ItinerisLtd/tiller-circleci-orb/blob/42f8792310be44c66bb8f34acbaa272dbe8eeaca/src/commands/prepare_trellis.yml#L29-L32

3 Likes

If you following the offical docs and have Bedrock and Trellis in the same repo, use https://circleci.com/developer/orbs/orb/itinerisltd/tiller-monorepo-circleci

If you separate them into 2 repo, use https://circleci.com/developer/orbs/orb/itinerisltd/tiller-circleci

If you actually customzied the vault file file name, use vault-password-file-name.

@TangRufus thanks! I’ve followed the official docs and used the monorepo orb - setup all parameters. Running into error on Spin up environment step:

Build-agent version 1.0.52983-4b2c2b6c (2021-02-08T10:49:47+0000)
System information:
 Server Version: 19.03.13
 Storage Driver: overlay2
  Backing Filesystem: xfs
 Cgroup Driver: cgroupfs
 Kernel Version: 4.15.0-1092-aws
 Operating System: Ubuntu 18.04.5 LTS
 OSType: linux
 Architecture: x86_64

Starting container itinerisltd/tiller-monorepo-circleci:base
Warning: No authentication provided, using CircleCI credentials for pulls from Docker Hub.
  image cache not found on this host, downloading itinerisltd/tiller-monorepo-circleci:base

  Error pulling image itinerisltd/tiller-monorepo-circleci:base: Error response from daemon: pull access denied for itinerisltd/tiller-monorepo-circleci, repository does not exist or may require 'docker login': denied: requested access to the resource is denied... retrying
  image cache not found on this host, downloading itinerisltd/tiller-monorepo-circleci:base

  Error pulling image itinerisltd/tiller-monorepo-circleci:base: Error response from daemon: pull access denied for itinerisltd/tiller-monorepo-circleci, repository does not exist or may require 'docker login': denied: requested access to the resource is denied... retrying
  image cache not found on this host, downloading itinerisltd/tiller-monorepo-circleci:base

  Error pulling image itinerisltd/tiller-monorepo-circleci:base: Error response from daemon: pull access denied for itinerisltd/tiller-monorepo-circleci, repository does not exist or may require 'docker login': denied: requested access to the resource is denied... retrying
  image cache not found on this host, downloading itinerisltd/tiller-monorepo-circleci:base

  Error pulling image itinerisltd/tiller-monorepo-circleci:base: Error response from daemon: pull access denied for itinerisltd/tiller-monorepo-circleci, repository does not exist or may require 'docker login': denied: requested access to the resource is denied... retrying
  image cache not found on this host, downloading itinerisltd/tiller-monorepo-circleci:base

  Error pulling image itinerisltd/tiller-monorepo-circleci:base: Error response from daemon: pull access denied for itinerisltd/tiller-monorepo-circleci, repository does not exist or may require 'docker login': denied: requested access to the resource is denied... retrying
  image cache not found on this host, downloading itinerisltd/tiller-monorepo-circleci:base

Error response from daemon: pull access denied for itinerisltd/tiller-monorepo-circleci, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

Anything I should be adding here?

Fixed in https://github.com/ItinerisLtd/tiller-monorepo-circleci-orb/pull/11 Tagged as v0.0.4.

Tips: If you are using Sage as well, you should change executor-tag to one of node-10, node-12, node-14 or those tags on https://hub.docker.com/r/itinerisltd/tiller-circleci/tags


I think you are one of the 2 persons using the monorepo version. Let me know if you find any bugs. Or, better yet, send PRs.


Side note: I have a long standing issue about trellis init cache invalidation. trellis init caches are disabled in both orbs. Send PRs if you found a way to invalidation them.

3 Likes

@TangRufus Thanks so much - everything worked perfectly after that. Good to see success after a couple failures :slight_smile:

I did try to setup another config on a staging branch however after git push it kept hanging on this task:

TASK [connection : Check whether Ansible can connect as web] *******************
task path: /home/circleci/project/trellis/roles/connection/tasks/main.yml:18
Using module file /home/circleci/project/trellis/.trellis/virtualenv/lib/python3.9/site-packages/ansible/modules/command.py
Pipelining is enabled.
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: circleci
<localhost> EXEC /bin/sh -c 'ANSIBLE_SSH_ARGS='"'"'-o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s '"'"' /home/circleci/project/trellis/.trellis/virtualenv/bin/python && sleep 0'
The authenticity of host 'XXXXXXXXXXX (XXXXXXXXXXX)' can't be established.

I tried reprovisioning staging with keys but nothing seemed to work.

Use the known-hosts option.

In most cases, you need:

  • known-hosts: 123.123.123.123 <-- that is your server IP
  • known-hosts: github.com,123.123.123.123 <-- if you composer install from github

Note to self: I should add some examples when i have time

2 Likes

@TangRufus can confirm this works perfectly :ok_hand:

I think I can take it from here, will reach out if I bump into any other bugs.

Thank you!

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.