Skip to content

Commit

Permalink
Merge pull request #2161 from 3scale/cherryp-pick-2.9.1-without-some-…
Browse files Browse the repository at this point in the history
…refactoring

3scale-2.9.1-ER1 candidate, without code refactoring
  • Loading branch information
guicassolato authored Sep 14, 2020
2 parents c34e5b9 + 4c6ca24 commit 206dc67
Show file tree
Hide file tree
Showing 146 changed files with 3,363 additions and 1,286 deletions.
28 changes: 11 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ store-log-artifacts: &store-log-artifacts
path: log
destination: log

flow-type-key: &flow-typed-cache-key flow-typed-{{ checksum "yarn.lock" }}-5
npm-cache-key: &npm-cache-key node-v10-{{ checksum "yarn.lock" }}-5
bundle-cache-key: &bundle-cache-key v2-bundler-gems-{{ .Environment.DB }}-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}

save-flow-typed-cache: &save-flow-typed-cache
save_cache:
key: flow-typed-{{ checksum "yarn.lock" }}
key: *flow-typed-cache-key
paths:
- ./flow-typed

npm-cache-key: &npm-cache-key node-v10-{{ checksum "yarn.lock" }}

restore-npm-cache: &restore-npm-cache
restore_cache:
key: *npm-cache-key
Expand All @@ -49,7 +51,7 @@ save-npm-cache: &save-npm-cache

restore-flow-typed-cache: &restore-flow-typed-cache
restore_cache:
key: flow-typed-{{ checksum "yarn.lock" }}
key: *flow-typed-cache-key

use-example-config-files: &use-example-config-files
run:
Expand Down Expand Up @@ -100,7 +102,7 @@ postgres-container: &postgres-container
POSTGRES_DB: systemdb

