segunda-feira, 29 de agosto de 2016

Testing your specific stacks solutions (NodeJS / Ruby / Python, Go, etc.) with Heroku

:: Some findings from this weekend ::
        Testing your specific stacks solutions with Heroku (NodeJS / Ruby / Python, Go, etc.)
              
Case you need to test something on the fly, some app that needs to have some specific server 
               / stack, you can use Heroku, for instance, right from GitHub.

              You just need to place this on the readme (or a simple link, https://heroku.com/deploy):


Like Docker Hub looks for a Dockerfile, also Heroku looks for a specific config file, app.json.

E.g., from the aforementioned tutorial (better, the fork I did  to my own GitHub account):

{
     
"name": "React Tutorial Server",
     
"description": "Code from the React tutorial",
     
"keywords": [ "react", "reactjs", "tutorial" ],
     
"repository": "https://github.com/fmbento/react-tutorial",
     
"logo": "https://facebook.github.io/react/img/logo.svg",
     
"website": "http://facebook.github.io/react/docs/tutorial.html",
     
"success_url": "/",
     
"env" : {
       
"BUILDPACK_URL": "https://github.com/heroku/heroku-buildpack-nodejs.git"
     
}
   
}

                Here the key is really the repository link and the BuildPack (in this case, we want to run it o
                Node.JS [and he knows that should be a server.js there, at the repository).

                At Heroku, you will be asked for an optional app name (must be unique in Heroku universe --
                else, leave it blank, it will randomly assign one), choose if you want it to run from US
                or 
Europe (AWS), click “Deploy for Free”, and you’re done.

                The example of this react tutorial, run at Heroku: https://react-gss.herokuapp.com/

                You have all sort of control and data over it, at the Dashboard:

                And yes, you can even fire an update in the App via Commits to GitHib:

Or even DropBox file changes from a sync'ed folder!


And that’s it, for now, hope you’ve enjoyed these series of 4 posts.

Enjoy!

.

Build and update Docker Containers automatically from GitHub

:: Some findings from this weekend ::
Build and update Docker Containers automatically from GitHub 
To have Docker Hub build and update containers automatically for you, triggered by any commit to GitHub:
a)      You’ll need to authorize Docker Hub to access you GitHub
       https://hub.docker.com/account/authorized-services/          
 
b)      Then you'll  be able to
c)       Fill or confirm the “Repository Namespace & Name”, and it will create it for you; 
d)      Next, go to 
And select where the Dockerfile file is located (inside that repo) – save changes; you can manually trigger it too from here:
(Note: you have to have a Dockerfile present there in the repo – see further notes bellow) 
e)      Check the build details to see when it has finished (may take minutes, or hours if your dockerfile has something wrong):
The tricky part is really the dockerfile – 4am+ last Saturday to get it right, namely the RUN and CMD (first: run a command – second, start a daemon, etc.)
Here are the files for react-tutorial mentioned in my prev message:

a)      Node.JS (the one that is more simple – npm install is necessary, because we need npm modules that aren’t there at the repo):

FROM node

MAINTAINER Filipe Bento
<fbento@ebsco.com>

RUN
mkdir -p /code

WORKDIR
/code

RUN git clone
--depth 1 --single-branch https://github.com/fmbento/react-tutorial.git /code

RUN npm install

EXPOSE
3000

CMD
["node", "server.js"]


b)      And Python:

FROM python

MAINTAINER Filipe Bento 
<fbento@ebsco.com>

ENV DEBIAN_FRONTEND noninteractive

RUN apt
-get update --quiet > /dev/null && \
  apt
-get install --assume-yes --force-yes -qq \
  git 
&& \
  apt
-get clean && \
 
