Skip to content

Instantly share code, notes, and snippets.

@gildemberg-santos
Last active July 9, 2024 02:00
Show Gist options
  • Save gildemberg-santos/7f664adb6410b459d1cee16ad61a1475 to your computer and use it in GitHub Desktop.
Save gildemberg-santos/7f664adb6410b459d1cee16ad61a1475 to your computer and use it in GitHub Desktop.
Installation of the Development Environment
# Baixa as credenciais
# https://drive.google.com/file/d/1eWStF_SlhyRE-Bcsg-a2d8yF3DyO9ONx/view
cp -vn docker/env.local.example docker/env.local
docker compose build
docker compose run --rm app bundle install
docker compose run --rm app yarn install --check-files
docker compose run --rm -e EDITOR=nano app bundle exec rails credentials:edit
docker compose run --rm app bundle exec rails db:migrate
docker compose run --rm app bundle exec rake data:migrate
docker compose run --rm app bundle exec rake clickhouse:create_structure
docker compose up -d --remove-orphans
touch ~/.gitignore
git config --global core.excludesFile '~/.gitignore'
#!/bin/bash
sudo apt install build-essential checkinstall zlib1g-dev libreadline-dev -y
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0
. "$HOME/.asdf/asdf.sh"
# append completions to fpath
fpath=(${ASDF_DIR}/completions $fpath)
# initialise completions with ZSH's compinit
autoload -Uz compinit && compinit
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install nodejs latest
asdf global nodejs latest
node --version
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install ruby 2.6.10
asdf global ruby 2.6.10
ruby --version
asdf plugin add golang https://github.com/asdf-community/asdf-golang.git
asdf install golang 1.22.1
asdf global golang 1.22.1
go version
#!/bin/bash
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
# pagina atualizada
https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
#!/bin/bash
sudo curl -L "https://github.com/docker/compose/releases/download/2.17.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
#!/bin/bash
sudo apt update
sudo apt -y install git
curl -fsSL https://go.dev/dl/go1.21.4.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
go version
#!/bin/bash
sudo apt update
sudo apt -y install make
#!/bin/bash
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt -y install postgresql
sudo apt -y install postgresql-contrib
/etc/init.d/postgresql stop
systemctl disable postgresql
sudo apt update
sudo apt install git curl autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
rbenv -v
rbenv install -l
rbenv install 3.0.2
rbenv install 2.5.1
#!/bin/bash
gpg --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable --rails
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
#!/bin/bash
sudo apt update
sudo apt -y install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# EXPANDIR COMANDO DA ALIAS [Esc + ctrl + e]
expand-aliases() {
unset 'functions[_expand-aliases]'
functions[_expand-aliases]=$BUFFER
(($+functions[_expand-aliases])) &&
BUFFER=${functions[_expand-aliases]#$'\t'} &&
CURSOR=$#BUFFER
}
zle -N expand-aliases
bindkey '\e^E' expand-aliases
#!/bin/bash
ssh-keygen -t ed25519 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
# coding: utf-8
# frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
# Clean database
DatabaseCleaner.clean_with(:deletion, { except: %w[data_migrations] })
Administrator.create(
id: 1,
first_name: "Dev",
last_name: "Leadster",
email: "[email protected]",
password: "123456",
impersonate_allowed: true,
)
IntegrationBlueprint.create(
id: 5,
name: "email",
friendly_name: "E-mail",
worker_class_name: "EmailIntegrationWorker",
description_html: %{
<ul class="list-unstyled leading-loose">
<li>Envie os leads recebidos para um e-mail da sua escolha.</li>
<li></li>
</ul>
},
image_url: "https://cdn.leadster.com.br/dashboard/integrations/email.png",
has_dynamic_schema: false,
schema: {
title: "E-mail",
description: "Seus leads serão enviados para o e-mail de sua escolha",
type: "object",
required: ["subject"],
properties: {
to: {
type: "string",
format: "email",
title: "Endereço para Entrega",
},
subject: {
type: "string",
title: "Título do E-mail",
},
},
},
ui_schema: {}
)
Company.create(
id: 5,
name: "Neurologic.com.br",
created_at: "2019-04-17 19:00:51.664",
updated_at: "2020-06-11 18:02:30.550",
previous_lead_generation_count: 100,
contact_emails: "[email protected]",
state: :implemented,
website: "https://www.leadster.com.br",
role: "default",
ownership_type: "undefined",
uid: "5hNxMevLvS2nkjWm35BmgQrnE"
)
Subscription.create(
company_id: 5,
trial_ends_at: "2020-04-02",
status: :active,
created_at: "2019-04-17 19:02:58.013",
updated_at: "2021-03-01 17:43:36.121",
identifier: :paid,
payment_method: :bank_slip,
already_used_trial: true
)
ScriptRule.create(
id: 7748
)
Script.create(
id: 7995,
company_id: 5,
name: "Educacional",
enabled: false,
default: false,
discarded_at: nil,
ab_test_id: nil,
script_version_id: nil,
script_rule_id: 7748,
privacy_policy_url: nil,
migrated: false,
uid: "HjcS2FKBznSCanuJ",
)
ScriptVersion.create(
id: 35873,
script_id: 7995,
content: "{\"to\": [\"[email protected]\"], \"from\": \"[email protected]\", \"side\": \"right\", \"title\": \"Ana - Neurologic\", \"avatar\": \"https://storage.googleapis.com/neuro-cdn/uploads/6280fa321cfb2271a60bde15e57a2931.png\", \"script\": [{\"from\": [\"Sim, começar agora\"], \"save\": \"nosync::0::Iniciar\", \"messages\": [{\"say\": \"Olá, tudo bem?\"}, {\"say\": \"<p class=\\\"p1\\\">Quer ver uma <b>Demonstra&ccedil;&atilde;o Personalizada</b> para seu Site? :sorriso_olhos_sorrindo:</p>\"}]}, {\"say\": \"<p>Ok, qual &eacute; a <b>URL do seu site</b>? Vou usar para criar a demonstra&ccedil;&atilde;o :piscando_olho:</p>\"}, {\"save\": \"url\", \"type\": \"url\"}, {\"say\": \"Agora algumas informações rápidas para criar sua conta :fogo:\"}, {\"say\": \"Qual é o seu nome?\"}, {\"save\": \"name\", \"type\": \"name\"}, {\"say\": \"Prazer {previous-word} :abanando:\"}, {\"say\": \"E o seu e-mail?\"}, {\"save\": \"email\", \"type\": \"email\"}, {\"say\": \"<p>Estamos quase finalizando:sorriso_olhos_arregalados:&nbsp; Agora informe um <b>n&uacute;mero de telefone</b>:</p>\"}, {\"mask\": \"(99) 99999-9999\", \"save\": \"phone\", \"type\": \"phone\"}, {\"say\": \"Insira uma <b>senha</b> de acesso a sua conta:\"}, {\"save\": \"password\", \"type\": \"password\"}, {\"say\": \"Por último, qual é o <b>volume de acessos</b> do seu site por mês?\"}, {\"from\": [\"Até 1.000\", \"1.000 até 5.000\", \"Mais de 5.000\", \"Não sei\"], \"save\": \"acessos\", \"multi\": false, \"selector\": false}, {\"say\": \"Obrigado! Viu como a nossa conversa é diferente de um formulário? :risadinha:\"}, {\"say\": \"<p>Agora estou preparando sua demonstra&ccedil;&atilde;o...</p>\"}, {\"api\": {\"data\": {\"url\": \"...\"}, \"function\": \"nldAPI_Neurologic_PostMessage\"}}], \"modules\": [\"neurologic.js\"], \"subject\": \"Nova Conta Criada - Popup - [Neurologic]\", \"version\": 2, \"waitTime\": 0, \"modalMode\": true, \"inputColor\": \"#ECAE26\", \"notifications\": [], \"userMainColor\": \"#2196F3\", \"alwaysAutoOpen\": true, \"robotMainColor\": \"#2196F3\", \"tooltipMessage\": \"<p class=\\\"p1\\\">Quer ver uma Demonstra&ccedil;&atilde;o Personalizada para seu Site? :sorriso_olhos_sorrindo:</p>\", \"userLightColor\": \"#eee\", \"robotLightColor\": \"#ECAE26\", \"userAccentColor\": \"#fff\", \"robotAccentColor\": \"#000\", \"gaConversionEvent\": null, \"fbqConversionEvents\": null, \"notificationsEnabled\": true, \"useAbsolutePositioning\": false, \"disable1stPartyBranding\": true, \"notificationsPerSession\": 1, \"notificationsDisplayTime\": 20000}",
mobile_content: "{\"to\":[\"[email protected]\"],\"from\":\"[email protected]\",\"side\":\"right\",\"title\":\"Ana - Neurologic\",\"avatar\":\"https://storage.googleapis.com/neuro-cdn/uploads/6280fa321cfb2271a60bde15e57a2931.png\",\"script\":[{\"from\":[\"Sim, começar agora\"],\"save\":\"nosync::0::Iniciar\",\"messages\":[{\"say\":\"Olá, tudo bem?\"},{\"say\":\"<p class=\\\"p1\\\">Quer ver uma <b>Demonstra&ccedil;&atilde;o Personalizada</b> para seu Site? :sorriso_olhos_sorrindo:</p>\"}]},{\"say\":\"<p>Ok, qual &eacute; a <b>URL do seu site</b>? Vou usar para criar a demonstra&ccedil;&atilde;o :piscando_olho:</p>\"},{\"save\":\"url\",\"type\":\"url\"},{\"say\":\"Agora algumas informações rápidas para criar sua conta :fogo:\"},{\"say\":\"Qual é o seu nome?\"},{\"save\":\"name\",\"type\":\"name\"},{\"say\":\"Prazer {previous-word} :abanando:\"},{\"say\":\"E o seu e-mail?\"},{\"save\":\"email\",\"type\":\"email\"},{\"say\":\"<p>Estamos quase finalizando:sorriso_olhos_arregalados:&nbsp; Agora informe um <b>n&uacute;mero de telefone</b>:</p>\"},{\"mask\":\"(99) 99999-9999\",\"save\":\"phone\",\"type\":\"phone\"},{\"say\":\"Insira uma <b>senha</b> de acesso a sua conta:\"},{\"save\":\"password\",\"type\":\"password\"},{\"say\":\"Por último, qual é o <b>volume de acessos</b> do seu site por mês?\"},{\"from\":[\"Até 1.000\",\"1.000 até 5.000\",\"Mais de 5.000\",\"Não sei\"],\"save\":\"acessos\",\"multi\":false,\"selector\":false},{\"say\":\"Obrigado! Viu como a nossa conversa é diferente de um formulário? :risadinha:\"},{\"say\":\"<p>Agora estou preparando sua demonstra&ccedil;&atilde;o...</p>\"},{\"api\":{\"data\":{\"url\":\"...\"},\"function\":\"nldAPI_Neurologic_PostMessage\"}}],\"modules\":[\"neurologic.js\"],\"subject\":\"Nova Conta Criada - Popup - [Neurologic]\",\"version\":2,\"waitTime\":0,\"modalMode\":true,\"inputColor\":\"#ECAE26\",\"notifications\":[],\"userMainColor\":\"#2196F3\",\"alwaysAutoOpen\":true,\"robotMainColor\":\"#2196F3\",\"tooltipMessage\":\"<p class=\\\"p1\\\">Quer ver uma Demonstra&ccedil;&atilde;o Personalizada para seu Site? :sorriso_olhos_sorrindo:</p>\",\"userLightColor\":\"#eee\",\"robotLightColor\":\"#ECAE26\",\"userAccentColor\":\"#fff\",\"robotAccentColor\":\"#000\",\"gaConversionEvent\":null,\"fbqConversionEvents\":null,\"notificationsEnabled\":true,\"useAbsolutePositioning\":false,\"disable1stPartyBranding\":true,\"notificationsPerSession\":1,\"notificationsDisplayTime\":20000}",
has_custom_design_mobile: true,
has_custom_notifications_mobile: true,
has_custom_script_mobile: true,
content_version_key: 1,
content_version_hash: nil,
content_version_date: nil,
mobile_content_version_key: 1,
mobile_content_version_hash: nil,
mobile_content_version_date: nil,
)
Script.find_or_initialize_by(id: 7995).update(script_version_id: 35873)
TrialPeriods::CreateTrialService.call!(Company.first.subscription)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment