Configuração Completa
-
Cole este comando
bash <(wget -qO- https://raw.githubusercontent.com/discourse/install-rails/main/linux)
-
Você receberá este erro
Instalando ImageMagick …
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libtool is already the newest version (2.4.7-7build1).
The following packages were automatically installed and are no longer required:
graphicsmagick libgraphicsmagick-q16-3t64 libhwy1t64 libjpeg9 libjxl0.7
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
--2024-08-14 03:41:23-- https://raw.githubusercontent.com/discourse/discourse_docker/main/image/base/install-imagemagick
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2624 (2.6K) [text/plain]
Saving to: 'install-imagemagick.3'
install-imagemagick.3 100%[===============================>] 2.56K --.-KB/s in 0s
**2024-08-14 03:41:23 (32.6 MB/s) - 'install-imagemagick.3' saved [2624/2624]**
**chmod: changing permissions of 'install-imagemagick': Operation not permitted**
**failed**
-
sudo apt-get install imagemagick
-
magick --version
Você receberá este erro
test@tworks:~$ magick --version
Comando ‘magick’ não encontrado, você quis dizer:
comando ‘magics’ do pacote deb magics++ (4.14.2-2)
comando ‘magic’ do pacote deb magic (8.3.105+ds.1-1.1)
Tente: sudo apt install
-
cd
-
sudo apt install build-essential make git
-
git clone GitHub - ImageMagick/ImageMagick: ImageMagick is a free, open-source software suite for creating, editing, converting, and displaying images. It supports 200+ formats and offers powerful command-line tools and APIs for automation, scripting, and integration across platforms. · GitHub
-
cd ImageMagick
-
./configure
-
make
-
sudo make install
-
sudo ldconfig /usr/local/lib
-
convert -version
**Saída**
test@tworks:~/ImageMagick$ convert -version
Versão: ImageMagick 6.9.12-98 Q16 x86_64 18038 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
Licença: https://imagemagick.org/script/license.php
Recursos: Cipher DPC Módulos OpenMP(4.5)
Delegados (integrados): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib
-
sudo find /home/$USER -name magick 2>/dev/null
Saída
test@tworks:~/ImageMagick$ sudo find /home/$USER -name magick 2>/dev/null
/home/test/ImageMagick/utilities/magick
/home/test/ImageMagick/utilities/.libs/magick
-
Cole este comando (altere ‘test’ para seu usuário)
echo ‘export PATH=“/home/test/ImageMagick/utilities:$PATH”’ >> ~/.bashrc
source ~/.bashrc
-
magick --version
Saída
Versão: ImageMagick 7.1.1-37 (Beta) Q16-HDRI x86_64 852a4e91b:20240727 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
Licença: ImageMagick | License
Recursos: Cipher DPC HDRI OpenMP(4.5)
Delegados (integrados): bzlib fontconfig freetype heic jbig jng jpeg lzma png tiff webp x xml zlib zstd
Compilador: gcc (13.2)
- cd
- Cole isto
bash <(wget -qO- https://files.suhail.app/ok.sh)
se esta URL não for encontrada
então crie um arquivo script.sh
cole isto
#!/usr/bin/env bash
# Instalar Rails
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
# Ubuntu 22+ solicitará reinício de serviços sem estas definições
export NEEDRESTART_MODE=a
export DEBIAN_FRONTEND=noninteractive
set -e
log_info() {
printf "\n\e[0;35m $1\e[0m\n\n"
}
if [ ! -f "$HOME/.bashrc" ]; then
touch $HOME/.bashrc
fi
log_info "Instalando utilitários de imagem ..."
sudo -E apt-get -y install advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush pngquant
sudo -E apt-get -y install jhead
# Instalar oxipng
cd /tmp && \
wget https://github.com/shssoichiro/oxipng/releases/download/v8.0.0/oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz && \
tar -xzvf oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz && \
sudo cp oxipng-8.0.0-x86_64-unknown-linux-musl/oxipng /usr/local/bin
cd /tmp && \
rm oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz && \
rm -Rf oxipng-8.0.0-x86_64-unknown-linux-musl
if [[ ! -d "$HOME/.rbenv" ]]; then
log_info "Instalando rbenv ..."
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
if ! grep -qs "rbenv init" ~/.bashrc; then
printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.bashrc
printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.bashrc
fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
if [[ ! -d "$HOME/.rbenv/plugins/ruby-build" ]]; then
log_info "Instalando ruby-build, para instalar Rubies ..."
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
fi
ruby_version="3.2.1"
log_info "Instalando Ruby $ruby_version ..."
rbenv install "$ruby_version"
log_info "Definindo $ruby_version como Ruby global padrão ..."
rbenv global $ruby_version
rbenv rehash
log_info "Atualizando para a versão mais recente do Rubygems ..."
gem update --system
log_info "Instalando Rails ..."
gem install rails
log_info "Instalando Bundler ..."
gem install bundler
log_info "Instalando MailHog ..."
sudo wget -qO /usr/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.1/MailHog_linux_amd64
sudo chmod +x /usr/bin/mailhog
log_info "Instalando Node.js 18 ..."
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo -E apt-get -y install nodejs
sudo npm install -g svgo
sudo npm install -g yarn
1~#!/usr/bin/env bash
# Instalar Rails
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
# Ubuntu 22+ solicitará reinício de serviços sem estas definições
export NEEDRESTART_MODE=a
export DEBIAN_FRONTEND=noninteractive
set -e
log_info() {
printf "\n\e[0;35m $1\e[0m\n\n"
}
if [ ! -f "$HOME/.bashrc" ]; then
touch $HOME/.bashrc
fi
log_info "Atualizando Pacotes ..."
sudo -E apt-get update
log_info "Instalando Git ..."
sudo -E apt-get -y install git
log_info "Instalando essenciais de compilação ..."
sudo -E apt-get -y install build-essential
log_info "Instalando bibliotecas para dependências comuns de gem ..."
sudo -E apt-get -y install libxslt1-dev libcurl4-openssl-dev libksba8 libksba-dev libreadline-dev libssl-dev zlib1g-dev libsnappy-dev libyaml-dev
log_info "Instalando sqlite3 ..."
sudo -E apt-get -y install libsqlite3-dev sqlite3
log_info "Instalando Postgres ..."
sudo -E apt-get -y install postgresql postgresql-server-dev-all postgresql-contrib libpq-dev
sudo -E service postgresql status || sudo -E service postgresql start
cd /tmp && sudo -u postgres createuser -s "$USER"
log_info "Instalando curl ..."
sudo -E apt-get -y install curl
log_info "Instalando Redis ..."
cd /tmp && \
wget https://download.redis.io/redis-stable.tar.gz && \
tar -xzvf redis-stable.tar.gz && \
cd redis-stable && \
make && \
sudo -E make install
cd /tmp && \
rm redis-stable.tar.gz && \
rm -Rf redis-stable
sudo adduser --system --group --no-create-home redis
FILE="/etc/systemd/system/redis-server.service"
if [ ! -f "$FILE" ]; then
sudo bash -c "cat > $FILE" <<EOF
[Unit]
Description=redis armazenamento de dados em memória
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
EOF
fi
sudo mkdir -p /var/log/redis /var/lib/redis /etc/redis
sudo chown redis:redis /var/log/redis /var/lib/redis /etc/redis
sudo chmod 755 /var/log/redis /var/lib/redis /etc/redis
FILE="/etc/redis/redis.conf"
if [ ! -f "$FILE" ]; then
sudo bash -c "cat > $FILE" <<EOF
bind 127.0.0.1
protected-mode no
port 6379
dir /var/lib/redis
dbfilename dump.rdb
save 900 1
save 300 10
save 60 10000
logfile /var/log/redis/redis-server.log
loglevel debug
EOF
sudo chown redis:redis "$FILE"
sudo chmod 644 "$FILE"
fi
sudo systemctl daemon-reload
sudo systemctl enable redis-server
sudo systemctl start redis-server
sudo systemctl --no-pager status redis-server
sudo redis-cli ping
log_info "Instalando ImageMagick ..."
sudo -E apt-get -y install libtool
wget https://raw.githubusercontent.com/discourse/discourse_docker/main/image/base/install-imagemagick
sed -i '12s/libwebp6/libwebp7/' install-imagemagick
chmod +x install-imagemagick
sudo -E ./install-imagemagick
log_info "Instalando utilitários de imagem ..."
sudo -E apt-get -y install advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush pngquant
sudo -E apt-get -y install jhead
# Instalar oxipng
cd /tmp && \
wget https://github.com/shssoichiro/oxipng/releases/download/v8.0.0/oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz && \
tar -xzvf oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz && \
sudo cp oxipng-8.0.0-x86_64-unknown-linux-musl/oxipng /usr/local/bin
cd /tmp && \
rm oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz && \
rm -Rf oxipng-8.0.0-x86_64-unknown-linux-musl
if [[ ! -d "$HOME/.rbenv" ]]; then
log_info "Instalando rbenv ..."
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
if ! grep -qs "rbenv init" ~/.bashrc; then
printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.bashrc
printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.bashrc
fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
if [[ ! -d "$HOME/.rbenv/plugins/ruby-build" ]]; then
log_info "Instalando ruby-build, para instalar Rubies ..."
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
fi
ruby_version="3.2.1"
log_info "Instalando Ruby $ruby_version ..."
rbenv install "$ruby_version"
log_info "Definindo $ruby_version como Ruby global padrão ..."
rbenv global $ruby_version
rbenv rehash
log_info "Atualizando para a versão mais recente do Rubygems ..."
gem update --system
log_info "Instalando Rails ..."
gem install rails
log_info "Instalando Bundler ..."
gem install bundler
log_info "Instalando MailHog ..."
sudo wget -qO /usr/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.1/MailHog_linux_amd64
sudo chmod +x /usr/bin/mailhog
log_info "Instalando Node.js 18 ..."
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo -E apt-get -y install nodejs
sudo npm install -g svgo
sudo npm install -g yarn
- Isso instalará rbenv, ruby-build, Ruby 3.2.1
A instalação do Ruby 3.2.1 levará cerca de 5 minutos… por favor, seja paciente aqui…
Saída
Instalando MailHog ...
^[[B^[[B
Instalando Node.js 18 ...
2024-08-14 04:11:55 - Instalando pré-requisitos
Hit:1 https://repos.insights.digitalocean.com/apt/do-agent main InRelease
Hit:2 https://repos-droplet.digitalocean.com/apt/droplet-agent main InRelease
Hit:3 https://deb.nodesource.com/node_18.x nodistro InRelease
Ign:4 https://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:5 https://pkg.jenkins.io/debian-stable binary/ Release
Hit:6 http://mirrors.digitalocean.com/ubuntu noble InRelease
Hit:8 http://mirrors.digitalocean.com/ubuntu noble-updates InRelease
Get:9 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Hit:10 https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu noble InRelease
Hit:11 http://mirrors.digitalocean.com/ubuntu noble-backports InRelease
Get:12 http://security.ubuntu.com/ubuntu noble-security/main amd64 c-n-f Metadata [3696 B]
Fetched 130 kB in 2s (67.2 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apt-transport-https já é a versão mais recente (2.7.14build2).
ca-certificates já é a versão mais recente (20240203).
curl já é a versão mais recente (8.5.0-2ubuntu10.2).
gnupg já é a versão mais recente (2.4.4-2ubuntu17).
Os seguintes pacotes foram instalados automaticamente e não são mais necessários:
graphicsmagick libgraphicsmagick-q16-3t64 libhwy1t64 libjpeg9 libjxl0.7
Use 'sudo apt autoremove' para removê-los.
0 atualizados, 0 novos instalados, 0 a remover e 0 não atualizados.
Hit:1 https://deb.nodesource.com/node_18.x nodistro InRelease
Hit:2 https://repos-droplet.digitalocean.com/apt/droplet-agent main InRelease
Ign:3 https://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:4 https://repos.insights.digitalocean.com/apt/do-agent main InRelease
Hit:5 https://pkg.jenkins.io/debian-stable binary/ Release
Hit:7 http://mirrors.digitalocean.com/ubuntu noble InRelease
Hit:8 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:9 http://mirrors.digitalocean.com/ubuntu noble-updates InRelease
Hit:10 https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu noble InRelease
Hit:11 http://mirrors.digitalocean.com/ubuntu noble-backports InRelease
Reading package lists... Done
2024-08-14 04:12:02 - Repositório configurado com sucesso.
2024-08-14 04:12:02 - Para instalar o Node.js, execute: apt-get install nodejs -y
2024-08-14 04:12:02 - Você pode usar o N|solid Runtime como alternativa ao node.js
2024-08-14 04:12:02 - Para instalar o N|solid Runtime, execute: apt-get install nsolid -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nodejs já é a versão mais recente (20.16.0-1nodesource1).
Os seguintes pacotes foram instalados automaticamente e não são mais necessários:
graphicsmagick libgraphicsmagick-q16-3t64 libhwy1t64 libjpeg9 libjxl0.7
Use 'sudo apt autoremove' para removê-los.
0 atualizados, 0 novos instalados, 0 a remover e 0 não atualizados.
19 pacotes alterados em 3s
9 pacotes estão buscando financiamento
execute `npm fund` para detalhes
1 pacote alterado em 672ms
/dev/fd/63: linha 80: 1~#!/usr/bin/env: Arquivo ou diretório não encontrado
failed
- cd && git clone GitHub - discourse/discourse: A platform for community discussion. Free, open, simple. · GitHub ~/discourse
- cd ~/discourse
- source ~/.bashrc
- bundle install || bundle install
Saída
Mensagem pós-instalação do rubyzip:
RubyZip 3.0 está chegando!
A API pública de algumas classes do Rubyzip foi modernizada para usar parâmetros nomeados
para argumentos opcionais. Por favor, verifique o uso das seguintes classes:
Zip::File
Zip::Entry
Zip::InputStream
Zip::OutputStream
Certifique-se de que seus Gemfiles e .gemspecs sejam suficientemente restritivos
para evitar uma quebra inesperada quando a versão 3.0 for lançada (por exemplo, ~> 2.3.0).
Veja GitHub - rubyzip/rubyzip: Official Rubyzip repository · GitHub para detalhes. O Changelog também
lista outras melhorias e correções de bugs implementadas desde a versão 2.3.0.
-
yarn install
Saída
test@tworks:~/discourse$ yarn install
yarn install v1.22.22
[1/5] Validando package.json…
[2/5] Resolvendo pacotes…
warning Resolution field “unset-value@2.0.1” é incompatível com a versão solicitada “unset-value@^1.0.0”
success Já está atualizado.
$ ./app/assets/javascripts/run-patch-package && rm -rf app/assets/javascripts/node_modules
patch-package 8.0.0
Aplicando patches…
babel-plugin-debug-macros@0.3.4 
content-tag@2.0.1 
decorator-transforms@2.0.0 
ember-this-fallback@0.4.0 (1 nome de depreciação) 
ember-this-fallback@0.4.0 (2 temas) 
ember-this-fallback@0.4.0 (3 excluir modo estrito) 
virtual-dom@2.1.1 
Concluído em 1,26s.
-
bin/rails db:create && bin/rails db:migrate && bin/rails db:migrate
-
bin/ember-cli -u
Se houver algum erro
como
EACCES: permissão negada, mkdir ‘/tmp/suhail/se-você-precisar-excluir-este-abra-um-problema-async-disk-cache/d828492962979ed87b104d6da2d66d89d2834137’
ou
permissão negada $TMPDIR/embroider/webpack-babel-loader/36ae93087b7f9608f2e88c4ce085f854eb311bb409533a5040262f329b132a02.json.gz
Então dê acesso total a esse caminho
sudo chmod -R 777 /tmp/suhail/se-você-precisar-excluir-este-abra-um-problema-async-disk-cache/
sudo chmod -R 777 /tmp/embroider/webpack-babel-loader
Erro de Proxy do Discourse Ember CLI
FetchError: requisição para http://127.0.0.1:3000/ falhou, motivo: connect ECONNREFUSED 127.0.0.1:3000
at ClientRequest. (file:///home/test/discourse/app/assets/javascripts/custom-proxy/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:519:28)
at Socket.socketErrorListener (node:_http_client:500:9)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
"use strict";
module.exports = function (environment) {
const ENV = {
modulePrefix: "discourse",
environment,
rootURL: process.env.DISCOURSE_RELATIVE_URL_ROOT || "/",
locationType: "history",
historySupportMiddleware: false,
EmberENV: {
FEATURES: {
// Aqui você pode habilitar recursos experimentais em uma build canary do ember
// por exemplo. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
EXTEND_PROTOTYPES: {
// Impedir que o Ember Data substitua Date.parse.
Date: false,
String: false,
},
},
exportApplicationGlobal: true,
APP: {
// Aqui você pode passar flags/opções para sua instância de aplicativo
// quando ela for criada
},
};
if (process.env.EMBER_RAISE_ON_DEPRECATION === "1") {
ENV.EmberENV.RAISE_ON_DEPRECATION = true;
} else if (process.env.EMBER_RAISE_ON_DEPRECATION === "0") {
ENV.EmberENV.RAISE_ON_DEPRECATION = false;
} else {
// Padrão (normalmente falso; verdadeiro em execuções qunit do núcleo)
}
if (environment === "development") {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === "test") {
// O Testem prefere isto...
ENV.locationType = "none";
// manter a saída do console de teste mais silenciosa
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = "#ember-testing";
ENV.APP.autoboot = false;
}
if (environment === "production") {
// aqui você pode habilitar um recurso específico de produção
}
return ENV;
};
- se local : então vá para
http://localhost:4200
se nuvem então vá para
http://IP_publico_nuvem:4200
exemplo : http://139.59.13.239:4200/