mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
3.3 KiB
3.3 KiB
id | title |
---|---|
getting_started | Getting Started |
This section only applies if you plan to self-host Unleash. If you are looking for our hosted solution you should head over to Unleash-hosted.com
Requirements
You will need:
- Node.js (version 12 or later)
- PostgreSQL (version 10 or later)
- Create an unleash user and database.
Start Unleash server
Whichever option you choose to start Unleash, you must specify a database URI (it can be set in the environment variable DATABASE_URL).
Once the server has started, you will see the message:
Unleash started on http://localhost:4242
Option one - from a terminal/bash shell
npm install unleash-server -g
unleash -d postgres://unleash_user:password@localhost:5432/unleash -p 4242
Option two - from Node.js
-
Create a new folder/directory on your development computer.
-
From a terminal/bash shell, install the dependencies:
npm init npm install unleash-server --save
-
Create a file called server.js, paste the following into it and save.
const unleash = require('unleash-server'); unleash .start({ databaseUrl: 'postgres://unleash_user:password@localhost:5432/unleash', port: 4242, }) .then(unleash => { console.log( `Unleash started on http://localhost:${unleash.app.get('port')}`, ); });
-
Run server.js:
node server.js
Option three - use Docker
Docker-compose
- Clone the unleash-docker repository.
- Run
docker-compose build
in repository root folder. - Run
docker-compose up
in repository root folder.
Manually
- Create a network by running
docker network create unleash
- Run
docker run -e POSTGRES_PASSWORD={INSERT_PASSWORD} -e POSTGRES_USER={INSERT_USER} -e POSTGRES_DB=unleash --network unleash --name postgres postgres
docker run -p 4242:4242 --network unleash -e DATABASE_URL=postgres://{INSERT_USER}:{INSERT_PASSWORD}@postgres:5432/unleash unleashorg/unleash-server
Test your server and create a sample API call
Once the Unleash server has started, go to localhost:4242 in your browser. If you see a list of example feature toggles, try modifying one of them with curl from a terminal/bash shell:
curl --location --request PUT 'http://localhost:4242/api/admin/features/Feature.A' --header 'Content-Type: application/json' --data-raw '{\
"name": "Feature.A",\
"description": "Dolor sit amet.",\
"type": "release",\
"enabled": false,\
"stale": false,\
"strategies": [\
{\
"name": "default",\
"parameters": {}\
}\
]\
}'\
Version check
- Unleash checks that it uses the latest version by making a call to https://version.unleash.run.
- This is a cloud function storing instance id to our database for statistics.
- This request includes a unique instance id for your server.
- If you do not wish to check for upgrades define the environment variable
CHECK_VERSION
to anything else other thantrue
before starting, and Unleash won't make any callsexport CHECK_VERSION=false