Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Vargas Mattheus danielVargas

View GitHub Profile
View BucketPolicy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "StatementGarageReactDeploy",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
View buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
nodejs: 16
commands:
- npm install
- npm install -g yarn
# install dependencies
pre_build:
View test_capistrano.conf
<VirtualHost *:80>
ServerName test.com
ServerAlias test.com
ServerAdmin webmaster@localhost
#PassengerAppEnv staging
DocumentRoot /var/www/html/ruta_al_proyecto
#Redirect "/" "https://test.com/"
<Directory "/var/www/html/ruta_al_proyecto">
#DirectoryIndex index.php
Options +Indexes +FollowSymLinks +MultiViews
@danielVargas
danielVargas / staging.rb
Created Apr 22, 2019
Entorno de staging para Capistrano
View staging.rb
# Se definen los distintos roles para el despliegue, que pueden ser distintas instancias de amazon.
role :app, %w{tu_usuario@ec2-tu-ip.us-east-2.compute.amazonaws.com}
role :web, %w{tu_usuario@ec2-tu-ip.us-east-2.compute.amazonaws.com}
role :db, %w{tu_usuario@ec2-tu-ip.us-east-2.compute.amazonaws.com}
# Se definen los distintos servidores, asociados a un rol para hacer el despliegue.
set :user, "tu_usuario"
server "ec2-tu-ip.us-east-2.compute.amazonaws.com", roles: %w{web}
# Se indica la ubicación de la llave.pem descargada desde amazon. Esto para poder hacer la autenticación por SSH
@danielVargas
danielVargas / deploy.rb
Created Apr 22, 2019
Configuraciones del deploy.rb
View deploy.rb
lock "~> 3.11.0"
# Es el stage de la aplicación, obviamente producción
set :stage, 'production'
# Nombre de la aplicación
set :application, "test_capistrano"
# URL de la aplicación en git (github, bitbucket, etc). DEBE SER SSH
set :repo_url, "git@github.com:danielVargas/test-capistrano.git"
# Default branch is :master
@danielVargas
danielVargas / Capfile
Created Apr 18, 2019
Capfile para despliegue de capistrano
View Capfile
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/sidekiq'
@danielVargas
danielVargas / database.yml
Created Apr 18, 2019
Archivo de configuración de la base de datos
View database.yml
default: &default
adapter: postgresql
encoding: unicode
username: nombre_de_usuario
password: contraseña
pool: 5
timeout: 5000
development:
<<: *default
@danielVargas
danielVargas / secrets.yml
Created Jun 20, 2018
Variables de la aplicación RoR
View secrets.yml
development:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
mail_admin: <%= ENV["MAIL_ADMIN"] %>
pass_admin: <%= ENV["PASS_ADMIN"] %>
webpay_wsdl: https://webpay3gint.transbank.cl/WSWebpayTransaction/cxf/WSWebpayService?wsdl
webpay_client_certificate: config/public_cert_develop.crt
webpay_client_private_key: config/private_key_develop.key
webpay_tbk_certificate: config/tbk_develop.key
webpay_commerce_code: '597020000541'
webpay_return_url: /webpay/webpay_return_url
@danielVargas
danielVargas / webpay_success.html.erb
Created Jun 20, 2018
WebPay Success información de pago realizado con webpay
View webpay_success.html.erb
<section class="content-header">
<h1>
Detalle de pago
<small>Revise el detalle de su pago. Muchas gracias por preferirnos.</small>
</h1>
<ol class="breadcrumb">
<li>Mi cuenta</li>
<li class="active">Detalle del pago</li>
</ol>
</section>
@danielVargas
danielVargas / _payment_from.html.erb
Created Jun 20, 2018
Formulario de creación de pago con webpay
View _payment_from.html.erb
<!-- PAGO CON WEBPAY -->
<div id="webpay-row" class="container-fluid" align="center">
<%= form_for(@payment, html: {name: 'new_payment', class: "form-inline"}) do |f| %>
<%= image_tag('webpay_logo.png', alt: 'Logo WebPay', class: 'logo-webpay')%><br>
<input id="payment_amount" type="text" class="form-control" required='true' name="payment[webpay_amount]">
<button class="btn btn-success">Pagar con WebPay</button>
<% end %>
</div>
<!-- FIN PAGO CON WEBPAY -->