Thursday, November 29, 2018

docker install debian stretch 2018


root@educacion:~# apt update

root@educacion:~# apt install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg2 \
     software-properties-common

root@educacion:~# curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -

root@educacion:~# apt-key fingerprint 0EBFCD88

root@educacion:~# add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

root@educacion:~# apt update

root@educacion:~# apt upgrade

root@educacion:~# apt install docker-ce

root@educacion:~# docker run hello-world

-( root@educacion:~# apt install docker-compose ) # OLD release of docker-compose, we must install from git repo
-( root@educacion:~# apt remove docker-compose )

root@educacion:~# usermod -aG docker educacion

root@educacion:~# usermod -aG staff educacion

educacion@educacion:~$ curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

educacion@educacion:~$ chmod +x /usr/local/bin/docker-compose

educacion@educacion:~$ docker-compose --version


educacion@educacion:~$ docker run hello-world


root@educacion:/etc/docker# cat daemon.json 
{
"log-driver": "json-file",
"log-opts": {
    "max-size": "5m",    
    "max-file": "3"    
    }
} 


version: '3.2'
services:
  nginx:
    image: 'nginx:latest'
    ports:
      - '80:80'
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "3"

Reference:
https://gist.github.com/elPoeta/2e0490f61b978da0379f26fec91695e5
https://www.docker.com/

Monday, August 14, 2017

install debian 9 pendrive java web sql nginx jetty9 phpmyadmin mariadb mercurial git, agosto 2017



Infraestructura de Desarrollo en un pedrive, portable, economico ( the cheap way )



1. Pendrive de 16gb espacio, 100Mbps velocidad de transferencia.

2. Bajar con torrent, es mucho mas rapido, y menos carga para los servidores que nos proveen estas facilidades

https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current-live/amd64/bt-hybrid/debian-live-9.1.0-amd64-lxde+nonfree.iso.torrent

3. Con la .iso o .img se puede llevar el instalador a un pendrive de al menos 4gb de espacio.

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/bsdinstall-pre.html

# dd if=FreeBSD-10.2-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=sync
 En este caso con el debian queda algo asi:

#dd if=firmware-9.0.0-amd64-DVD-1.iso of=/dev/sdb bs=512; sync;

4. Una vez que booteamos de este pendrive,
F12: en algunas maquinas con alternative boot del F12
ESC: otras maquinas

Pero a partir de UEFI,
en mi caso particular, en las  5 o 7 tipos de maquinas distintas que probe,
portatiles y de escritorio,
necesite entrar a la BIOS
y cambiar a UEFI and Legacy

( es muy probable que encuentre la forma de no modificar el UEFI, en algun momento, por algo esta )

5. Para empezar, perfiero dejar todo eun una sola particion, en el disco pendrive de 16gb
     Ojo NO en la opcion disco mas grande
     Sino en la opcion disco completo y poder seleccionar el de 16gb

6. Cuando logramos bootear el linux, instalador es practicamente intuitivo.
 - Yo prefiero instalarlo todo por defecto,
     excepto que
     prefiero LXDE,
     sin impresora
     y con ssh

7. Permito instalar el Grub, y listo, a rebootear.

8. Una vez que booteo con el sistema nuevo instalado
    Verifico tener internet

    $ip addr 

    me dara si detecto las placas de red eth y wifi
    y si tiene asignada una ip

9. edito el archivo de configuracion

/etc/apt/source.list

 deb http://security.debian.org/debian-security stretch/updates main contrib non-free
 deb http://deb.debian.org/debian/ stretch main contrib non-free
 deb http://deb.debian.org/debian/ stretch-updates main contrib non-free
 deb http://deb.debian.org/debian/ stretch-backports main contrib non-free

10. Actualizo la lista de soft disponible

 # apt -y update; apt -y upgrade; sync;

11. Instalo el soft base para desarrollo, tomando en cuenta programar de forma simple para alumnos que recien comienzan:

#apt -y install openjdk-8-jdk mercurial git medit chromium mariadb-client mariadb-server php-fpm phpmyadmin nginx jetty9

12. Configuro el Mysql

# mysql -u root -e " CREATE USER 'educacion'@'%' IDENTIFIED BY 'educacion'; GRANT ALL PRIVILEGES ON *.* TO 'educacion'@'%' WITH GRANT OPTION;"

13. Configuro el phpmyadmin

#vi /etc/nginx/sites-available/default



# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;

location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}

14. Link Simbolico de phpmyadmin en el directorio donde levanta la web el Nginx

#ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin



15. Restarteo el Nginx

#systemctl restart nginx

16. Verifico

http://localhost/phpmyadmin

17. Busco el NetBeans  

https://netbeans.org/downloads/

Instalo la version con Apache Tomcat, no utilizo el Glassfish porque es muy pesado, para desarrollo en un pendrive. ( tomando en cuenta que las maquinas en las que a veces trabajo tienen poca potencia, otras no )




18. Ajuste de la version, que algun bug puede tener: Hay que Comentar una linea ( con el caracter # )

/usr/lib/jvm/default-java/jre/lib/accessibility.properties

#assistive_technologies=org.GNOME.Accessibility.AtkWrapper



Friday, September 2, 2011

Wednesday, May 13, 2009

ruby on rails, googlebot(at)googlebot.com, No HTTP_REFERER, canonical and consistent websites



When you have an exception from the system, something like:


Subject: [ERROR] ships#flag_choice (ActionController::RedirectBackError) "No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env[\"HTTP_REFERER\"]."


A ActionController::RedirectBackError occurred in ships#flag_choice:

No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env["HTTP_REFERER"].




Is your chance to make a better website, a browseable website for robots.



Here you have:

app/controllers/application.rb

before_filter :load_url_back

def flag_choice
set_locale(params[:id])
session["lang"] = "#{params[:id]}"
#redirect_to :back
redirect_to params[:url_back]
end

def load_url_back
@url_back = "http://" + request.env["HTTP_HOST"]
+ request.env["REQUEST_URI"]
end


apps/views/layouts/application.html.erb

<%= link_to(image_tag('ingles.png'),
:action => 'flag_choice', :id => 'en_EN',
:url_back => @url_back ) %>
<%= link_to(image_tag('esp.png'),
:action => 'flag_choice', :id => 'es_AR',
:url_back => @url_back ) %>





Now we have consistent links that can be saved in any place, and consulted without history of browser navigation. This makes your links independent from where you came from.
And in the controller you are working in a request that just need canonical information from the HTTP Request.

Monday, May 11, 2009

ruby on rails can't convert Symbol into String date_select, i18n

config/locales/es-ar.yml

"es-ar":
hello: "Hola mundo"

date:
formats:
default: ""
long: ""
short: ""
order: [ :day, :month, :year ]
...