Skip to content

Instantly share code, notes, and snippets.

@cadecairos
Last active November 19, 2015 22:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cadecairos/7767a3b5a4b768c0d5ba to your computer and use it in GitHub Desktop.
Save cadecairos/7767a3b5a4b768c0d5ba to your computer and use it in GitHub Desktop.
Instant Webmaker API+ID+LOGINAPI services using Docker Compose
webmaker:
image: cade/webmaker-api:latest
env_file: compose.webmaker.env
net: "host"
id:
image: cade/webmaker-id:latest
env_file: compose.id.env
net: "host"
loginapi:
image: cade/legacy-webmaker-login:latest
env_file: compose.loginapi.env
net: "host"

TL;DR;

It's not quite instant, but it's easier!

  1. Install docker and docker-compose using the website or your preferred package management system.
  2. Copy the docker-compose.yml file above somewhere on your machine
  3. Set up databases (sorry, working on this, see below for details)
  4. Create your .env files - default envs from each service should be fine. (see below)
  5. run docker-compose up - The first run will take a bit, as it will need to fetch the images from docker hub, but subsequent startup times will be really quick!

DB setup

At this time you'll still need to run postgres & redis (webamker-api, webmaker-id) and mysql (loginapi) on your host machine. I'll be attempting to add in preconfigured pg, redis and mysql docker containers soon

ID

get this script and run:

# create a database; -U and -W are only necessary if your pg instance needs authentication
createdb -U dbusername -W dbuserpassword webmaker_oauth

# create tables; -U and -W are only necessary if your pg instance needs authentication
psql -U dbusername -W dbuserpassword -d webmaker_oauth -f create-tables.sql
Webmaker api

get this script

# create a database; -U and -W are only necessary if your pg instance needs authentication
createdb -U dbusername -W dbuserpassword webmaker

# create tables; -U and -W are only necessary if your pg instance needs authentication
psql -U dbusername -W dbuserpassword -d webmaker -f scripts/create-tables.sql
Loginapi

By default it uses sqlite, but I haven't tested that. To use mysql you'll just have to ensure that there's a database created on the mysql server matching your configuration settings, as it will automatically create the schema if it doesn't exist.

Environments

You'll need three .env files, compose.id.env, compose.webmaker.env, and compose.loginapi.env each containing the specific environment variables you'd like to use for each app. Here's links to the app READMEs:

put the environment files in the same directory as the docker-compose.yml file.

To start everything up run docker-compose up

Your're done. \o/ Develop whatever apps/sites you need that could depend on these services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment