|
| 1 | +# Choose Native Plants Application |
| 2 | + |
| 3 | +This README provides instructions for deploying and managing the Choose Native Plants application in the Kubernetes cluster using Helm. |
| 4 | + |
| 5 | +## Creating a New Release |
| 6 | + |
| 7 | +1. Update the `release-values.yaml` file with the new version number: |
| 8 | + |
| 9 | +```yaml |
| 10 | +app: |
| 11 | + image: |
| 12 | + tag: "x.y.z" # Replace with the new version number |
| 13 | +``` |
| 14 | +
|
| 15 | +2. Commit and push the changes to the repository: |
| 16 | +
|
| 17 | +```powershell |
| 18 | +git add release-values.yaml |
| 19 | +git commit -m "Update Choose Native Plants to version x.y.z" |
| 20 | +git push origin main |
| 21 | +``` |
| 22 | + |
| 23 | +3. Create a new release in GitHub: |
| 24 | + - Go to the [GitHub repository](https://github.com/CodeForPhilly/pa-wildflower-selector) |
| 25 | + - Click on the "Releases" tab |
| 26 | + - Click "Draft a new release" |
| 27 | + - Set the tag version to match your release (e.g., "v2.0.3") |
| 28 | + - Set the release title (e.g., "Choose Native Plants v2.0.3") |
| 29 | + - Add release notes describing the changes in this version |
| 30 | + - Click "Publish release" |
| 31 | + |
| 32 | +4. The GitHub Actions workflow will automatically build and push the new Docker image to the GitHub Container Registry with the specified tag. |
| 33 | + |
| 34 | +## Deploying the Application with Helm |
| 35 | + |
| 36 | +Once you've updated the release-values.yaml file and created a GitHub release, you can deploy the application using Helm: |
| 37 | + |
| 38 | +```powershell |
| 39 | +# Deploy or upgrade the application using Helm |
| 40 | +# Note: This only updates the deployment in the Kubernetes cluster, not your local repository |
| 41 | +helm upgrade --install choose-native-plants .\pa-wildflower-selector\helm-chart\ -f .\cfp-sandbox-cluster\choose-native-plants\release-values.yaml -n choose-native-plants |
| 42 | +``` |
| 43 | + |
| 44 | +**Important**: The `helm upgrade` command only affects your Kubernetes cluster deployment. It doesn't modify any files in your local repository. Make sure you've committed and pushed all changes to GitHub before running this command. |
| 45 | + |
| 46 | +### Helm Release Management |
| 47 | + |
| 48 | +```powershell |
| 49 | +# View release history |
| 50 | +helm history choose-native-plants -n choose-native-plants |
| 51 | +
|
| 52 | +# Rollback to a previous release if needed |
| 53 | +helm rollback choose-native-plants [REVISION] -n choose-native-plants |
| 54 | +
|
| 55 | +# View release status |
| 56 | +helm status choose-native-plants -n choose-native-plants |
| 57 | +``` |
| 58 | + |
| 59 | +## Managing the Application |
| 60 | + |
| 61 | +### Syncing Images |
| 62 | + |
| 63 | +To sync images with the Linode Object Storage, use this command which automatically finds the current pod: |
| 64 | + |
| 65 | +```powershell |
| 66 | +$POD_NAME = kubectl get pods -n choose-native-plants -l app.kubernetes.io/name=choose-native-plants -o jsonpath='{.items[0].metadata.name}' |
| 67 | +kubectl exec -it $POD_NAME -n choose-native-plants -c choose-native-plants-app -- /bin/sh /app/scripts/sync-images |
| 68 | +``` |
| 69 | + |
| 70 | +### Downloading Data (Skip Images) |
| 71 | + |
| 72 | +To download data without images, use this command: |
| 73 | + |
| 74 | +```powershell |
| 75 | +$POD_NAME = kubectl get pods -n choose-native-plants -l app.kubernetes.io/name=choose-native-plants -o jsonpath='{.items[0].metadata.name}' |
| 76 | +kubectl exec -it $POD_NAME -n choose-native-plants -c choose-native-plants-app -- node download --skip-images |
| 77 | +``` |
| 78 | + |
| 79 | +### Massaging Data |
| 80 | + |
| 81 | +To process the data, use this command: |
| 82 | + |
| 83 | +```powershell |
| 84 | +$POD_NAME = kubectl get pods -n choose-native-plants -l app.kubernetes.io/name=choose-native-plants -o jsonpath='{.items[0].metadata.name}' |
| 85 | +kubectl exec -it $POD_NAME -n choose-native-plants -c choose-native-plants-app -- node massage |
| 86 | +``` |
| 87 | + |
| 88 | +### Viewing Previous Logs |
| 89 | + |
| 90 | +To view the previous logs from the application container: |
| 91 | + |
| 92 | +```powershell |
| 93 | +$POD_NAME = kubectl get pods -n choose-native-plants -l app.kubernetes.io/name=choose-native-plants -o jsonpath='{.items[0].metadata.name}' |
| 94 | +kubectl logs $POD_NAME -n choose-native-plants -c choose-native-plants-app --previous |
| 95 | +``` |
| 96 | + |
| 97 | +## Troubleshooting |
| 98 | + |
| 99 | +If you encounter issues with the deployment, check the status of the pods: |
| 100 | + |
| 101 | +```powershell |
| 102 | +kubectl get pods -n choose-native-plants |
| 103 | +``` |
| 104 | + |
| 105 | +For more detailed information about a specific pod: |
| 106 | + |
| 107 | +```powershell |
| 108 | +$POD_NAME = kubectl get pods -n choose-native-plants -l app.kubernetes.io/name=choose-native-plants -o jsonpath='{.items[0].metadata.name}' |
| 109 | +kubectl describe pod $POD_NAME -n choose-native-plants |
| 110 | +``` |
| 111 | + |
| 112 | +## CI/CD Integration with Helm |
| 113 | + |
| 114 | +To integrate Helm into your CI/CD pipeline, update your deployment scripts to use Helm commands instead of direct kubectl commands. Here's a typical workflow: |
| 115 | + |
| 116 | +1. **Update Version**: Update the version in release-values.yaml as part of your CI process |
| 117 | +2. **Commit Changes**: Commit the updated release-values.yaml to your repository |
| 118 | +3. **Deploy with Helm**: Use the helm upgrade command in your deployment pipeline |
| 119 | + |
| 120 | +```powershell |
| 121 | +# Example CI/CD script |
| 122 | +$VERSION="2.0.3" # This would be dynamically set in your CI/CD process |
| 123 | +
|
| 124 | +# Update the version in release-values.yaml |
| 125 | +(Get-Content .\cfp-sandbox-cluster\choose-native-plants\release-values.yaml) -replace 'tag: "\d+\.\d+\.\d+"', "tag: "$VERSION"" | Set-Content .\cfp-sandbox-cluster\choose-native-plants\release-values.yaml |
| 126 | +
|
| 127 | +# Deploy with Helm |
| 128 | +helm upgrade --install choose-native-plants .\pa-wildflower-selector\helm-chart\ -f .\cfp-sandbox-cluster\choose-native-plants\release-values.yaml -n choose-native-plants |
| 129 | +``` |
| 130 | + |
| 131 | +## Accessing the Application |
| 132 | + |
| 133 | +The application is accessible at: https://choose-native-plants.sandbox.k8s.phl.io |
0 commit comments