Skip to content

Commit

Permalink
DEVOPS-956: devex-apollo prod promote to gcp (#234)
Browse files Browse the repository at this point in the history
* feat: DEVOPS-956 devex-apollo prod promote to gcp

* feat: DEVOPS-956 devex-apollo prod promote to gcp

* feat: DEVOPS-956 devex-apollo prod promote to gcp

* feat: DEVOPS-956 devex-apollo prod promote to gcp
  • Loading branch information
pavlops authored Oct 19, 2023
1 parent 4520fbb commit f4ca625
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 242 deletions.
151 changes: 0 additions & 151 deletions .github/workflows/ci-on-merge-main-or-release.yml

This file was deleted.

23 changes: 13 additions & 10 deletions .github/workflows/cicd-prd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ jobs:
fail-fast: false
matrix:
application:
[bluebell-playground, developer-portal, devex, eth-spout, neo-savant]
[
bluebell-playground,
developer-portal,
devex,
devex-apollo,
eth-spout,
neo-savant,
]
include:
- application: bluebell-playground
image_name: bluebell-playground
Expand All @@ -33,6 +40,11 @@ jobs:
path: products/devex
tag_length: 8
tag_latest: false
- application: devex-apollo
image_name: devex-apollo
path: products/devex-apollo
tag_length: 8
tag_latest: false
- application: developer-portal
image_name: developer-portal
path: products/developer-portal
Expand Down Expand Up @@ -92,15 +104,6 @@ jobs:
cd ${{ matrix.path }}
make image/build-and-push
- name: "Build and push ${{ matrix.application }} tag latest - production"
if: matrix.tag_latest == true && github.event_name == 'push'
env:
ENVIRONMENT: prd
IMAGE_TAG: "${{ env.REGISTRY }}/${{ matrix.image_name }}:latest"
run: |
cd ${{ matrix.path }}
make image/build-and-push
- name: "Build and push ${{ matrix.application }} - production"
if: github.event_name == 'release'
env:
Expand Down
4 changes: 1 addition & 3 deletions cd/applications.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ This module contains the applications which are deployed upon merge into main an

APPLICATIONS_STAGING = []

APPLICATIONS_PROD = [
"//products/devex-apollo",
]
APPLICATIONS_PROD = []
34 changes: 0 additions & 34 deletions products/devex-apollo/BUILD

This file was deleted.

2 changes: 1 addition & 1 deletion products/devex-apollo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ endif

## Build and push the Docker image
image/build-and-push:
docker build -t "${IMAGE_TAG}" .
docker build --build-arg DEPLOY_ENV=${ENVIRONMENT} -t "${IMAGE_TAG}" .
docker push "${IMAGE_TAG}"
88 changes: 88 additions & 0 deletions products/devex-apollo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,91 @@ z app sync --cache-dir=.cache devex-apollo
```

Verify your application is running correct from the staging URL and with `kubectl` commands (if required).

## Deploying applications to production

To deploy the production environment we need to clone the devops repository and execute `z` from there:

```sh
git clone https://github.com/Zilliqa/devops.git
cd devops
source setenv
```

### Set the following environment variables

- `Z_ENV` to the path in which your `z.yaml` resides.
- `ZQ_USER` to your username (the bit before `@` in your email address)
- `GITHUB_PAT` (if you are deploying staging or production apps) to a classic PAT with all the repo permissions ticked.

for example:

```sh
export Z_ENV=`pwd`/infra/live/gcp/production/prj-p-prod-apps/z_ase1.yaml
export ZQ_USER=<user_id>@zilliqa.com
export GITHUB_PAT=<GITHUB_PAT>
```

### Login to Google Cloud

```sh
z login
```

### Add the application to the production `z.yaml` file. Skip this step if it is an existing application

1. Create a branch:

```sh
git checkout -b users/<username>/add_devex_to_production_cluster
```

2. In the file `infra/live/gcp/production/prj-p-prod-apps/z_ase1.yaml` add the following:

- in `apps` stanza add:

```yaml
clusters:
production:
apps:
devex-apollo:
repo: https://github.com/Zilliqa/zilliqa-developer
path: products/devex-apollo/cd/overlays/production
track: production
type: kustomize
```
- in `subdomains` stanza add:

```yaml
infrastructure:
dns:
vars:
subdomains:
devex-apollo: {}
```

3. Push the changes

```sh
git add .
git commit -m "Add Devex Apollo to production cluster"
git push origin users/<username>/add_devex_apollo_to_production_cluster
```

4. Open a Pull Request to the main branch

5. Apply the changes

```sh
z plan
z apply
```

### Deploy the application

```sh
z app sync --cache-dir=.cache devex-apollo
```

Verify your application is running correct from the production URL and with `kubectl` commands (if required).
7 changes: 7 additions & 0 deletions products/devex-apollo/cd/overlays/production/certificate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: networking.gke.io/v1
kind: ManagedCertificate
metadata:
name: devex-apollo
spec:
domains:
- devex-apollo.zilliqa.com
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: devex-apollo
namespace: devex-apollo-prd
data:
BLOCKS_PER_REQUEST: "50"
FAST_SYNC: "false"
Expand Down

This file was deleted.

Loading

0 comments on commit f4ca625

Please sign in to comment.