mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-09 15:38:03 -05:00
72 lines
2.6 KiB
Plaintext
72 lines
2.6 KiB
Plaintext
---
|
|
title: 'Developing'
|
|
description: 'This guide will help you set up and run Infisical in development mode.'
|
|
---
|
|
|
|
## Clone the repo
|
|
|
|
```bash
|
|
# change location to the path you want Infisical to be installed
|
|
cd ~
|
|
|
|
# clone the repo and cd to Infisical dir
|
|
git clone https://github.com/Infisical/infisical
|
|
cd infisical
|
|
```
|
|
|
|
## Set up environment variables
|
|
|
|
Start by creating a .env file at the root of the Infisical directory. It's best to start with the provided [`.env.example`](https://github.com/Infisical/infisical/blob/main/.env.example) template containing the necessary envars to fill out your .env file — you only have to modify the SMTP parameters.
|
|
|
|
<Warning>
|
|
The pre-populated environment variable values in the `.env.example` file are meant to be used in development only.
|
|
You'll want to fill in your own values in production, especially concerning encryption keys, secrets, and SMTP parameters.
|
|
</Warning>
|
|
|
|
Refer to the [environment variable list](https://infisical.com/docs/self-hosting/configuration/envars) for guidance on each envar.
|
|
|
|
### Helpful tips for developing with Infisical:
|
|
|
|
<Tip>
|
|
Use the `ENCRYPTION_KEY`, JWT-secret envars, `MONGO_URL`, `MONGO_USERNAME`, `MONGO_PASSWORD` provided in the `.env.example` file.
|
|
|
|
If setting your own values:
|
|
|
|
- `ENCRYPTION_KEY` should be a [32-byte random hex](https://www.browserling.com/tools/random-hex)
|
|
- `MONGO_URL` should take the form: `mongodb://[MONGO_USERNAME]:[MONGO_PASSWORD]@mongo:27017/?authSource=admin`.
|
|
</Tip>
|
|
|
|
<Tip>
|
|
Bring and configure your own SMTP server by following our [email configuration guide](https://infisical.com/docs/self-hosting/configuration/email) (we recommend using either SendGrid or Mailgun).
|
|
|
|
Alternatively, you can use the provided development (Mailhog) SMTP server to send and browse emails sent by the backend on http://localhost:8025; to use this option, set the following `SMTP_HOST`, `SMTP_PORT`, `SMTP_FROM_NAME`, `SMTP_USERNAME`, `SMTP_PASSWORD` below.
|
|
</Tip>
|
|
|
|
```
|
|
SMTP_HOST=smtp-server
|
|
SMTP_PORT=1025
|
|
SMTP_FROM_ADDRESS=team@infisical.com
|
|
SMTP_FROM_NAME=Infisical
|
|
SMTP_USERNAME=team@infisical.com
|
|
SMTP_PASSWORD=
|
|
```
|
|
|
|
<Warning>
|
|
If using Mailhog, make sure to leave the `SMTP_PASSWORD` blank so the backend can connect to MailHog.
|
|
</Warning>
|
|
|
|
## Docker for development
|
|
|
|
```bash
|
|
# build and start the services
|
|
docker-compose -f docker-compose.dev.yml up --build --force-recreate
|
|
```
|
|
|
|
Then browse http://localhost:8080
|
|
|
|
```bash
|
|
# To stop environment use Control+C (on Mac) CTRL+C (on Win) or
|
|
docker-compose -f docker-compose.dev.yml down
|
|
# start services
|
|
docker-compose -f docker-compose.dev.yml up
|
|
``` |