Skip to content

Commit 0e993e5

Browse files
authored
feat: added Best practices on how to deploy GIT connected Apps that are using packages. (#2979)
## Description Added Best practices on how to deploy GIT connected Apps that are using packages. This documentation talks about both scenarios, ie GIT connected and non GIT connected packages. Also talks about how to use CI/CD in such cases Provide a concise summary of the changes made in this pull request - ## Pull request type Check the appropriate box: - [ ] Review Fixes - [ ] Documentation Overhaul - [ ] Feature/Story - Link one or more Engineering Tickets * - [ ] A-Force - [ ] Error in documentation - [ ] Maintenance ## Documentation tickets [2978](#2978) Link to one or more documentation tickets: - ## Checklist From the below options, select the ones that are applicable: - [ ] Checked for Grammarly suggestions. - [ ] Adhered to the writing checklist. - [ ] Adhered to the media checklist. - [ ] Verified and updated cross-references or added redirect rules. - [ ] Tested the redirect rules on deploy preview. - [ ] Validated the modifications made to the content on the deploy preview. - [ ] Validated the CSS modifications on different screen sizes.
1 parent 8826eec commit 0e993e5

File tree

5 files changed

+129
-0
lines changed

5 files changed

+129
-0
lines changed

website/docs/help-and-support/troubleshooting-guide/git-errors.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,41 @@ messageContent='Private Repo Limit Error'></Message>
124124

125125
In the community edition, you can only connect to 3 private repositories. If you want to connect more private repositories, you must upgrade to a paid plan. For more information, see [Pricing](https://www.appsmith.com/pricing).
126126

127+
### CI/CD deployment failed - missing packages
128+
129+
<Message
130+
messageContainerClassName='error'
131+
messageContent='AE-GIT-5002: Deployment aborted to protect the last successful version as the artifact is in an invalid state. Details: Module instances exist without the necessary packages/modules in the current workspace. Please resolve the missing dependencies first.'></Message>
132+
133+
#### Cause
134+
135+
This error occurs when CI/CD fails because the application uses Packages that are not present in the workspace where the CI/CD is being triggered. The deployment is aborted to protect the last successful version.
136+
137+
#### Solution
138+
139+
To resolve this:
140+
141+
1. Ensure that all Packages used by the application are imported into the workspace of the application for which CI/CD is being triggered.
142+
143+
2. If the issue continues to happen despite importing all Packages, reconfigure the bearer token from the CI/CD settings of the application and use the new bearer token in your CI/CD API. This is required because older bearer tokens may not have the necessary permissions to resolve Package dependencies.
144+
145+
For more information, see [CI/CD with Git-Connected Apps and Packages](/packages/reference/best-practices-git-packages#cicd-with-git-connected-apps-and-packages).
146+
147+
### Edit and view mode out of sync
148+
149+
#### Cause
150+
151+
In some cases, an issue can occur where the latest changes have been pulled to the edit mode of the application, but the deployment to view mode failed. This results in edit mode and view mode being out of sync, with no more commits to be pushed.
152+
153+
#### Solution
154+
155+
When edit and view mode are out of sync and there are no more changes to be committed, you will see the **Deploy** button on the top right of the editor displaying an orange notification dot. When you hover over it, a tooltip will appear stating "Redeploy needed to sync changes from edit mode." To resolve this:
156+
157+
1. Open the Git commit modal by clicking the **Deploy** button on the top right of the editor.
158+
2. Click the **Redeploy** button in the Git modal to synchronize the changes from edit mode to view mode.
159+
160+
<ZoomImage src="/img/redeploy-app.png" alt="Redeploy app" caption="Redeploy app" />
161+
127162

128163

129164

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# GIT Apps with Packages Best Practices
2+
3+
This page provides essential best practices for working with Git-connected applications that use Packages, helping you maintain synchronization between your applications and their dependencies, and ensuring smooth deployments across different workspaces and instances.
4+
5+
## Non Git-Connected Packages
6+
7+
When working with a Git-connected application that uses non Git-connected Packages, you need to ensure that Package updates are properly synchronized to the deployed version of your application.
8+
9+
### Synchronizing Package Updates
10+
11+
Whenever a non Git-connected Package is updated, follow these steps to ensure the latest changes are reflected in the view mode of your Git-connected application:
12+
13+
1. Navigate to the Git-connected application in **edit mode**.
14+
15+
2. Open the Git commit modal by clicking the **Commit** icon button in the bottom bar or the **Deploy** button on the top right of the editor.
16+
17+
3. Click **Redeploy** from the Git modal to synchronize the latest Package changes to view mode.
18+
19+
<ZoomImage src="/img/redeploy-with-packages.png" alt="Redeploy with packages" caption="Redeploy with packages" />
20+
21+
Alternatively, if there are any pending commits to be made to the application itself, making a commit will also ensure that the latest Package-related changes are deployed to view mode. The commit process automatically includes Package updates in the deployment.
22+
23+
## Git-Connected Packages
24+
25+
When working with a Git-connected application that uses Git-connected Packages, you need to manually update the Package version in your application after a new version is published and released.
26+
27+
### Updating Package Versions
28+
29+
When a Git-connected Package is published and released with a new version, follow these steps to update your application to use the new version:
30+
31+
1. Navigate to the Git-connected application in **edit mode**.
32+
33+
2. Open the **Libraries** section from the sidebar.
34+
35+
3. Under **Packages**, locate the Package that was updated and switch the version to the new one that was published.
36+
37+
4. Commit the changes to the application to synchronize the Package changes to view mode.
38+
39+
:::caution
40+
If you don't redeploy or commit after updating a Package, the changes will only be visible in edit mode. The deployed (view mode) version of your application will continue to use the previous Package version until you redeploy or commit.
41+
:::
42+
43+
## Importing Git-Connected Apps with Packages
44+
45+
When moving a Git-connected application that uses Packages to a new workspace or instance, it's important to follow the correct sequence to ensure the application can properly detect and use its Package dependencies.
46+
47+
### Migration Steps
48+
49+
Follow these steps in order when importing a Git-connected application that uses Packages:
50+
51+
1. **Move Packages first**: Import or create the Packages that the application uses in the target workspace or instance. If you're moving to a different instance, you may need to export and import Packages, or recreate them in the new instance. Ensure all Package dependencies are available before importing the application.
52+
53+
2. **Publish Packages**: Publish the Packages in the new workspace or instance to make them available. For non Git-connected Packages, a publish is required to make them available in the new workspace or instance. For Git-connected Packages, they are already published and released as a particular version, so publish is not required.
54+
55+
3. **Import the Git-connected application**: After the Packages are set up and published, import the Git-connected application. The application will immediately detect the available Packages based on their names and structure. Ensure that Package names match exactly between the source and target workspaces or instances for proper detection.
56+
57+
4. **If the application was imported first**: If you import the Git-connected application before setting up the required Packages, the application will not detect the Packages and may throw errors. To resolve this, import the packages in the workspace or instance, publish them if they are non Git-connected Packages, then navigate to the application in edit mode, open the Git modal, and click **Redeploy** to synchronize the Package changes to the application's view mode.
58+
59+
## CI/CD with Git-Connected Apps and Packages
60+
61+
When using Continuous Integration and Continuous Delivery (CI/CD) with Git-connected applications that use Packages, there are different considerations depending on whether the Packages are Git-connected or not.
62+
63+
### Non Git-Connected Packages
64+
65+
For non Git-connected Packages, CI/CD will not automatically handle Package updates. You still need to follow the manual steps mentioned in [Synchronizing Package Updates](#synchronizing-package-updates) to update the Packages and applications using them.
66+
67+
### Git-Connected Packages
68+
69+
For Git-connected Packages, CI/CD will continue to work as expected, but you need to ensure that the Package already exists in the application's workspace. Follow the steps mentioned in [Migration Steps](#migration-steps) to set up the Package in the workspace before the CI/CD process runs.
70+
71+
### Prerequisites for CI/CD
72+
73+
In both scenarios, the expectation is to:
74+
75+
1. Import the packages if it is not already present in the application's workspace.
76+
2. Merge the commits to the `master` branch of the application to initiate the CI/CD process.
77+
78+
### Resolving CI/CD Failures
79+
80+
If CI/CD fails because a new Package is not present in the workspace, follow these steps to resolve it:
81+
82+
1. Import the Package in the application's workspace.
83+
2. If it is a non Git-connected Package, publish it to make it available.
84+
3. Then redeploy the application by either of the below steps:
85+
- **Rerun the failed CI/CD workflow** to automatically deploy the application with the newly imported Package.
86+
- Navigate to the application in **edit mode**, open the Git modal, and click **Redeploy** to synchronize the changes to the view mode.
87+
88+
## See also
89+
90+
- [Package Version Control](/packages/reference/versioning)
91+
- [Continuous Delivery (CI/CD) with Git](/advanced-concepts/version-control-with-git/cd-with-git)
92+
- [Git Best Practices](/advanced-concepts/version-control-with-git/merging-branches)
93+

website/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ const sidebars = {
798798
label: 'Reference',
799799
items: [
800800
'packages/reference/versioning', // Package Version Control
801+
'packages/reference/best-practices-git-packages',
801802
{
802803
type: 'category',
803804
label: 'Code Packages',
106 KB
Loading
120 KB
Loading

0 commit comments

Comments
 (0)