Skip to content

Commit

Permalink
Move documentation from README to developer portal
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-helmich committed Dec 14, 2023
1 parent 434ac73 commit b3a892a
Showing 1 changed file with 4 additions and 69 deletions.
73 changes: 4 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<p align="center">
<a href="#installation">⚒️ Installation instructions</a> |
<a href="#usage">🙆 Usage</a> |
<a href="#configuration-options">📖 Configuration options</a> |
<a href="#ci-usage-examples">🤖 CI usage examples</a>
<a href="#configuration-options">⚙️ Configuration options</a> |
<a href="https://developer.mittwald.de/docs/v2/technologies/deployment/deployer/">📖 Documentation</a>
</p>

---
Expand Down Expand Up @@ -99,71 +99,6 @@ More precisely, the recipe will:

- `mittwald_ssh_public_key` and `mittwald_ssh_private_key` may contain an SSH public/private key pair that should be used for deployment. If not set, the `ssh_copy_id` variable will be used.

## CI usage examples

### Github actions

To use this recipe in a Github actions workflow, you should first configure the following secrets in your repository settings:

- `MITTWALD_API_TOKEN` should contain your mittwald API token
- `MITTWALD_APP_ID` should contain the ID of the mittwald application you want to deploy to.
- `MITTWALD_SSH_PRIVATE_KEY` should contain the private key of the SSH key pair that should be used for deployment.
- `MITTWALD_SSH_PUBLIC_KEY` should contain the public key of the SSH key pair that should be used for deployment.

Then, you can use the following workflow to deploy your application:

```yaml
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Deploy SSH keys
env:
MITTWALD_SSH_PRIVATE_KEY: ${{ secrets.MITTWALD_SSH_PRIVATE_KEY }}
MITTWALD_SSH_PUBLIC_KEY: ${{ secrets.MITTWALD_SSH_PUBLIC_KEY }}
run: |
mkdir -p .mw-deploy
echo "${MITTWALD_SSH_PRIVATE_KEY}" > .mw-deploy/id_rsa
echo "${MITTWALD_SSH_PUBLIC_KEY}" > .mw-deploy/id_rsa.pub
chmod 600 .mw-deploy/id_rsa*
- name: Run deployer
run: |
./vendor/bin/dep deploy \
-o mittwald_app_id={{ secrets.MITTWALD_APP_ID }} \
-o mittwald_ssh_public_key_file=.mw-deploy/id_rsa.pub \
-o mittwald_ssh_private_key_file=.mw-deploy/id_rsa
env:
MITTWALD_API_TOKEN: ${{ secrets.MITTWALD_API_TOKEN }}
```
## Documentation & How-Tos

### Gitlab CI
This Gitlab CI workflow uses the same repository variables as the Github actions example above:
```yaml
deploy:
image: php:8.2-cli
stage: deploy
before_script:
- wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet
- apt-get update && apt-get install -y git openssh-client
- mkdir -p .mw-deploy
- echo "$MITTWALD_SSH_PRIVATE_KEY" > .mw-deploy/id_rsa
- echo "$MITTWALD_SSH_PUBLIC_KEY" > .mw-deploy/id_rsa.pub
- chmod 600 .mw-deploy/id_rsa*
script:
- ./vendor/bin/dep deploy \
-o mittwald_app_id=$MITTWALD_APP_ID \
-o mittwald_ssh_public_key_file=.mw-deploy/id_rsa.pub \
-o mittwald_ssh_private_key_file=.mw-deploy/id_rsa
environment:
name: production
```
For more information on how to use this recipe, please refer to the [documentation](https://developer.mittwald.de/docs/v2/technologies/deployment/deployer/).

0 comments on commit b3a892a

Please sign in to comment.