rm -rf /var/lib/apt/lists/*

RUN
mkdir -p /code

WORKDIR
/code

RUN git clone
--depth 1 --single-branch https://github.com/fmbento/react-tutorial.git /code && \
    pip install
-r requirements.txt

RUN
sed -i "s/app.run(port=int(os.environ.get(\"PORT\",3000)))/app.run(debug=True, host='0.0.0.0', port=int(os.environ.get(\"PORT\",3000)))/g" server.py

EXPOSE
3000

CMD
["python", "server.py"]


Quite simple, once you master what’s doing.
Note that you can also compile containers right from your workspace using Docker Compose – here’s a good page about it (Dockerizing a PHP Application).

Next:  Testing your specific stacks solutions (NodeJS / Ruby / Python / Go, etc.) with Heroku
Enjoy!
.

Docker full windows and Mac native Apps

:: Some findings from this weekend ::
Docker's Windows and Mac fully native Apps
This one completely flew under the radar, and after trying to find a way to have docker running on the new Windows Bash, found that end of last month was released a stable, full native apps both for Mac and Windows 
Wrt to Windows, you need to have Hyper-V active (the setup will do that for you) and it will create a MobyLinuxVM virtual machine (you can later define the # of CPU, RAM, etc., available to it, NAT / IPs, etc.). This has a very little footprint CPU usage and memory, when idle, and it increases your containers by very little in terms of overall resources (docker management). 
Once having that install finished, you can go ahead and fire a Windows PowerShell and run all the excellent docker commands. If you prefer a GUI for it, you can get Kitematic via
(explode it to some temp folder, then rename it to Kitematic and move it to C:\Program Files\Docker\ (or equivalent)). 
You need a Docker Hub account (simple to create).
From here, not even the sky is the limit: WordPress, Drupal, DSpace, OJS, Koha, VuFind, BlackLight, …, or stacks like ElasticSearch, MySQL / MariaDB / PostGres, TomCat / Nginx, Catmandu, or even OS (CentOS, etc.), all in here. 
Even simple apps, like this one from Facebook’s official React tutorial. Made a couple of them: one container running on Python and the other one running on Node.JS: search for “react-tutorial”:
(don’t use the one from “georgeyord”, it won’t work)

Use NodeJS, for instance – both are auto-deployed from the fork I’ve made from the official repo to https://github.com/fmbento/react-tutorial

Note that you can have containers linked to each other, namely the ones that use MySQL or other DBs, etc.., instead of having them running inside the solution container (just deploy a mysql, and then link to it from others with “--link"). 

NEXT: Build and update Docker Containers automatically from GitHub (“AUTOMATED BUILD”) – another 4am+ (this time, Sat>Sun) until get it running with “Success”:

Enjoy, good development / exploit this to the max! 
Update: wrt to the above demo containers, I’ve just merged them into the same one, with two diff tags: latest = Node.JS and Python, running on Python. By default, “latest” (Node.JS) will be selected; to select “Python” you need to click the “…”

   then  and here you see all the possible tags  and then close and create.

Enjoy!


Next:

Linux Bash Shell on Windows 10 (Ubuntu)

:: Some findings from this weekend ::

Linux Bash Shell on Windows 10 (Ubuntu) 

Last Friday, when checking if I had Bash available already at one of my personal laptops, I found that you have to take some action, as you won’t get the Anniversary level update as one would expect, within Windows update. Instead, MS considers this more of an upgrade than an update.

How to get it:
then run the exec (as of today: Windows10Upgrade28084.exe) to upgrade it; note that you will
need some 20GB+ of free disk space (yes, a full upgrade!), depending on your setup.

To enable bash on windows, you need to activate “developer mode”, and the turn on the Windows Subsystem for Linux Windows feature (how to).

Please note that this is not a full server stack, you’ll need to install most of it, and cutting edge ones won’t run at all: docker made me be up to 4am+ and didn’t manage to get it working (server, only the client – I shall try new kernels, though).

Also, node.js was a no go. But for LAMP, perfect -- you will need to install the stacks, though (note: run mkdir -p /run/lock, else you will get an error and Apache won't start):


quarta-feira, 13 de março de 2013

Webfont - Maven Pro Regular [nova fonte base site]

Webfont - Maven Pro Regular
[nova fonte base do site, em vez de Tahoma]
terça-feira, 12 de Março de 2013 23:53

Para ser mais fácil de ler e ter um toque mais "moderno":



 


 clip_image005[11] web/interface/themes/blueprint/css/styles.css


a{font-family:Maven Pro Regular, tahoma, verdana, Arial, Helvetica, sans-serif;text-decoration:none;color:#0095E6;font-weight:400;}

a:hover{text-decoration:none;color:#FF9003;background-color:rgba(25525500.11);}


body{font-family:Maven Pro Regular, tahoma, verdana, Arial, Helvetica, sans-serif;color:#392529;font-size13px;}


(…)

.summcover{max-width:70px;margin-top:.5em;margin-left:.6em;padding:0;opacity: 0.08;-moz-transition: opacity 2s ease 0.07s;-webkit-transition: opacity 2s ease 0.07s;-o-transition: opacity 2s ease 0.07s;transition: opacity 2s ease 0.07s;}

[antes estava margin-top: .5em;]

(…)

.title{font-size:110%;color:#1CA422;}

(…)

@font-face{font-family:'Maven Pro Regular';src:url('/interface/themes/blueprint/css/fontes/Maven Pro Regular.ttf');}
@font-face{font-family:'Lato Light';src:url('/interface/themes/blueprint/css/fontes/Lato Light.ttf');}


 ----------------------------------------------------------------



 clip_image005[11] web/interface/themes/blueprint/css/blueprint/screen.css

Antes:

ul,ol{padding-left:1.5em;margin:0 1.5em 1.5em 0;}

Depois:

ul,ol{padding-left:1.5em;margin:0 0.8em 1.5em 0;}


 ----------------------------------------------------------------




 clip_image005[11] web/interface/themes/blueprint/css/blueprint/screen.css

Antes:

.span-4{width:150px;}


Depois:

.span-4{width:147px;}


 clip_image005[11] web/interface/themes/blueprint/css/home.css

Antes:


#socialHome {margin-left: 376px;}


Depois:


#socialHome {margin-left: 421px;}



< FIM 13-03-2013 01:27 >


clip_image001  < 13-03-2013 14:10 >

Botão pesquisar estava com fonte

clip_image002 web/interface/themes/blueprint/css/home.css


.g-button.color { border-width: 1px; border-color: rgba(238, 238, 238, 0.85);border-top-color: rgba(201, 201, 201, 0.74);border-right-color: rgba(238, 238, 238, 0.84); background: -webkit-gradient(linear, 0% 0%, 0% 100%, to(rgba(206, 197, 155, 0.22)), from(white));padding-bottom: 2.4px;margin-bottom: 4px;font-family: tahoma; border-bottom-right-radius: 6px;border-top-right-radius: 6px;color: #556C96;margin-left: 4px;}


clip_image002web/interface/themes/blueprint/RecordDrivers/Index/core.tpl

Antes:
clip_image001[6]

<div style='float:left;margin-left:111px;width:60px'>


Depois:
clip_image002[6]

<div style='float:left;margin-left:124px;width:60px'>

< FEITO 13-03-2013 14:30 >

quinta-feira, 7 de março de 2013

ColorBox lightbox plugin

ColorBox lightbox plugin
quarta-feira, 6 de Março de 2013 00:15

A lightweight customizable lightbox plugin
Fazer o download e extrair o .css, .js para as pastas respectivas, assim como a pasta "images" do exemplo que se pretende ter (exemplo: \example1\images\) para a pasta css (web/interface/themes/blueprint/css)
<<colorbox.css>>  (modificado)

(css/images/overlay.jpg)

clip_image001[6] web/interface/themes/blueprint/Search/list.tpl
{css media="screen, projection" filename="colorbox.css"}

(…)  <conteúdo do ficheiro> (…)

{literal}
    <script>
        jQuery(".iframePDF").colorbox({iframe:true, width:"968", height:"98%", close:"fechar [Esc]"});
        jQuery(".iframePage").colorbox({iframe:true, width:"95%", height:"95%", fastIframe:false, close:"fechar [Esc]"});
    </script>
{/literal}
{js filename="jquery.colorbox-min.js"}

clip_image001[8] web/interface/themes/blueprint/RecordDrivers/Index/result.tpl

{css media="screen, projection" filename="colorbox.css"}


            <spanclass="link_showHover_Result">
              {if $recordurl|stripos:'pdf'}PDF > <a href="{$recordurl|escape|rtrim}" Title='PDF: {$summTitle} [prima "Esc" para fechar esta janela]' class="iframePDF cboxElement fulltext">{translate text='Get full text'}</a>{else}{if $recordurl|stripos:'books_isbn'}ZIP > <a href={$recordurl} target=_new>e-book completo (pdf)</a>{else}<a href="{$recordurl}" Title='{$summTitle} [prima "Esc" para fechar esta janela]'class="iframePage cboxElement fulltext">{if $recordurl|stripos:'handle/10773'}{translate text='Access this record at RIA'}{elseif ($recordurl|stripos:'handle' || $recordurl|stripos:'dx.')}{translate text='View at publisher'}{else}{if $recordurl == $urldesc}{translate text='Get full text online'}{else}{$urldesc|escape}{/if}{/if}{/if}{/if}</a>
            </span>


NOTA: class > cboxElement : aparentemente não é necessário / não faz nada.


clip_image001[10] web/interface/themes/blueprint/RecordDrivers/Index/core.tpl (NÃO ESTÁ OK!):
{css media="screen, projection" filename="colorbox.css"}

(…)

{if $currentUrl|stripos:'.pdf'}PDF > <a href="{$currentUrl|escape|rtrim}" title="{$coreShortTitle}" class="iframePDF" target=_new>{translate text=$recordFormat[0]}</a>{else}{if $currentUrl|stripos:'dx.'} {translate text='View at publisher'} >{else} {if $currentUrl|stripos:'books_isbn'}PDF > <a href={$currentUrl} target=_new>e-book completo (zip)</a>{else} Editor > <a href="{$currentUrl|escape|rtrim}" title="{$coreShortTitle}" class="iframePage" target=_new>{translate text='View at publisher'}</a>{/if}{/if}{/if}<br/>

(…)

{literal}
    <script>
        jQuery(".iframePDF").colorbox({iframe:true, width:"968", height:"98%", close:"fechar [Esc]"});
        jQuery(".iframePage").colorbox({iframe:true, width:"95%", height:"95%", fastIframe:false, close:"fechar [Esc]"});
    </script>
{/literal}

{js filename="jquery.colorbox-min.js"} 
 <FEITO 06-03-2013 02:17 >


clip_image001[16]  <06-03-2013 21:16 -- após Focus Group dos Alunos Pós-Graduação>
Alterada a posição do texto / link de fechar da parte de baixo para o topo; legenda alinhada à direita.
clip_image002[4]clip_image003[4]
clip_image004[4]


clip_image001[18]  <06-03-2013 23:58 -- tirado das páginas individualmente, o que originava ser carregado várias vezes, por exemplo 10x na página de resultados e colocado na de layout (única) >

clip_image001[20] web/interface/themes/blueprint/layout.tpl
{css media="print" filename="print.css"}
<!--[if lt IE 8]><link rel="stylesheet" href="{$url}/interface/themes/blueprint/css/ie.css" type="text/css" media="screen, projection"><![endif]-->
{css media="screen, projection" filename="colorbox.css"}
{else}

(…)

           {* Load jQuery UI *}
           {js filename="jquery-ui-1.8.7.custom/js/jquery-ui-1.8.7.custom.min.js"}
{js filename="social-likes.min.js"}
{js filename="jquery.colorbox-min.js"}

(…)

    </script>
{literal}  
    <script>
      jQuery(document).ready(function () {
            jQuery(".iframePDF").colorbox({iframe:true, width:"968", height:"98%", close:"fechar [x]"});
            jQuery(".iframePage").colorbox({iframe:true, width:"95%", height:"95%", fastIframe:false, close:"fechar [x]"});
      });
    </script>
{/literal} 
    <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4dbfda1546939581"></script>
   
  </head>

    --------------------------


clip_image001[22] web/interface/themes/blueprint/Search/Recommend/SideFacets_External.tpl
    <dl class="narrowList navmenu">
          <dt>{translate text='UA Subscrived Services'}</dt>
            <dd>* <a href=http://atoz.ebsco.com/Titles/SearchResults/10532?IsFromAdvancedSearch=True&resourceType=&SearchType=Contains&resourceTypeName=allTitles&{$searchIndex|replace:"AllFields":"GetResourcesBy=AllSearch"|replace:"Title":"GetResourcesBy=TitleNameSearch"|replace:"Author":"GetResourcesBy=AuthorSearch"|replace:"Subject":"GetResourcesBy=SubjectsSearch"|replace:"container_title":"resourceTypeName=journalsOnly&GetResourcesBy=TitleNameSearch"|replace:"ISN":"GetResourcesBy=IssnSearch"|replace:"tag":"GetResourcesBy=SubjectsSearch"}&Find={$lookfor|replace:" ":"%2B"|replace:'"':"&quot;" Title="A to Z -> {translate text=$searchIndex}: {$lookfor}" class="iframePage">{translate text='A to Z (journals & e-books)'}</a> <sup><font color=grey><small>1</small></font></sup></font></dd>
            <br />
            <dd><font color=grey><small>[1] Acesso ao documento / texto integral limitado por IP (UA[campus|VPN]/B-On)</small></font></dd>
            <br />
    </dl>
    <dl class="narrowList navmenu">
    <dt>{translate text='External Services'}</dt>
        <dd><font color=grey>[Sem garantia de acesso ao texto integral dos recursos]</font></dd>
        <dd>* <a href="javascript: void(0)" onClick="getLightboxexternalGSch('http://scholar.google.pt/scholar?sciui=1-----num=50-----{$searchIndex|replace:"AllFields":"as_q="|replace:"Title":"as_occt=title-----as_q="|replace:"Author":"q=autor%3A"|replace:"Subject":"as_q=&quot;"|replace:"container_title":"as_publication="|replace:"ISN":"as_q="}{$lookfor|replace:" ":"%2B"|replace:'"':"&quot;"}{if $searchIndex == "Subject"}&quot;{/if}','Google Scholar (Académico) -> {translate text=$searchIndex}: {$lookfor|replace:'"':"&quot;"}')">Google Scholar (Académico)</a></dd>
        <dd>* <a href={$path}/services/External/WoS.php?lookfor={$lookfor|replace:" ":"%2B"|replace:'"':"****"} Title="Web of Science -> {translate text='AllFields'}: {$lookfor}" class="iframePage">Web of Science</a> <sup><font color=grey><small>2</small></font></sup></dd>
        <dd>* <a href=http://www.scirus.com/srsapp/search?q={$lookfor|replace:" ":"%2B"|replace:'"':"&quot;"}&t=all&sort=0&g=s&co=and&cn={$searchIndex|replace:"AllFields":""|replace:"Title":"title"|replace:"Author":"author"|replace:"Subject":"keyword"|replace:"container_title":"journal"|replace:"ISN":"issn" Title="Scirus Scientific Information (Elsevier) -> {translate text=$searchIndex}: {$lookfor}" class="iframePage">Scirus Scientific Information</a></dd>   
        <br />
        <dd>&nbsp; <font color=grey><small>[2] {translate text='Search For'} {translate text='AllFields'}</small></font></dd>
       
    </dl>