How can I override views in Solidus? - solidus

How do you override a view in Solidus?
Currently I am copying the view from Solidus Gem and into my application - which I find error prone.

Solidus 2.2.0 introduced a frontend views override generator which copies a view into your own host application.
In order to customize a view you should copy the file into your host
app. Using Deface is not recommended as it provides lots of headaches
while debugging and degrades your shops performance.
Solidus provides a generator to help with copying the right view into
your host app.
Simply call the generator to copy all views into your host app.
$ bundle exec rails g solidus:views:override
If you only want to copy certain views into your host app, you can
provide the --only argument:
$ bundle exec rails g solidus:views:override --only products/show
The argument to --only can also be a substring of the name of the view
from the app/views/spree folder:
$ bundle exec rails g solidus:views:override --only product
Readme Master link -
Readme 2.2.0 Link - if master changes

Related

Using AWS ruby-sdk with Inspec named profiles issue

Trying to clean up some testing for IaC using Inspec, But hardcoding security_group_ids is a no go for obvious reasons.
Im trying to use the ruby sdk instead to pull down the id based of a name (ie like you do with Terraform data resources).
But we work from aws named profiles and while Inspec can connect to named profiles when i run the test ie :
inspec exec . -t aws://prod_account
Is it possible from Inspec to link the call to aws named profiles to ruby code within a control?
since inspec is written in ruby, you can embed any ruby code within your spec files. for instance, you can have a ruby code with an array and for each array have a spec code.
thus, you can implement a logic for collecting the security group ids and then iterate over them.

How do I make a golem app appear at a specific URL route

We let the golem package automatically create a Dockerfile for us and can run the docker image and see the app at the root directory: http://localhost:3838/?...
But we would like the app to appear in a subdirectory like http://localhost:3838/myApp/v1/?... so that we can set up the necessary proxying for Apache and have this and other apps all available from a single server.
We can manually edit the Dockerfile to copy a shiny-server.conf file with the following information:
# Define a server that listens on port 3838
server {
listen 3838;
# Define a location at the base URL
location /myApp/v1/ {
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;
# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;
}
}
The above solution feels like a hack and we are hoping there is functionality inside of golem that will allow us to set the subdirectory at which the app will appear.
Unfortunately there is no way to include an nginx configuration inside the Dockerfile programmatically: {golem} tries to help with the creation of the file, but some things still need to be done manually.
Also, note that {golem} doesn't create a Dockerfile with a shiny server in it, it creates a standalone docker image that launches the app, so there is no shiny server running, just an R process. {shiny} being what it is, there is no way to natively run it on a given path, it's always at the root, on a port.
That being said, what you can do is either edit the dockerfile so that it also bundle nginx (or any other load balancer), so that you can serve the app on a path, or serve your application on another port, using the port argument of add_dockerfile(): that might be easier to configure it with you Apache proxy.
Colin

Hyperledger Fabric CA - Storing the identity materials the correct way