oracle-db-container: &oracle-db-container
image: quay.io/3scale/oracle:12.2.0.1-ee-scripted
image: quay.io/3scale/oracle:19.3.0-ee-ci-prebuilt
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
Expand Down Expand Up @@ -193,16 +195,8 @@ commands: # reusable commands with parameters
- run:
name: "Fetch oracle libraries"
command: |
git clone [email protected]:3scale/system-libraries.git
cp -R system-libraries/vendor/oracle/*.zip vendor/oracle
# using sudo due to `/opt/oracle/` set in: https://github.com/3scale/system-builder/blob/1bc3cec26bff04e0603e1a4908594b70a114dfe8/Dockerfile#L16-L17
sudo unzip vendor/oracle/instantclient-basiclite-linux.x64-12.2.0.1.0.zip -d /opt/oracle
sudo unzip vendor/oracle/instantclient-sdk-linux.x64-12.2.0.1.0.zip -d /opt/oracle
sudo unzip vendor/oracle/instantclient-odbc-linux.x64-12.2.0.1.0-2.zip -d /opt/oracle
sudo ln -s /opt/oracle/instantclient_12_2/libclntsh.so.12.1 /opt/oracle/instantclient_12_2/libclntsh.so
sudo rm -rf /opt/system/vendor/oracle
rm -rf vendor/oracle/*.zip
sudo cp config/oracle/*.ini /etc/
set +o pipefail
sudo ./script/oracle/install-instantclient-packages.sh
prepare-db-for-tests:
steps:
Expand Down Expand Up @@ -278,7 +272,7 @@ commands: # reusable commands with parameters
save-gem-cache:
steps:
- save_cache:
key: v1-bundler-gems-{{ .Environment.DB }}-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
key: *bundle-cache-key
paths:
- ./vendor/bundle
- ./.bundle/
Expand All @@ -287,7 +281,7 @@ commands: # reusable commands with parameters
steps:
- restore_cache:
keys:
- v1-bundler-gems-{{ .Environment.DB }}-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- v2-bundler-gems-{{ .Environment.DB }}-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}

upload-artifacts:
steps:
Expand Down
31 changes: 7 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
FROM quay.io/3scale/system-builder:ruby25
FROM quay.io/3scale/system-builder:ruby25-oracle

ARG SPHINX_VERSION=2.2.11
ARG BUNDLER_VERSION=1.17.3
ARG DB=mysql
ARG MASTER_PASSWORD=p
ARG USER_PASSWORD=p
ARG CUSTOM_DB=mysql

ENV DISABLE_SPRING="true" \
ORACLE_SYSTEM_PASSWORD="threescalepass" \
NLS_LANG="AMERICAN_AMERICA.UTF8" \
TZ="UTC" \
MASTER_PASSWORD="${MASTER_PASSWORD}" \
USER_PASSWORD="${USER_PASSWORD}" \
MASTER_PASSWORD="p" \
USER_PASSWORD="p" \
LC_ALL="en_US.UTF-8" \
PATH="./node_modules/.bin:/opt/rh/rh-nodejs10/root/usr/bin:$PATH" \
SKIP_ASSETS="1" \
DNSMASQ="#" \
BUNDLE_FROZEN=1 \
BUNDLE_JOBS=5 \
TZ=:/etc/localtime \
LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2/ \
ORACLE_HOME=/opt/oracle/instantclient_12_2/ \
DB=$DB \
SAFETY_ASSURED=1 \
UNICORN_WORKERS=2
DB=${CUSTOM_DB} \
SAFETY_ASSURED=1

WORKDIR /opt/system/

Expand All @@ -32,16 +23,8 @@ ADD config/examples/*.yml config/
# Needed for Sphinx ODBC
ADD config/oracle/odbc*.ini /etc/

# Oracle special, this needs Oracle to be present in vendor/oracle
ADD vendor/oracle/* /opt/oracle/
RUN if [ "${DB}" = "oracle" ]; then unzip /opt/oracle/instantclient-basiclite-linux.x64-12.2.0.1.0.zip -d /opt/oracle/ \
&& unzip /opt/oracle/instantclient-sdk-linux.x64-12.2.0.1.0.zip -d /opt/oracle/ \
&& unzip /opt/oracle/instantclient-odbc-linux.x64-12.2.0.1.0-2.zip -d /opt/oracle/ \
&& (cd /opt/oracle/instantclient_12_2/ && ln -s libclntsh.so.12.1 libclntsh.so) \
&& rm -rf /opt/system/vendor/oracle \
&& rm -rf /opt/oracle/*.zip; fi

USER root
RUN if [ "X${DB}" = "Xoracle" ]; then ./script/oracle/install-instantclient-packages.sh; fi

# Needed to disable webpack compiling
RUN sed -i 's/compile: true/compile: false/' config/webpacker.yml
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ gem 'record_tag_helper', '~> 1.0'
group :test do
# To remove once migrated all functional tests
gem 'rails-controller-testing'
gem 'codecov', '~> 0.1.10', :require => false
gem 'codecov', :require => false
gem 'rack-no_animations', '~> 1.0.3'
gem 'simplecov', '~> 0.10.0'

Expand Down
12 changes: 5 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,16 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
childprocess (3.0.0)
chronic (0.10.2)
chunky_png (1.3.10)
ci_reporter (2.0.0)
builder (>= 2.1.2)
climate_control (0.2.0)
codecov (0.1.13)
codecov (0.2.6)
colorize
json
simplecov
url
codemirror-rails (5.16.0)
railties (>= 3.0, < 6.0)
coderay (1.1.2)
Expand Down Expand Up @@ -323,7 +322,7 @@ GEM
multipart-post (>= 1.2, < 3)
faraday_middleware (0.13.1)
faraday (>= 0.7.4, < 1.0)
ffi (1.12.2)
ffi (1.13.1)
font-awesome-rails (4.7.0.5)
railties (>= 3.2, < 6.1)
formtastic (1.2.4)
Expand Down Expand Up @@ -763,7 +762,6 @@ GEM
rack
unicorn
uniform_notifier (1.10.0)
url (0.3.2)
webmock (2.3.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
Expand Down Expand Up @@ -828,7 +826,7 @@ DEPENDENCIES
childprocess
chronic
ci_reporter_shell!
codecov (~> 0.1.10)
codecov
codemirror-rails (~> 5.6)
coffee-rails (~> 4.2)
colorize
Expand Down
12 changes: 5 additions & 7 deletions Gemfile.prod.lock
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,16 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
childprocess (3.0.0)
chronic (0.10.2)
chunky_png (1.3.10)
ci_reporter (2.0.0)
builder (>= 2.1.2)
climate_control (0.2.0)
codecov (0.1.13)
codecov (0.2.6)
colorize
json
simplecov
url
codemirror-rails (5.16.0)
railties (>= 3.0, < 6.0)
coderay (1.1.2)
Expand Down Expand Up @@ -324,7 +323,7 @@ GEM
multipart-post (>= 1.2, < 3)
faraday_middleware (0.13.1)
faraday (>= 0.7.4, < 1.0)
ffi (1.12.2)
ffi (1.13.1)
font-awesome-rails (4.7.0.5)
railties (>= 3.2, < 6.1)
formtastic (1.2.4)
Expand Down Expand Up @@ -764,7 +763,6 @@ GEM
rack
unicorn
uniform_notifier (1.10.0)
url (0.3.2)
webmock (2.3.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
Expand Down Expand Up @@ -829,7 +827,7 @@ DEPENDENCIES
childprocess
chronic
ci_reporter_shell!
codecov (~> 0.1.10)
codecov
codemirror-rails (~> 5.6)
coffee-rails (~> 4.2)
colorize
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ bash: dev-setup assets

build: ## Build the container image using one of the docker-compose file set by $(COMPOSE_FILE) env var
build:
docker-compose build system
@DB=$(DB) docker-compose build system

bundle: ## Installs dependencies using bundler. Run this after you make some changes to Gemfile.
bundle: Gemfile.prod Gemfile
Expand Down Expand Up @@ -121,9 +121,7 @@ oracle-database:
-e ORACLE_SID=threescale \
-e ORACLE_PWD=threescalepass \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-v $(ORACLE_DATA_DIR)/oracle-database:/opt/oracle/oradata \
-v $(PWD)/script/oracle:/opt/oracle/scripts/setup \
quay.io/3scale/oracle:12.2.0.1-ee
quay.io/3scale/oracle:19.3.0-ee-ci-prebuilt

# Check http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## Print this help
Expand Down
51 changes: 51 additions & 0 deletions app/assets/javascripts/provider/cms_toolbar_v2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// = require 'vendor/jquery-3.5.0.min.js'
// = require 'vendor/jquery/extensions/jquery.cookie.js'

$(function () {
const toolbar = $('#cms-toolbar')
const iframe = $('#developer-portal')
const toolbarMode = $('form#cms-toolbar-mode')
toolbarMode.find('li').on('click', function () {
$(this).closest('li').find('input').attr('checked', true)
$(toolbarMode).trigger('change')
})
toolbarMode.on('change', () => {
window.location = $(this).find('input:checked').val()
})
const enableAnimation = () => {
toolbar.addClass('animate')
iframe.addClass('animate')
}
const toggleValues = () => {
toolbar.toggleClass('not-hidden')
iframe.toggleClass('not-full')
}
const storedToolbarState = () => {
$.cookie('cms-toolbar-state', {
path: '/'
})
}
const saveToolbarState = state => {
$.cookie('cms-toolbar-state', state, {
expires: 30,
path: '/'
})
}
iframe.on('load', () => {
if (storedToolbarState() !== 'hidden') {
toggleValues()
return (window.requestAnimationFrame || window.setTimeout)(enableAnimation)
} else {
return enableAnimation()
}
})
$('#hide-side-bar').on('click', event => {
event.preventDefault()
toggleValues()
if (storedToolbarState() === 'hidden') {
saveToolbarState('visible')
} else {
saveToolbarState('hidden')
}
})
})
2 changes: 2 additions & 0 deletions app/assets/javascripts/vendor/jquery-3.5.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/controllers/admin/api_docs/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def resource_listing
path: "#{admin_api_docs_service_path(api_docs_service.system_name)}.{format}"
}
],
basePath: "#{request.protocol}#{request_target_host}"
basePath: "#{request.protocol}#{request.host_with_port}"
}
end
end
29 changes: 0 additions & 29 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
class ApplicationController < ActionController::Base
if ThreeScale::DevDomain.enabled?
include ThreeScale::DevDomain
end

include AuthenticatedSystem
include AccessControl
include InheritedResources::DSL
Expand Down Expand Up @@ -219,31 +215,6 @@ def render_error(error, options = {})
false
end

def target_host(provider)
return target_host_preview(provider) if Rails.env.preview?

dev_domain = ThreeScale.config.dev_gtld
if request.host.ends_with?(".#{dev_domain}")
"#{provider.admin_domain}.#{dev_domain}:#{request.port}"
else
provider.admin_domain
end
end

def target_host_preview(provider)
preview = request_target_host.match(/(preview\d+)/).try(:[], 0)
provider.admin_domain.sub(/\.3scale\.net\z/, ".#{preview}.#{ThreeScale.config.superdomain}")
end

def request_target_host
x_forwarded_for_domain = request.headers['X-Forwarded-For-Domain']
if Rails.env.preview? && x_forwarded_for_domain
request.host_with_port.sub(request.host, x_forwarded_for_domain)
else
request.host_with_port
end
end

def safe_return_to(url)
unless url.blank?
parsed = URI.parse(url)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/buyers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def create
redirect_to admin_buyers_account_path(@buyer)
else
@user = signup_result.user
flash.now[:error] = signup_result.errors.messages.without(:account, :user).values.join('. ')
render action: :new
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/buyers/impersonations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def create
sso_token.redirect_url = params[:redirect_url] if params[:redirect_url] && params[:redirect_url] != "null"
sso_token.account = provider

sso_url = sso_token.sso_url!(target_host(provider))
sso_url = sso_token.sso_url!(provider.external_admin_domain)

respond_to do | format |
format.json { render json: {url: sso_url}, status: :created }
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/buyers/invoices_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
class Buyers::InvoicesController < Buyers::BaseController
include Finance::ControllerRequirements
helper Finance::InvoicesHelper
helper Accounts::InvoicesHelper

helper_method :allow_edit?

before_action :authorize_finance
before_action :find_account
activate_menu :audience, :accounts, :listing

Expand Down
1 change: 1 addition & 0 deletions app/controllers/finance/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Finance::Api::BaseController < Admin::Api::BaseController
self.default_per_page = 20

before_action :finance_module_required
before_action :authorize_finance
before_action :set_api_version

after_action :report_traffic
Expand Down
Loading

0 comments on commit 206dc67

Please sign in to comment.