We have published this image on docker-hub.
docker pull unleashorg/unleash-server:3.4
docker run -d -e DATABASE_URL=postgres://user:[email protected]:5432/unleash unleashorg/unleash-server
Specifying secrets as environment variables are considered a bad security practice. Therefore, you can instead specify a file where unleash can read the database secret. This is done via the DATABASE_URL_FILE
environment variable.
#######################################################
# Database Connection
#######################################################
# Database to connection string
DATABASE_URL: postgres://postgres:unleash@db/postgres
#######################################################
# Google Oauth
# create an oauth credential here: https://console.developers.google.com/apis/credentials
#######################################################
# Google client id for oauth
GOOGLE_CLIENT_ID: # insert your id here
GOOGLE_CLIENT_SECRET: # insert your secret here
# Callback url, should end in 'api/auth/callback'. In this example, the
# BASE_URI_PATH is unleash, so the url is:
# <my domain>/<BASE_URI_PATH>/api/auth/callback
GOOGLE_CALLBACK_URL: https://mywebsite.com/unleash/api/auth/callback
# Regular expression to check for valid email addresses. If you want to
# simply list explicit emails consider something like this:
# ^(alice@mywebsite\.com|bob@mywebsite\.com|charlie@mywebsite\.com)$
ALLOWED_USERS_REGEX: ^[email protected]$
# A shared secret that is required to use api from the an sdk, see the example below
SHARED_SECRET: asdfasdf
# base uri to serve the service. Useful if this is behind a reverse proxy or load balancer.
BASE_URI_PATH: /unleash
## Which port to listen on
PORT: 4242
# JSON string, which will be decoded, and used to wait for services to be ready
WAIT_ON: ["tcp:postgres:5432"]
const { initialize } = require("unleash-client");
const initializeUnleash = () =>
new Promise((resolve, reject) => {
const instance = initialize({
url: `https://mywebsite.com/unleash/api`,
appName: "my app",
instanceId: "app",
});
instance.on("error", (error) => {
console.error('Error connecting', error)
// reject(error) // You could reject this if you wanted, but there may be errors unrelated to registered.
});
instance.on("registered", (clientData) => {
resolve(instance);
});
});
Start by cloning this repository.
We have set up docker-compose
to start postgres and the unleash server together. This makes it really fast to start up
unleash locally without setting up a database or node.
$ npm run dev
- copy the oauth example file.
$ cp docker-compose.google.example.yml docker-compose.google.yml
- expose port 8080 to the internet. I use ngrok
$ ngrok http 8080 # this should output something like https://20ae209752e23.ngrok.io
- Create your own oauth credentials. use your ngrok url + '/api/auth/callback' for the callback, EG: https://20ae209752e23.ngrok.io/api/auth/callback
- add your oauth information to docker-compose.google.yml
- Start the server locally using docker-compose
$ npm run dev:google
- You should be able to login using google.
We are using docker-compose version 3.3 and it requires:
- Docker engine 17.06.0+
- Docker compose 1.14.0+
For more info, check out the compatibility matrix on Docker's website: compatibility-matrix
When we upgrade the unleash-version
this project should be tagged with the same version number.
git tag -a 3.4.2 -m "upgrade to unleash-server 3.4.2"
git push origin master --follow-tags
You might also want to update the minor tag:
git tag -d 3.4
git push origin :3.4
git tag -a 3.4 -m "Update 3.4 tag"
git push origin master --follow-tags
This will automatically trigger docker-hub to build the new tag.