Currently I have a VM running and installed the binaries needed for fabric-ca. I have a docker-compose file looking like this:
I have some questions regarding this:
the docker-compose file will create one container, if I want it for
more organizations, do I need to copy/paste this and change the port
number? (I don't want to use intermediate CAs).
When registering/enrolling an identity, it will override the default
materials because It will always put the materials from the new identity in /etc/hyperledger/fabric-ca-client. So when creating multiple
identities (orderer, peers, users etc..) how do I need to organize
them? What's the best practise?
In the image you can see that the server and clients are specified,
is this a good approach? Or should the client and the server be a
different container?
More than one CA in a Docker Compose file - you can look at the Build your first network tutorial in the Fabric Docs which has a 2 Org network and various configuration files including Docker Compose.
Combined client/server Container - This might be convenient for testing, but in a production scenario definitely not for Security and Operational Integrity reasons.
Overwriting Identities - the enroll command writes a tree of data to the location specified by the environment variable FABRIC_CA_CLIENT_HOME but you can use --home to redirect the tree to a different location:
fabric-ca-client enroll -u http://Jane:janepw#myca.example.com:7054 --home /home/test/Jane/

How do you access a MongoDB database from two Openshift apps?

I want to be able to access my MongoDB database from 2 Openshift apps- one app is an interactive database maintenance app via the browser, the other is the principle web application which runs on mobile devices via an Openshift app. As I see it in Openshift, MongoDB gets set up within a particular app's folder space, not independent of that space.
What would be the method to accomplish this multiple app access to the database ?
It's not ideal but is my only choice to merge the functionality of both Openshift apps into one ? That's tastes like a bad plate of spaghetti.
2018 update: this applies to Openshift 2. Version 3 is very different, and however the general rules of linux and scaling apply, the details got obsolete.
Although #MartinB answer was timely and correct, it's just a link, so let me put the essentials here.
Assuming that setting up a non-shared DB is already done, you need to find it's host and port. You can ssh to your app (the one with the DB) or use the rhc:
rhc ssh -a appwithdb
env | grep MONGODB
env brings all the environment variables, and grep filters them to show only Mongo-related ones. You should see something like:
OPENSHIFT_MONGODB_DB_HOST=xxxxx-yyyyy.apps.osecloud.com
OPENSHIFT_MONGODB_DB_PORT=zzzzz
xxxxx is the ID of the gear that Mongo sits on
yyyyy is your domain/namespace
zzzzz is MongoDB port
Now, you can use these to create a connection to the DB from anywhere in your Openshift environment. Another application has to use the xxxxx-yyyyy:zzzzz URL. You can store them in custom variables to make maintenance easier.
$ rhc env-set \
MYOWN_DB_HOST=xxxxx-yyyyy \
MYOWN_DB_PORT=zzzzz \
MYOWN_DB_PASSWORD=****** \
MYOWN_DB_USERNAME=admin..... \
MYOWN_DB_NAME=dbname...
And then use the environment variables instead of the standard ones. Just remember they don't get updated automatically when the DB moves away.
Please read the following article from the open shift blog: https://blog.openshift.com/sharing-database-across-applications/

nestacms and webbynode rapp

I would like to deploy a nestacms blog on webbynode by using the webbynode gem as allways I do with rails. Altough Webbynode seem to support Sinatra and Rack application easily, I get a WARNING during deployment stating that the application will not run smoothly because it lacks a public folder:
WARNING: Missing public folder in your Rack app, it'll not run smoothly!
Actually the rapid application development (RAPP webbynode gem) sets the need of a public folder into the Nginx configuration:
server {
listen 80;
server_name super_duper_blog.webbyapp.com ;
root /var/rapp/super_duper_blog/public/;
passenger_enabled on;
}
Instead this is my nestacms config.ru:
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)
require 'nesta/app'
Nesta::App.root = ::File.expand_path('.', ::File.dirname(__FILE__))
run Nesta::App
It would be nice if the author and SO user Graham Ashton could jump in and help me. Anyway, how could I get around the problem?
UPDATE
After creating the project, with nesta new you nedd to:
Create a public folder manually
Add some content in it. Say for ex. humnans.txt and favicon.ico
git add . and git commit -m "added public with humans and favicon"
wn push
And your nestacms website will go on line at a private webbynode address (blog.webbyapp.com)
Then you can use wn changedns www.example.com to make your site available for the masses
I've never used webbynode, so I'm not sure quite how its set up. Have you seen the Nginx passenger install guide? Could be useful:
http://modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_rack_app
It says you need public/ and tmp/, so I'm inclined to believe it.
Did you try making these directories yourself? Does the site actually start up? How are you deploying your site to the webbynode?
All my Sinatra apps are deployed with Vlad (see http://effectif.com/articles/deploying-sinatra-with-vlad) which takes care of creating public/ and tmp/ for you. It also touches tmp/restart.txt (see the Passenger guide I linked to above) when you deploy a new version of the site if you tell it that you're using Passenger. Capistrano also works fine (and is more extensively documented these days).