Pular para conteúdo

MKDOCS

script.sh
#!/bin/bash

#===================================================#
# NAME...........:auto_install_mkdocks.sh           #
# VERSION........:1.12.0                            #
# DESCRIPTION....:Auto Instalação MkDocs            #
# CREATE DATE....:28/12/2022                        #
# AUTHOR.........:Ivan da Silva Bispo Junior        #
# MAINTAINER.....:Ivan da Silva Bispo Junior        #
# E-MAIL.........:contato@ivanjr.eti.br             #
# SITE...........:https://ivanjr.eti.br             #
# DISTRO.........:Debian GNU/Linux 11 (Bullseye)    #
# TESTED ON......:Bash 5.1.4                        #
#===================================================#

# esss instala o mkdocs no debian 11 bullseye com nginx e python 3.9
# https://www.mkdocs.org/#installation

clear

apt install wget net-tools tree python3-pip vim -y

apt install mkdocs -y
pip install mkdocs-material
pip3 install mkdocs-material mkdocs[i18n]
pip3 install mkdocs-material-extensions
pip3 install mkdocs-minify-plugin
pip3 install mkdocs-git-revision-date-localized-plugin
pip3 install mkdocs-git-authors-plugin
pip install mkdocs-windmill-dark
pip install mkdocs-windmill-light
pip install mkdocs-windmill
pip install mkdocs-rtd-dropdown
pip install mkdocs-gitbook


cd /opt/
mkdocs new mkdocs
cd /opt/mkdocs/
mkdocs build
clear
tree /opt/mkdocs/
sleep 5
clear

echo EOF > /opt/mkdocs/mkdocs.yml
site_name: My Docs
theme:
  name: material
  locale: pt_BR
EOF

echo EOF > /etc/systemd/system/mkdocs.service
[Unit]
Description=MKDocs
After=network.target

[Service]
Type=simple
User=root
Group=root
TimeoutStartSec=60
Restart=on-failure
RestartSec=10
RemainAfterExit=yes
WorkingDirectory=/opt/mkdocs
ExecStart=/bin/mkdocs serve
ExecReload=/bin/pkill mkdocs; /bin/mkdocs serve
ExecStop=/bin/pkill mkdocs

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable mkdocs
systemctl start mkdocs

apt install nginx
sed -i 's/# server_tokens/server_tokens/' /etc/nginx/nginx.conf
mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.original

echo EOF > /etc/nginx/sites-available/default
 server {
    listen 80;
    listen [::]:80;

    # Subdominios especifico
    #server_name mkdocs.remontti.com.br;
    # Todos o endereços
    server_name     172.16.0.17;

    location / {
        proxy_pass http://localhost:8000;
        proxy_set_header   Host $host;
    }
}
EOF

systemctl restart nginx