Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic updates println #4

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.aes
dockercfg
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# base on latest ruby base image
FROM ruby:2.5.0

# install dependencies
RUN apt-get update && apt-get install -y build-essential libpq-dev nodejs apt-utils

# declare /app as working directory of image
WORKDIR /app

# copy over Gemfile and Gemfile.lock to image's working directory, then run `bundle install`
COPY Gemfile Gemfile.lock ./
RUN bundle install --jobs 20 --retry 5

# copy all remaining files/folders in project directory to the container
COPY . /app
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Gemfile
source 'https://rubygems.org'

ruby '2.5.0'

gem 'redis'
gem 'pg'
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
GEM
remote: https://rubygems.org/
specs:
pg (1.1.4)
redis (4.1.0)

PLATFORMS
ruby

DEPENDENCIES
pg
redis

RUBY VERSION
ruby 2.5.0p0

BUNDLED WITH
1.16.1
18 changes: 18 additions & 0 deletions check.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require "redis"
require "pg"

def exit_if_not(expected, current)
puts "Expected: #{expected}"
puts "Current: #{current}"
exit(1) if expected != current
end

puts "Redis"
redis = Redis.new(host: "redis")
puts "REDIS VERSION: #{redis.info["redis_version"]}"

sleep 4
postgres_username = "postgres"
postgres_password = ""
test = PG.connect("postgres", 5432, "", "", "postgres", postgres_username, postgres_password)
puts test.exec("SELECT version();").first["version"]
14 changes: 14 additions & 0 deletions codeship-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
demo:
build:
image: myapp
dockerfile: Dockerfile
depends_on:
- redis
- postgres
environment:
TEST_TOKEN: Testing123
redis:
image: healthcheck/redis:alpine
postgres:
image: healthcheck/postgres:alpine

20 changes: 20 additions & 0 deletions codeship-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- name: ruby
service: demo
command: bundle exec ruby check.rb
- type: parallel
steps:
- name: checkrb
service: demo
command: bundle exec ruby check.rb
- name: test
service: demo
command: bundle exec ruby test.rb

- type: serial
steps:
- name: dockerhub_push
service: demo
type: push
image_name: petrasargent/get-started
registry: https://index.docker.io/v1/
encrypted_dockercfg_path: dockercfg.encrypted
2 changes: 2 additions & 0 deletions dockercfg.encrypted
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
codeship:v2
KtdVV0Sx3sjP1vWyLDvtcIJkg+EdP5w/MpErOaojdjko7tTdyqx9u+Pg/YKU+Z+QHEFoujdjrakUeeiLZu2huo+jSDpZjFuYZAWSv/ch1o1k2tD6koQrbodo1StsY5XHfFqAWDoZvb/0YhsmF5qB+KMRi0dNmXucXaSxemUkAm1YIilH/Fp9hYpwhlerqKLTg0HyUcT88XbAnxxQgEczVZCp9jLP1ldMs0qoMId9MrpTVH6yu8qBE1d+Uh2HMVSH1DTkejZ27ECYNg==
13 changes: 7 additions & 6 deletions helloWorkshop.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
/* 9-12-12 */
class helloWorkshop {
public static void main(String[] args) {
System.out.println("Greetings Workshop!");
System.out.println("This is an example file");
System.out.println("Greetings Everyone!");
System.out.println("This is example Java file");
System.out.println("for use in workshop exercises.");
System.out.println("This is on the master branch");
System.out.println("This file is written in Java.");
System.out.println("Isn't this exciting?");
System.out.println("Wow! This is amazing! I love to code!");
System.out.println("Isn't this exciting? Yes, it is!!");
System.out.println("Maybe?");
System.out.println("Okay then.");
System.out.println("Goodbye Workshop!");
System.out.println("Okay then. Talk to you later! Have a great weekend");
System.out.println("Goodbye Workshop! Good Luck! See you soon. Hasta La Vista, baby");
}
}
}
7 changes: 7 additions & 0 deletions test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if ENV['TEST_TOKEN'].nil?
puts "Our Variable Is Not Working"
exit 1
else
puts "Our Variable Is Working"
exit 0
end