- Docs
- NSIN CLOUD
Deploy from Hamgit
Connect Hamgit to NSIN CLOUD once. Then every push to your branch builds and deploys your app.
On this page
Connect your Hamgit account once. Then pick a repository, and every push to its branch builds and deploys the app, usually within seconds.
Hamgit (hamgit.ir) is a GitLab server, so it works the same way as GitLab.
Before you start
- You need a Hamgit account that can read the repository.
- For deploy on every push, NSIN CLOUD adds a push hook to the repository. In a group (team) project, that needs the Maintainer role. Without it the app still deploys, but NSIN CLOUD checks for new commits every 3 minutes instead (see below).
- The repository needs a
Dockerfile, or a Node, Python, Go or PHP project that NSIN CLOUD can detect.
Connect Hamgit
- In the panel, open New app and click the Hamgit tile.
- Click Connect Hamgit.
- Click Open Hamgit token page. Sign in to Hamgit if it asks. The token name and the
apiscope are already filled in. - Keep only api ticked and pick an expiry date.
- Click Create personal access token and copy the token. It starts with
glpat-. Hamgit shows it only once. - Paste it in NSIN CLOUD and click Connect.
Your Hamgit projects, including your groups' projects, now show under the Hamgit tile. NSIN CLOUD stores the token encrypted and never shows it again.
Deploy a repository
- On New app, click Hamgit and pick the repository.
- Pick the branch to deploy, for example
mainordevelop. - Check the settings (port, size, environment variables) and click Deploy.
NSIN CLOUD builds the app, runs it and adds the push hook to the repository. You do not set anything up on Hamgit.
How a push deploys
- You push to the app's branch.
- Hamgit tells NSIN CLOUD about the push.
- NSIN CLOUD builds the new commit and replaces the running app. The old version keeps serving until the new one is ready.
Open the app's Deployments page to follow it. The Auto-deploy card at the top says how the app gets its pushes. A deploy started by a push shows the commit message.
Pushes to other branches are ignored. To deploy another branch, change it in the app's Settings, or make a second app for it, for example one app for develop and one for main.
Without the Maintainer role
If NSIN CLOUD cannot add the push hook, the Auto-deploy card says so. You have two choices:
- Let NSIN CLOUD check the branch. Every 3 minutes it looks for a new commit and deploys it. Nothing to set up.
- Ask a Maintainer to add the hook. Copy the hook URL from the Auto-deploy card. On Hamgit, they open the project's Settings → Webhooks, paste the URL, tick Push events and save. Treat the URL as a secret: anyone with it can deploy the app.
An app made from a repository URL and a token, instead of the Hamgit tile, works the same way: with a token that can manage hooks it gets a push hook, otherwise NSIN CLOUD checks the branch. Connecting Hamgit is the easier way.
GitOps with Hamgit
An infra repository on Hamgit works like one on GitLab. See GitOps.
- On the GitOps page, paste the repository URL, for example
https://hamgit.ir/your-team/infra, and the branch. - Paste a Hamgit token that can read it. The steps are the same as above.
- Click Link a repo.
NSIN CLOUD reads the infra repository every minute, so a push to it is applied within about a minute. In an app file, token_ref: infra clones the app's code with the infra repository's token. That works when the code is on the same Hamgit account.
When the token expires
When the token expires, NSIN CLOUD cannot clone your code, and new pushes fail to build. Apps that are running keep running.
- Make a new token on Hamgit, as above.
- Open Settings → Connections in the panel.
- Click Change token on your Hamgit connection and paste the new token.
Every app that uses the connection picks up the new token. Nothing needs to be deployed again.
If a push did not deploy
| What you see | What to do |
|---|---|
| Nothing on the Deployments page a minute after the push | Check that you pushed to the app's branch. On Hamgit, open the project's Settings → Webhooks and look at the hook's recent events. If Hamgit is late, the deploy starts when the event arrives, or within 3 minutes with the backup check on. |
| Auto-deploy says no push hook is set up | The token cannot manage hooks. Use a Maintainer's account, or one of the two choices under Without the Maintainer role. |
| The build fails while cloning | The token expired or lost access. Change it under Settings → Connections. |
| The build fails in a step of your Dockerfile | The error is in the deployment's log. Fix it in your code and push again. |