mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-07 22:53:55 -05:00
202 lines
8.0 KiB
Plaintext
202 lines
8.0 KiB
Plaintext
---
|
|
title: "Standalone"
|
|
description: "Learn how to deploy Infisical in a standalone environment."
|
|
---
|
|
|
|
# Self-Hosting Infisical with Standalone Infisical
|
|
|
|
Deploying Infisical in a standalone environment is a great way to get started with Infisical without having to use containers. This guide will walk you through the process of deploying Infisical in a standalone environment.
|
|
This is one of the easiest ways to deploy Infisical. It is a single executable, currently only supported on Debian-based systems.
|
|
|
|
The standalone deployment implements the "bring your own database" (BYOD) approach. This means that you will need to provide your own databases (specifically Postgres and Redis) for the Infisical services to use. The standalone deployment does not include any databases.
|
|
|
|
If you wish to streamline the deployment process, we recommend using the Ansible role for Infisical. The Ansible role automates the end to end deployment process, and will take care of everything like databases, redis deployment, web serving, and availability.
|
|
- [Automated Deployment with high availability (HA)](/self-hosting/deployment-options/native/high-availability)
|
|
|
|
|
|
## Prerequisites
|
|
- A server running a Debian-based operating system (e.g., Ubuntu, Debian)
|
|
- A Postgres database
|
|
- A Redis database
|
|
|
|
## Installing Infisical
|
|
Installing Infisical is as simple as running a single command. You can install Infisical by running the following command:
|
|
|
|
```bash
|
|
$ curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-core/cfg/setup/bash.deb.sh' | sudo bash && sudo apt-get install -y infisical-core
|
|
```
|
|
|
|
## Running Infisical
|
|
Running Infisical and serving it to the web has a few steps. Below are the steps to get you started with running Infisical in a standalone environment.
|
|
* Setup environment variables
|
|
* Running Postgres migrations
|
|
* Create system daemon
|
|
* Exposing Infisical to the internet
|
|
|
|
|
|
<Steps>
|
|
<Step title="Setup environment variables">
|
|
To use Infisical you'll need to configure the environment variables beforehand. You can acheive this by creating an environment file to be used by Infisical.
|
|
|
|
|
|
#### Create environment file
|
|
```bash
|
|
$ mkdir -p /etc/infisical && touch /etc/infisical/environment
|
|
```
|
|
|
|
After creating the environment file, you'll need to fill it out with your environment variables.
|
|
|
|
#### Edit environment file
|
|
```bash
|
|
$ nano /etc/infisical/environment
|
|
```
|
|
|
|
```bash
|
|
DB_CONNECTION_URI=postgres://user:password@localhost:5432/infisical # Replace with your Postgres database connection URI
|
|
REDIS_URL=redis://localhost:6379 # Replace with your Redis connection URI
|
|
ENCRYPTION_KEY=your_encryption_key # Replace with your encryption key (can be generated with: openssl rand -hex 16)
|
|
AUTH_SECRET=your_auth_secret # Replace with your auth secret (can be generated with: openssl rand -base64 32)
|
|
```
|
|
|
|
<Info>
|
|
The minimum required environment variables are `DB_CONNECTION_URI`, `REDIS_URL`, `ENCRYPTION_KEY`, and `AUTH_SECRET`. We recommend You take a look at our [list of all available environment variables](/docs/self-hosting/configuration/envars#general-platform), and configure the ones you need.
|
|
</Info>
|
|
</Step>
|
|
<Step title="Running Postgres migrations">
|
|
|
|
Assuming you're starting with a fresh Postgres database, you'll need to run the Postgres migrations to syncronize the database schema.
|
|
The migration command will use the environment variables you configured in the previous step.
|
|
|
|
|
|
```bash
|
|
$ eval $(cat /etc/infisical/environment) infisical-core migration:latest
|
|
```
|
|
|
|
<Info>
|
|
This step will need to be repeated if you update Infisical in the future.
|
|
</Info>
|
|
|
|
</Step>
|
|
|
|
<Step title="Create service file">
|
|
```bash
|
|
$ nano /etc/systemd/system/infisical.service
|
|
```
|
|
</Step>
|
|
<Step title="Create Infisical service">
|
|
|
|
Create a systemd service file for Infisical. Creating a systemd service file will allow Infisical to start automatically when the system boots or in case of a crash.
|
|
|
|
```bash
|
|
$ nano /etc/systemd/system/infisical.service
|
|
```
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=Infisical Service
|
|
After=network.target
|
|
|
|
[Service]
|
|
# The path to the environment file we created in the previous step
|
|
EnvironmentFile=/etc/infisical/environment
|
|
Type=simple
|
|
# Change the user to the user you want to run Infisical as
|
|
User=root
|
|
ExecStart=/usr/local/bin/infisical-core
|
|
Restart=always
|
|
RestartSec=30
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
Now we need to reload the systemd daemon and start the Infisical service.
|
|
|
|
```bash
|
|
$ systemctl daemon-reload
|
|
$ systemctl start infisical
|
|
$ systemctl enable infisical
|
|
```
|
|
|
|
<Info>
|
|
You can check the status of the Infisical service by running `systemctl status infisical`.
|
|
It is also a good idea to check the logs for any errors by running `journalctl --no-pager -u infisical`.
|
|
</Info>
|
|
</Step>
|
|
<Step title="Exposing Infisical to the internet">
|
|
Exposing Infisical to the internet requires setting up a reverse proxy. You can use any reverse proxy of your choice, but we recommend using HAProxy or Nginx. Below is an example of how to set up a reverse proxy using HAProxy.
|
|
|
|
#### Install HAProxy
|
|
```bash
|
|
$ apt-get install -y haproxy
|
|
```
|
|
|
|
#### Edit HAProxy configuration
|
|
```bash
|
|
$ nano /etc/haproxy/haproxy.cfg
|
|
```
|
|
|
|
```ini
|
|
global
|
|
log /dev/log local0
|
|
log /dev/log local1 notice
|
|
chroot /var/lib/haproxy
|
|
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
|
|
stats timeout 30s
|
|
user haproxy
|
|
group haproxy
|
|
daemon
|
|
|
|
defaults
|
|
log global
|
|
mode http
|
|
option httplog
|
|
option dontlognull
|
|
timeout connect 5000
|
|
timeout client 50000
|
|
timeout server 50000
|
|
|
|
frontend http-in
|
|
bind *:80
|
|
default_backend infisical
|
|
|
|
backend infisical
|
|
server infisicalapp 127.0.0.1:8080 check
|
|
```
|
|
|
|
<Warning>
|
|
If you decide to use Nginx, then please be aware that the configuration will be different. **Infisical listens on port 8080**.
|
|
</Warning>
|
|
|
|
#### Restart HAProxy
|
|
```bash
|
|
$ systemctl restart haproxy
|
|
```
|
|
|
|
</Step>
|
|
</Steps>
|
|
|
|
And that's it! You have successfully deployed Infisical in a standalone environment. You can now access Infisical by visiting `http://your-server-ip`.
|
|
|
|
<Note>
|
|
Please take note that the Infisical team cannot provide infrastructure support for **free self-hosted** deployments.<br/>If you need help with infrastructure, we recommend upgrading to a [paid plan](https://infisical.com/pricing) which includes infrastructure support.
|
|
|
|
You can also join our community [Slack](https://infisical.com/slack) for help and support from the community.
|
|
</Note>
|
|
|
|
## Troubleshooting
|
|
|
|
<Accordion title="I'm getting a error related to the HAProxy (Missing LF on last line, file might have been truncated at position X)">
|
|
This is a common issue related to the HAProxy configuration file. The error is caused by the missing newline character at the end of the file. You can fix this by adding a newline character at the end of the file.
|
|
|
|
```bash
|
|
$ echo "" >> /etc/haproxy/haproxy.cfg
|
|
```
|
|
</Accordion>
|
|
<Accordion title="I'm unable to connect to access the Infisical instance on the web">
|
|
This issue can be caused by a number of reasons, mostly realted to the network configuration. Here are a few things you can check:
|
|
1. Ensure that the firewall is not blocking the connection. You can check this by running `ufw status`. Ensure that port 80 is open.
|
|
2. If you're using a cloud provider like AWS or GCP, ensure that the security group allows traffic on port 80.
|
|
3. Ensure that the HAProxy service is running. You can check this by running `systemctl status haproxy`.
|
|
4. Ensure that the Infisical service is running. You can check this by running `systemctl status infisical`.
|
|
</Accordion> |