Skip to content

Commit

Permalink
Existing codebase without secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
c01kl9 committed Apr 15, 2019
0 parents commit 3862dbf
Show file tree
Hide file tree
Showing 449 changed files with 11,411 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src/tmp
src/tmp/*
src/public/uploads
src/public/uploads/*
src/log
src/log/*
.env

54 changes: 54 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Build on top of latest ruby-slim container
FROM ruby:slim

MAINTAINER Team Charlie <[email protected]>

# Set up proxy settings
ARG http_proxy
ARG https_proxy
ENV http_proxy=$http_proxy
ENV https_proxy=$https_proxy

# Set up proxy for the debian package manager
RUN echo 'Acquire::http::Proxy "'$http_proxy'";' > /etc/apt/apt.conf

#######################
# Install dependencies
#######################
ENV LANG C.UTF-8

RUN apt-get update -qy
RUN apt-get upgrade -y
RUN apt-get update -qy
RUN apt-get install -y build-essential

# for postgres
RUN apt-get install -y libpq-dev

# for a JS runtime
RUN apt-get install -y nodejs

# For ffi-1.9.18 gem
RUN apt-get install -y curl

# For image conversion
RUN apt-get install -y imagemagick

# Create the server direcotory in the container
RUN mkdir -p /lacr-search
WORKDIR /lacr-search

# Add source files in the container
ADD src/Gemfile /lacr-search/Gemfile
ADD src/Gemfile.lock /lacr-search/Gemfile.lock

# Install requered gems
RUN bundle install


# Disable the proxy settings.
# Otherwise ruby will try to connect to the other containers
# via this proxy.
RUN echo '' > /etc/apt/apt.conf
ENV http_proxy=''
ENV https_proxy=''
47 changes: 47 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: '2'

services:
xmldb:
image: basex/basexhttp:latest
restart: unless-stopped
ports:
- 1984
- 8984
db:
image: postgres:latest
restart: unless-stopped
expose:
- 5433
- 5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}

es:
image: elasticsearch:latest
restart: unless-stopped
expose:
- 9200

web:
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
args:
- http_proxy
- https_proxy

command: bundle exec rails s -p 80 -b '0.0.0.0'
volumes:
- ./src:/lacr-search
environment:
BASEX_ADMIN: ${BASEX_ADMIN}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}

ports:
- "80:80"
depends_on:
- es
- db
- xmldb
28 changes: 28 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Description: Shell-script to start rails server

# To romove created containers execute "docker-compose down"

read -r -p "Install new packages or gems? (Needed only for initial setup) [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
docker-compose build
fi

#read -r -p "Open bash in the Ruby container? (Used for testing) [y/N] " response
#if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
#then
# docker-compose start
# docker exec -it lacrsearch_web_1 bash
# docker-compose stop
# exit
#fi

read -r -p "Reset database? (Needed only for initial setup) [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
docker-compose run web bash -c "rails db:drop && rails db:create && rails db:migrate && rails db:seed"
fi
echo ''
echo 'Starting containers ....'
docker-compose up
65 changes: 65 additions & 0 deletions src/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
source 'https://rubygems.org'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end

gem 'rspec'
gem 'lograge'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
# Use PostgreSQL as the database for Active Record
gem 'pg'
# Use Puma as the app server
gem 'puma'
# Use SCSS for stylesheets
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
gem 'coffee-rails'
gem 'jquery-rails' # Use jquery as the JavaScript library
gem 'jquery-ui-rails' # Add JavaScript for UI

# Additional gems
# Ruby Gem of the Bootstrap
gem 'less-rails' # Javascript runtime
gem 'twitter-bootstrap-rails'
gem "font-awesome-rails"

gem 'carrierwave' # File upload
gem 'groupdate' # Simple way to group by: day, week, etc.
gem 'rubyzip' # Zip files for download
gem 'mini_magick' # Image resizing
gem 'prawn' # PDF file generator
gem 'will_paginate-bootstrap' # Pagination library

# API for Elasticsearch
gem 'searchkick'
gem 'oj' # Significantly increase performance with faster JSON generation.
gem 'typhoeus' # Significantly increase performance with persistent HTTP connections

#User Authentication
gem 'devise'
gem 'devise-bootstrap-views'

group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'byebug'
end

group :test do
gem 'cucumber-rails', :require => false
# database_cleaner is not required, but highly recommended
gem 'database_cleaner'
# for testing JavaScript, require older version selenium and firefox version 47.0.1 for more info check:
# https://github.com/teamcapybara/capybara#drivers
gem 'selenium-webdriver', '~> 2.53.4'
end
Loading

0 comments on commit 3862dbf

Please sign in to comment.