Skip to content

Instantly share code, notes, and snippets.

@mrw34
Last active May 24, 2017 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrw34/d60fa30a08c864286e819647fc0eaac2 to your computer and use it in GitHub Desktop.
Save mrw34/d60fa30a08c864286e819647fc0eaac2 to your computer and use it in GitHub Desktop.
docker run -d --name postgres -v postgres:/var/lib/postgresql/data postgres:9-alpine

docker run --rm -i --link postgres postgres:9-alpine psql -h postgres -U postgres <<EOF
create table employees (emp_no integer, first_name varchar, last_name varchar);
insert into employees values (0, 'John', 'Smith'), (1, 'Jane', 'Doe');
EOF

docker build -t insights .

docker run -it --rm -w /insights -v $PWD/run.sh:/run.sh -v $PWD/insights.yml:/insights.yml -v insights:/insights/db -p 3300:3300 -p 3350:3350 --link postgres insights bash /run.sh

open http://localhost:3300/
FROM centos:7
COPY install.sh /
RUN bash install.sh
---
Employee:
enabled: true
table_name: employees
columns:
emp_no:
type: :number
first_name:
type: :string
last_name:
type: :string
custom: {}
links:
incoming: {}
outgoing: {}
#!/bin/bash
set -e -o pipefail
curl https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz | tar xJ -C /usr/local/bin --strip-components=2 wkhtmltox/bin/wkhtmltopdf
yum install -y postgresql-devel sqlite-devel git which libXrender libXext xorg-x11-fonts-Type1
yum install -y centos-release-scl
yum install -y rh-ruby23 rh-ruby23-ruby-devel rh-nodejs4
git clone https://github.com/mariusandra/insights
cd insights/
. /opt/rh/rh-ruby23/enable
gem install bundler
bundle
. /opt/rh/rh-nodejs4/enable
npm install -g yarn
yarn
cp config/database.yml.example config/database.yml
bundle exec rake db:create
bundle exec rake db:schema:load
cat <<EOF >config/initializers/insights.rb
INSIGHTS_EXPORT_PATH = '/insights.yml'
INSIGHTS_TIMEZONE = 'Europe/London'
INSIGHTS_DATABASE = {
adapter: 'postgresql',
host: 'postgres',
database: 'postgres',
username: 'postgres'
}
INSIGHTS_LOGIN = false
EOF
#!/bin/bash
set -e -o pipefail
. /opt/rh/rh-ruby23/enable
. /opt/rh/rh-nodejs4/enable
bundle exec foreman start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment