Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriipavlov committed Apr 1, 2024
2 parents 21a953f + f53e99d commit 8ed3138
Show file tree
Hide file tree
Showing 10 changed files with 1,995 additions and 28 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/job-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,48 @@ jobs:
echo "COMPOSER_AUTH=${{ secrets.COMPOSER_AUTH }}" >> ./config/environment/.env.secret
bash ./sh/env/init.sh ${{ inputs.ENVIRONMENT_TYPE }}
- name: Build Cache - restore
id: build-cache-restore
uses: actions/cache/restore@v4
with:
path: |
vendor
web
key: build-cache-${{ inputs.SSH_HOST_ALIAS }}-${{ runner.os }}-${{ hashFiles('composer.lock', 'composer.json', 'web/wp-config/**/*') }}

- name: Install Composer and Node Dependencies
if: steps.build-cache-restore.outputs.cache-hit != 'true'
run: |
export CURRENT_UID=$(id -u)
export CURRENT_GID=$(id -g)
bash ./sh/install.sh yes
- name: Save Built cache
uses: actions/cache@v4
- name: Build Cache - save
if: steps.build-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
vendor
web
key: build-cache-${{ inputs.SSH_HOST_ALIAS }}-${{ runner.os }}-${{ hashFiles('composer.lock', 'composer.json', 'web/wp-config/**/*') }}

- name: Save Built job
uses: actions/cache/save@v4
with:
path: .
key: build-cache-${{ github.run_number }}
key: build-job-${{ github.run_number }}

deploy:
runs-on: ubuntu-22.04

needs: [ build ]

steps:
- name: Use Built cache
uses: actions/cache@v4
- name: Use Built job
uses: actions/cache/restore@v4
with:
path: .
key: build-cache-${{ github.run_number }}
key: build-job-${{ github.run_number }}

- name: Set up SSH key
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ node_modules
vendor
# If we are using custom dependency we should run composer update everywhere
# to update to last changes without lock file
composer.lock
#composer.lock
# Same for npm, if we need to use last version of custom package, we shoul ignore lock
#package-lock.json
#mix-manifest.json
Expand Down
10 changes: 5 additions & 5 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

1. [Docker Engine](https://docs.docker.com/engine/install/) v24+
2. [Docker Compose](https://docs.docker.com/compose/install/) v2.21+
3. [GitHub SSH key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh)
3. [GitHub SSH key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) or [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)


## Creating new project

1. Check your GitHub SSH connection `ssh -T [email protected]` or use [Personal Access Token](#cicd-deployments) in `.env.secret` `COMPOSER_AUTH`
1. Check your GitHub SSH with `ssh -T [email protected]` or use [PAT](#cicd-deployments) in `.env.secret` `COMPOSER_AUTH`

2. Create a new project directory and clone this repository into the project folder.

Expand Down Expand Up @@ -83,7 +83,7 @@ After the installation, you can add your custom secrets 🔑 to `.env.secret`, b
You can add secret variables names there without secret data, just for structure. A password generator will replace the special word `generate_this_pass` with the real password when you run `make install` or `make secret` (`bash sh/env/secret-gen.sh`).


⚠️ **WARNING 📣 Do not define secrets (private keys, passwords, tokens, etc.) in committed files, it's not secure!**
⚠️ **WARNING 📣 Do not define secrets (keys, passwords, tokens, etc.) in committed files, it's not secure!**

## Run composer scripts
To run PHP Composer, you need to run the `composer` container and enter it:
Expand Down Expand Up @@ -294,8 +294,8 @@ For running server setup automations use this steps:
1. Add public key to `~/authorized_keys` file on servers (use `make terraform apply` command if you haven't already done so)
2. Check your credentials in `./.ssh` folder. Use [ssh config file](https://linuxize.com/post/using-the-ssh-config-file/) to simplify connections.
3. Check `./iac/ansible/inventory.yml` servers and credentials, host names should be the same as on ssh config file.
4.Check `./iac/ansible/playbook.yml` file hosts and tasks. Hosts must correspond to inventory hosts.
5.Run ansible command:
4. Check `./iac/ansible/playbook.yml` file hosts and tasks. Hosts must correspond to inventory hosts.
5. Run ansible command:
```bash
make ansible
```
Expand Down
Loading

0 comments on commit 8ed3138

Please sign in to comment.