-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor bugfix and new config files
- Loading branch information
Showing
6 changed files
with
102 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
server { | ||
#LISTEN PORT 80 | ||
listen CHANGE-PORT; | ||
#YOUR DOMAIN OR IP | ||
server_name CHANGE-DOMAIN; | ||
#INCRESE THE MAX TRANSFER | ||
client_max_body_size 32M; | ||
|
||
location / { | ||
|
||
proxy_pass http://127.0.0.1:8000; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
|
||
#STATIC LOCATION | ||
location /static/ { | ||
alias CHANGE-STATIC; | ||
} | ||
#MEDIA LOCATION | ||
location /media/ { | ||
alias CHANGE-STATIC; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#/etc/systemd/system/nameservice.service | ||
|
||
[Unit] | ||
Description=gunicorn daemon | ||
Requires=gunicorn.socket | ||
After=network.target | ||
|
||
[Service] | ||
Type=notify | ||
# the specific user that our service will run as | ||
User=someuser | ||
Group=someuser | ||
# another option for an even more restricted service is | ||
# DynamicUser=yes | ||
# see http://0pointer.net/blog/dynamic-users-with-systemd.html | ||
RuntimeDirectory=gunicorn | ||
WorkingDirectory=/home/someuser/applicationroot | ||
ExecStart=/usr/bin/gunicorn applicationname.wsgi | ||
ExecReload=/bin/kill -s HUP $MAINPID | ||
KillMode=mixed | ||
TimeoutStopSec=5 | ||
PrivateTmp=true | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#/etc/systemd/system/namesocket.socket | ||
|
||
[Unit] | ||
Description=gunicorn socket | ||
|
||
[Socket] | ||
ListenStream=/run/gunicorn.sock | ||
# Our service won't need permissions for the socket, since it | ||
# inherits the file descriptor by socket activation | ||
# only the nginx daemon will need access to the socket | ||
SocketUser=www-data | ||
# Optionally restrict the socket permissions even more. | ||
# SocketMode=600 | ||
|
||
[Install] | ||
WantedBy=sockets.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,54 @@ | ||
#!/bin/sh | ||
|
||
############################### | ||
# Programa: install.sh | ||
# Desenvolvido por: Vineees (@thevinisouza) | ||
# Data de Criacao: 12/05/2024 | ||
# Versao: 1.0.0 | ||
############################### | ||
|
||
python --version | ||
sleep 2 | ||
|
||
echo "Antes de Iniciar a Instalação Verique se Já Configurou o .env!" | ||
echo"" | ||
echo "Deseja Continuar?" | ||
read -p "Press enter to continue""" | ||
|
||
echo "Instalando Pacotes!" | ||
sleep 2 | ||
sudo apt install nginx | ||
sudo apt install cron | ||
|
||
echo "Criando Enviroment" | ||
sleep 2 | ||
# Create environment | ||
python3 -m venv env | ||
# Enter environment | ||
. env/bin/activate | ||
|
||
echo "Enviroment Criado!" | ||
echo "Instalando dependencias!" | ||
|
||
echo "Instalando dependencias!" | ||
# Install Deps | ||
python3 -m pip install -r ./requirements.txt | ||
|
||
echo "Dependencias instaladas!" | ||
echo "Configurando Database!" | ||
|
||
echo "Configurando Database!" | ||
python3 manage.py makemigrations | ||
python3 manage.py migrate | ||
echo "Database Configurada!" | ||
|
||
echo "Database Configurado!" | ||
echo "Copiando Estaticos" | ||
|
||
cp ./media /var/www/html/Morea/ | ||
read -p “Informe o caminho completo para o diretorio dos estaticos (Ex:/var/www/html/morea/): “ STATICFOLDER | ||
cp ./media $STATICFOLDER | ||
python3 manage.py collectstatic --noinput | ||
|
||
echo "Estaticos Copiados!" | ||
echo "Estaticos Copiados!" | ||
|
||
echo "Iniciando Configuração do Web Server" | ||
read -p “Porta para hospedar o Serviço: “ NGINXPORT | ||
read -p “Nome no qual o Nginx escutara o request (localhost, domain.net, 192.168.1.1, etc...): “ NGINXDOMAIN | ||
sed -i 's/CHANGE-PORT/$NGINXPORT/' ./config/morea.conf | ||
sed -i 's/CHANGE-DOMAIN/$NGINXDOMAIN/' ./config/morea.conf | ||
sed -i 's/CHANGE-STATIC/$STATICFOLDER/' ./config/morea.conf | ||
cp ./config/morea.conf /etc/nginx/sites-available | ||
ln -s /etc/nginx/sites-available/morea.conf /etc/nginx/sites-enabled/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters