Deploy from GitHub to a VPS, then redeploy on every push.
To deploy from GitHub to a VPS with Opslin, connect the server with one command, connect GitHub, import the repository and press Deploy. After that, a push to the same branch deploys the new version.
- You need
- A Linux server and a GitHub repository
- Deploys on
- A button press, then every push to the branch
- No need for
- SSH keys stored in GitHub or a workflow file
- Free plan
- Works, with a temporary Opslin address
Who is this guide for?
You keep your code on GitHub and want it running on your own Linux server, without SSH deploy scripts, workflow files or web server configuration.
What you need
- A Linux server you control, with root or sudo: Ubuntu, Debian, Fedora, Alpine or Arch, on 64-bit x86 or ARM.
- At least 1.5 GB of free disk to install the agent. 5 GB or more is comfortable.
- About 1 GB of memory or more. Smaller servers may run out of memory during a build.
- Outbound HTTPS (port 443). Open inbound ports 80 and 443 so visitors and SSL certificates can reach your app.
- A GitHub repository, and permission to install a GitHub app on its account.
- An Opslin account with a verified email. The Free plan covers 1 server and 2 apps.
What do you set up by hand, and what does Opslin do?
| Task | A usual do-it-yourself setup | With Opslin |
|---|---|---|
| Connect GitHub and the server | Create an SSH key and store it as a GitHub secret, or run a webhook script | Install the GitHub app; the server agent connects out |
| Deploy on push | Write and maintain a workflow file | Push to the app's branch |
| Build and run | Install the language runtime and a process manager | Built and run in Docker on your server |
| Web address and HTTPS | Configure a web server and request certificates | A temporary address with SSL, or your own domain with one DNS record |
| A release that will not start | Log in and restore the old version | For a single app, the old version keeps serving |
| Still your job | All of it | Your code, secrets, server updates, database changes and backups |
How do I deploy a GitHub repository to my VPS?
Six steps. The first two are needed only once.
Connect your server
In the dashboard, open
Servers, pressAdd serverand chooseRun one command. Copy the command it shows, open a terminal on your server and paste it.The installer needs administrator rights. If you do not log in as root, it must run with
sudo; choose your provider on that screen to get the right command.It installs Docker if needed and starts the Opslin agent, which connects out to Opslin. If the terminal prints a link to verify the server, open it while signed in. The link works for 1 hour.
Choose a method, then run the command your dashboard shows. Check the agent on your server (systemd)sudo systemctl status opslin-agent --no-pagerPrefer not to use a terminal? The connect screen also offers a password or SSH key login, and an AWS account connection for EC2.
Connect GitHub
Open
Appsand pressDeploy app. On theGitHubtab pressConnect GitHub, install the Opslin GitHub app on your account or organisation and choose which repositories it may use.The repositories then appear in the list.
Manage accesschanges the selection later.The GitHub tab lists the repositories you allowed. Import the repository and choose the server
Press
Importnext to the repository. Opslin opens a review screen.Check the project name, pick your server and read any warning before you go on.
Name the project, pick your server and press Deploy. Add environment variables
Add the settings your app needs, such as an API address or a database URL, with
Add variablebefore you deploy. Keep them out of the repository.You can change them later in the app's
Environmenttab, then pressSave and redeploy.Add values in the dashboard instead of committing them. Press Deploy and watch the release
Press
Deploy. Your server fetches the code, builds it, starts the new version and checks that it responds before sending visitors to it.You can leave the page and the deploy keeps going. When it finishes, the app shows as
Live.The new version takes traffic only after its health check passes. Push to deploy the next version
Commit and push to the branch you chose. Opslin receives the push through the GitHub app and deploys that commit.
To test before going live, open the app's
Deploymentstab and changeDeploy mode.Fastgoes live as soon as the build is ready. The safer modes run your tests first and depend on your plan.Send your changes (use your branch name)git push origin main
How do I know it worked?
- The app shows
Live, and its address opens in your browser. - The
Deploymentstab marks the new releaseCurrent. - The
Logstab showsruntimeoutput without errors, and thebuildoutput of the release.
curl -I https://shop.example.comHow do I add my own domain with HTTPS?
Add the domain in the app, create one A record at your domain provider and let Opslin check it.
Open the app, go to
Domains, pressAdd domainand type the name withouthttps://.At your DNS provider, add the
Arecord the dashboard shows: the name (@for the root domain) and your server's IP address.Opslin checks every minute, and
Verify domainchecks now. It usually takes under 10 minutes.Opslin then requests a free Let's Encrypt certificate. Ports 80 and 443 must be open.
Retry HTTPStries again.
dig +short shop.example.comCustom domains on server apps need the Starter plan or higher. The Free plan gives each app a temporary Opslin address with SSL. Compare plans.
How do I roll back a bad release?
Open the app's Deployments tab, press Roll back next to an earlier successful release and confirm.
Opslin deploys that version again and re-applies your domain. The release you replaced stays in the history. Rolling back changes your code, not the data or structure of your database.
| Plan | Free | Starter | Pro | Business |
|---|---|---|---|---|
| Rollback | Limited | Last release | Any release | Any release |
What can go wrong, and how do I fix it?
Git repository could not be cloned
- What it means
- Opslin could not read the repository or the branch.
- Fix
- Check that the repository is selected for the Opslin GitHub app, that the branch exists and that the app was not removed on GitHub.
A push did not start a deploy
- What it means
- Push deploys work for apps added from the GitHub tab, on the branch the app uses.
- Fix
- Check the branch you pushed. An app added with a Git URL does not deploy on push. If you use a safer deploy mode, Opslin waits for your tests to pass.
Build command failed
- What it means
- The code was fetched, but installing packages or building ended with an error.
- Fix
- Open
Logs, switch tobuildand fix the first error. Run the same build on a clean copy on your computer, then commit and push.
Container crashed before health check
- What it means
- The app exited before Opslin could reach it.
- Fix
- Open
Logsand read the runtime output. Common reasons are a wrong start file, a missing dependency or a missing environment variable.
App not listening on port
- What it means
- The app started, but nothing answered on the port Opslin expects.
- Fix
- Listen on
0.0.0.0, notlocalhost, and use thePORTenvironment variable.
Required environment variable is missing
- What it means
- The app started without a value it needs.
- Fix
- Add it in the app's
Environmenttab and pressSave and redeploy.
Server is out of disk space
- What it means
- Docker could not write the build to disk.
- Fix
- See what is using the space and free some on the server, then deploy again.
Free disk spacedf -h /Space used by Dockerdocker system dfAgent disconnected
- What it means
- Opslin could not reach the agent on your server.
- Fix
- Check that the server is on and the agent is running, then deploy again.
Agent status (systemd)sudo systemctl status opslin-agent --no-pagerRecent agent logs (systemd)sudo journalctl -u opslin-agent -n 80 --no-pager
What should I do next?
- Node.js appsStart file, port and health check for a smooth first release.Node.js guide
- Next.js appsBuild modes and environment variables.Next.js guide
- How releases workWhat the server does between your push and a live app.How it works
Questions people ask
Do I need GitHub Actions to deploy to my VPS?
No. The Opslin GitHub app tells Opslin about a push and your server builds it. GitHub Actions is only used if you choose to run tests there before a release.
Does Opslin need SSH access to my server?
Not with the one-command method: the agent on your server connects out to Opslin. If you choose the password or SSH key method, the login is used for the install and is not stored.
Can I deploy a private repository?
Yes. Select it when you install the Opslin GitHub app. The Git URL tab is for public repositories.
Can I use GitLab or another Git host?
You can deploy a public HTTPS Git address from the Git URL tab. Deploying on push works with GitHub.
What happens if a new version fails to start?
For a single app, Opslin removes the new version and the previous one keeps serving. The dashboard shows why the release failed.
Is it free to deploy from GitHub to my own server?
The Free plan covers 1 server and 2 apps that you own, with deploys from GitHub. Custom domains on server apps need the Starter plan or higher. You pay your server provider separately. See pricing
Related pages
Try it with your own project.
- Free plan: 1 server and 2 apps
- Your server or your Cloudflare account