File tree Expand file tree Collapse file tree 8 files changed +68
-2
lines changed Expand file tree Collapse file tree 8 files changed +68
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ eshPipeline(
4141 },
4242 match_on_all_branches : true ,
4343 ],
44+ [
45+ name : ' Docker' ,
46+ type : ' script' ,
47+ script : {
48+ eshWithRbenv {
49+ sh ' make build-docker'
50+ }
51+ },
52+ match_on_all_branches : true ,
53+ ],
4454 [
4555 name : ' Packaging' ,
4656 type : ' script' ,
Original file line number Diff line number Diff line change 1+ FROM ubuntu:focal
2+
3+ WORKDIR /app
4+ COPY . /app
5+
6+ # installing all system dependencies, yq, ruby-build and rbenv
7+ RUN apt-get update && \
8+ apt-get install --yes --no-install-recommends uuid-runtime curl ca-certificates git make build-essential libssl-dev libreadline-dev zlib1g-dev && \
9+ rm -rf /var/lib/apt/lists/* && \
10+ curl -L https://github.com/mikefarah/yq/releases/download/v4.24.2/yq_linux_amd64.tar.gz | tar -xzvf - && mv yq_linux_amd64 /usr/bin/yq && \
11+ git clone https://github.com/rbenv/rbenv.git ~/.rbenv && \
12+ curl -L https://github.com/sstephenson/ruby-build/archive/v20220324.tar.gz | tar -zxvf - -C /tmp/ && \
13+ cd /tmp/ruby-build-* && ./install.sh
14+
15+ # set the env
16+ ENV PATH /root/.rbenv/bin:/root/.rbenv/shims:$PATH
17+ RUN echo 'eval "$(rbenv init -)"' >> .bashrc
18+ RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh # or /etc/profile
19+
20+ # run the make file to generate an api key an install the app
21+ RUN make install api_key
22+
23+
24+ EXPOSE 9292
25+ CMD ["make" , "run" ]
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ gem 'bundler', '2.2.33'
99gem 'activesupport' , '5.2.6'
1010gem 'bson' , '~> 4.2.2'
1111gem 'mime-types' , '= 3.1'
12+ gem 'tzinfo-data' , '= 1.2022.1'
1213
1314group :test do
1415 gem 'rspec-collection_matchers' , '~> 1.2.0'
Original file line number Diff line number Diff line change 150150 timecop (0.9.4 )
151151 tzinfo (1.2.9 )
152152 thread_safe (~> 0.1 )
153+ tzinfo-data (1.2022.1 )
154+ tzinfo (>= 1.0.0 )
153155 unicode-display_width (2.1.0 )
154156 webmock (3.14.0 )
155157 addressable (>= 2.8.0 )
@@ -189,6 +191,7 @@ DEPENDENCIES
189191 sinatra
190192 sinatra-contrib
191193 timecop
194+ tzinfo-data
192195 webmock
193196
194197BUNDLED WITH
Original file line number Diff line number Diff line change @@ -25,15 +25,21 @@ build:
2525
2626install :
2727 rbenv install -s
28- - gem install bundler -v 2.2.33
28+ - gem install bundler -v 2.2.33 && rbenv rehash
2929 bundle install --jobs 1
3030 cp -n config/connectors.yml.example config/connectors.yml || true
3131
3232run :
3333 ${YQ} e " .revision = \" $( shell git rev-parse HEAD) \" " -i config/connectors.yml
3434 ${YQ} e " .repository = \" $( shell git config --get remote.origin.url) \" " -i config/connectors.yml
3535 ${YQ} e " .version = \" $( shell script/version.sh) \" " -i config/connectors.yml
36- cd lib/app; bundle exec rackup config.ru
36+ cd lib/app; bundle exec rackup --host 0.0.0.0 config.ru
37+
38+ build-docker :
39+ docker build -t connectors .
40+
41+ run-docker :
42+ docker run --rm -it -p 127.0.0.1:9292:9292/tcp connectors
3743
3844console :
3945 cd lib/app; bundle exec irb -r ./console.rb
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ Note: The connector framework is a tech preview feature. Tech preview features a
99
1010
1111### System Requirements
12+
13+ You can run the application using Docker or directly on your system.
14+
15+ For the latter you will need:
1216- Ruby (see [ .ruby-version] ( .ruby-version ) )
1317- bundler 2.2.29
1418- yq (see [ yq installation] ( https://github.com/mikefarah/yq#install ) )
@@ -34,6 +38,21 @@ make run
3438Consumers will need to use the ` api_key ` string as the password in
3539the basic Authorization header.
3640
41+ ### Running a with Docker
42+ You can run the web server using our Dockerfile.
43+
44+ First, build the Docker image with:
45+ ``` shell
46+ make build-docker
47+ ```
48+
49+ The stdout will display the generated API key.
50+
51+ Then, you can run the server within Docker with:
52+ ``` shell
53+ make run-docker
54+ ```
55+
3756### Validating your webserver
3857You can use any REST client library, or ` curl ` to hit your webserver once it is up and running. Try:
3958
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ revision: "main"
55
66# web service
77http:
8+ host: 0.0.0.0
89 port: 9292
910 api_key: changeme
1011 deactivate_auth: false
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class ConnectorsWebApp < Sinatra::Base
2929 configure do
3030 set :raise_errors , false
3131 set :show_exceptions , false
32+ set :bind , settings . http [ 'host' ]
3233 set :port , settings . http [ 'port' ]
3334 set :api_key , settings . http [ 'api_key' ]
3435 set :deactivate_auth , settings . http [ 'deactivate_auth' ]
You can’t perform that action at this time.
0 commit comments