Compare commits
No commits in common. "8098b2bf837ac2f89d04947e89d0b9799ccee5b5" and "488ad959c0078b2d38d23870a4c2b39b3dd689c9" have entirely different histories.
8098b2bf83
...
488ad959c0
22 changed files with 174 additions and 622 deletions
|
|
@ -7,7 +7,7 @@ from paramecio2.libraries.db.coreforms import SelectForm, SelectModelForm, Hidde
|
||||||
from paramecio2.libraries.mtemplates import PTemplate, env_theme
|
from paramecio2.libraries.mtemplates import PTemplate, env_theme
|
||||||
from paramecio2.libraries import datetime
|
from paramecio2.libraries import datetime
|
||||||
from paramecio2.libraries.urls import make_media_url
|
from paramecio2.libraries.urls import make_media_url
|
||||||
#from modules.monit.models.monit import Server, ServerData, Alerts
|
from modules.monit.models.monit import Server, ServerData, Alerts
|
||||||
from modules.pastafari2.libraries.scandir import scandir
|
from modules.pastafari2.libraries.scandir import scandir
|
||||||
from paramecio2.libraries.db.webmodel import WebModel
|
from paramecio2.libraries.db.webmodel import WebModel
|
||||||
from paramecio2.libraries.lists import AjaxList
|
from paramecio2.libraries.lists import AjaxList
|
||||||
|
|
@ -224,7 +224,7 @@ def pastafari2_add_server_task():
|
||||||
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
ssh_port='22'
|
|
||||||
|
|
||||||
|
|
||||||
#make ping to server
|
#make ping to server
|
||||||
|
|
@ -233,10 +233,6 @@ def pastafari2_add_server_task():
|
||||||
error=1
|
error=1
|
||||||
error_form['#server_host_error']=I18n.lang('pastafari2', 'error_hostname', 'Error: you need enter a valid hostname')
|
error_form['#server_host_error']=I18n.lang('pastafari2', 'error_hostname', 'Error: you need enter a valid hostname')
|
||||||
|
|
||||||
if server_username=='':
|
|
||||||
error=1
|
|
||||||
error_form['#server_username_error']=I18n.lang('pastafari2', 'error_username', 'Error: you need enter a valid username for the server')
|
|
||||||
|
|
||||||
txt_error=''
|
txt_error=''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -256,9 +252,7 @@ def pastafari2_add_server_task():
|
||||||
arr_group=server_group.set_conditions('WHERE id=%s', [group_id]).select_a_row_where()
|
arr_group=server_group.set_conditions('WHERE id=%s', [group_id]).select_a_row_where()
|
||||||
group_name=arr_group['code_group']
|
group_name=arr_group['code_group']
|
||||||
|
|
||||||
# 'url_stats': config.domain_url+url_for('monit_app.monit_get_data', api_key=config.monit_api_key)
|
data={'ssh_user': ssh_user, 'pub_key': public_key, 'url_stats': config.domain_url+url_for('monit_app.monit_get_data', api_key=config.monit_api_key), 'hostname': server_host, 'ip': ip, 'group_id': group_id, 'group_name': group_name}
|
||||||
|
|
||||||
data={'ssh_user': ssh_user, 'pub_key': public_key, 'hostname': server_host, 'ip': ip, 'group_id': group_id, 'group_name': group_name}
|
|
||||||
|
|
||||||
with SSHTask(server_host, db, remote_user=server_username, remote_password=server_password, private_key=private_key, remote_path=remote_path, task_id=task_id, data=data, port=ssh_port) as ssh_task:
|
with SSHTask(server_host, db, remote_user=server_username, remote_password=server_password, private_key=private_key, remote_path=remote_path, task_id=task_id, data=data, port=ssh_port) as ssh_task:
|
||||||
if not ssh_task.prepare_connection():
|
if not ssh_task.prepare_connection():
|
||||||
|
|
|
||||||
|
|
@ -480,7 +480,7 @@ class Task:
|
||||||
#self.task.conditions=['WHERE id=%s', [self.id]]
|
#self.task.conditions=['WHERE id=%s', [self.id]]
|
||||||
#self.task.update({'error': 1, 'status': 1})
|
#self.task.update({'error': 1, 'status': 1})
|
||||||
|
|
||||||
self.logtask.insert({'task_id': self.id, 'progress': 100, 'message': 'Malformed json code: '+str(line).strip(), 'error': 1, 'status': 1, 'server': self.server})
|
self.logtask.insert({'task_id': self.id, 'progress': 100, 'message': 'Malformed json code: '+str(line), 'error': 1, 'status': 1, 'server': self.server})
|
||||||
self.make_error_task()
|
self.make_error_task()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -511,7 +511,7 @@ class Task:
|
||||||
#self.task.conditions=['WHERE id=%s', [self.id]]
|
#self.task.conditions=['WHERE id=%s', [self.id]]
|
||||||
#self.task.update({'error': 0, 'status':0})
|
#self.task.update({'error': 0, 'status':0})
|
||||||
|
|
||||||
self.logtask.insert({'task_id': self.id, 'progress': 0, 'no_progress': 1, 'message': str(line).strip(), 'error': 0, 'status': 0, 'server': self.server})
|
self.logtask.insert({'task_id': self.id, 'progress': 0, 'no_progress': 1, 'message': str(line), 'error': 0, 'status': 0, 'server': self.server})
|
||||||
|
|
||||||
#return False
|
#return False
|
||||||
|
|
||||||
|
|
|
||||||
7
media/js/Chart.min.js
vendored
7
media/js/Chart.min.js
vendored
File diff suppressed because one or more lines are too long
1
media/js/luxon.min.js
vendored
1
media/js/luxon.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -204,7 +204,7 @@ class Task(WebModel):
|
||||||
return False
|
return False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
q = Queue(connection=Redis())
|
#q = Queue(connection=Redis())
|
||||||
|
|
||||||
if yes_parent:
|
if yes_parent:
|
||||||
arr_task=self.select_a_row(task_id)
|
arr_task=self.select_a_row(task_id)
|
||||||
|
|
@ -225,23 +225,21 @@ class Task(WebModel):
|
||||||
final_sql=sql_insert+", ".join(sql_insert_values)
|
final_sql=sql_insert+", ".join(sql_insert_values)
|
||||||
|
|
||||||
self.query(final_sql)
|
self.query(final_sql)
|
||||||
|
"""
|
||||||
with self.query('select id from task WHERE parent_id=%s', [task_id]) as cursor:
|
with self.query('select id from task WHERE parent_id=%s', [task_id]) as cursor:
|
||||||
|
|
||||||
for row in cursor:
|
for row in cursor:
|
||||||
#print(row)
|
#print(row)
|
||||||
result = q.enqueue(task, row['id'], job_timeout=3600)
|
result = q.enqueue(task, row['id'], job_timeout=3600)
|
||||||
else:
|
"""
|
||||||
|
|
||||||
result = q.enqueue(task, task_id, job_timeout=3600)
|
return self.send_task_to_server()
|
||||||
|
|
||||||
#return self.send_task_to_server()
|
|
||||||
|
|
||||||
#result = q.enqueue(task, task_id, job_timeout=3600)
|
#result = q.enqueue(task, task_id, job_timeout=3600)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Function for send task to task server if not using rq worker
|
# Function for send task to task server
|
||||||
|
|
||||||
def send_task_to_server(self):
|
def send_task_to_server(self):
|
||||||
|
|
||||||
|
|
@ -342,13 +340,10 @@ def task(task_id):
|
||||||
final_task.exec()
|
final_task.exec()
|
||||||
|
|
||||||
except:
|
except:
|
||||||
"""
|
|
||||||
if not conn:
|
if conn==None:
|
||||||
conn=WebModel.connection()
|
conn=WebModel.connection()
|
||||||
logtask.sqlclass=conn
|
logtask.sqlclass=conn
|
||||||
"""
|
|
||||||
logtask=LogTask(conn)
|
|
||||||
logtask.safe_query()
|
|
||||||
|
|
||||||
logtask.insert({'task_id': task_id, 'progress': 100, 'message': I18n.lang('pastafari', 'error_in_task', 'Error: error in task ')+traceback.format_exc(), 'error': 1, 'status': 1, 'server': server})
|
logtask.insert({'task_id': task_id, 'progress': 100, 'message': I18n.lang('pastafari', 'error_in_task', 'Error: error in task ')+traceback.format_exc(), 'error': 1, 'status': 1, 'server': server})
|
||||||
|
|
||||||
|
|
@ -372,7 +367,7 @@ class LogTask(WebModel):
|
||||||
self.register(IpField('server'))
|
self.register(IpField('server'))
|
||||||
self.register(corefields.DoubleField('progress'))
|
self.register(corefields.DoubleField('progress'))
|
||||||
self.register(corefields.BooleanField('no_progress'))
|
self.register(corefields.BooleanField('no_progress'))
|
||||||
self.register(corefields.LongTextField('message'))
|
self.register(corefields.TextField('message'))
|
||||||
self.register(corefields.BooleanField('error'))
|
self.register(corefields.BooleanField('error'))
|
||||||
self.register(corefields.BooleanField('status'))
|
self.register(corefields.BooleanField('status'))
|
||||||
self.register(ArrayField('data', corefields.CharField('data')))
|
self.register(ArrayField('data', corefields.CharField('data')))
|
||||||
|
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Gitea (Git with a cup of tea)
|
|
||||||
After=syslog.target
|
|
||||||
After=network.target
|
|
||||||
###
|
|
||||||
# Don't forget to add the database service dependencies
|
|
||||||
###
|
|
||||||
#
|
|
||||||
#Wants=mysql.service
|
|
||||||
#After=mysql.service
|
|
||||||
#
|
|
||||||
#Wants=mariadb.service
|
|
||||||
#After=mariadb.service
|
|
||||||
#
|
|
||||||
#Wants=postgresql.service
|
|
||||||
#After=postgresql.service
|
|
||||||
#
|
|
||||||
#Wants=memcached.service
|
|
||||||
#After=memcached.service
|
|
||||||
#
|
|
||||||
#Wants=redis.service
|
|
||||||
#After=redis.service
|
|
||||||
#
|
|
||||||
###
|
|
||||||
# If using socket activation for main http/s
|
|
||||||
###
|
|
||||||
#
|
|
||||||
#After=gitea.main.socket
|
|
||||||
#Requires=gitea.main.socket
|
|
||||||
#
|
|
||||||
###
|
|
||||||
# (You can also provide gitea an http fallback and/or ssh socket too)
|
|
||||||
#
|
|
||||||
# An example of /etc/systemd/system/gitea.main.socket
|
|
||||||
###
|
|
||||||
##
|
|
||||||
## [Unit]
|
|
||||||
## Description=Gitea Web Socket
|
|
||||||
## PartOf=gitea.service
|
|
||||||
##
|
|
||||||
## [Socket]
|
|
||||||
## Service=gitea.service
|
|
||||||
## ListenStream=<some_port>
|
|
||||||
## NoDelay=true
|
|
||||||
##
|
|
||||||
## [Install]
|
|
||||||
## WantedBy=sockets.target
|
|
||||||
##
|
|
||||||
###
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
|
|
||||||
# LimitNOFILE=524288:524288
|
|
||||||
RestartSec=2s
|
|
||||||
Type=simple
|
|
||||||
User=gitea
|
|
||||||
Group=gitea
|
|
||||||
WorkingDirectory=/var/lib/gitea/
|
|
||||||
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
|
|
||||||
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
|
|
||||||
#RuntimeDirectory=gitea
|
|
||||||
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
|
|
||||||
Restart=always
|
|
||||||
Environment=USER=gitea HOME=/home/gitea GITEA_WORK_DIR=/var/lib/gitea
|
|
||||||
WatchdogSec=30s
|
|
||||||
# If you install Git to directory prefix other than default PATH (which happens
|
|
||||||
# for example if you install other versions of Git side-to-side with
|
|
||||||
# distribution version), uncomment below line and add that prefix to PATH
|
|
||||||
# Don't forget to place git-lfs binary on the PATH below if you want to enable
|
|
||||||
# Git LFS support
|
|
||||||
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
|
|
||||||
# If you want to bind Gitea to a port below 1024, uncomment
|
|
||||||
# the two values below, or use socket activation to pass Gitea its ports as above
|
|
||||||
###
|
|
||||||
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
|
||||||
#AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
||||||
###
|
|
||||||
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
|
|
||||||
# set the following value to false to allow capabilities to be applied on gitea process. The following
|
|
||||||
# value if set to true sandboxes gitea service and prevent any processes from running with privileges
|
|
||||||
# in the host user namespace.
|
|
||||||
###
|
|
||||||
#PrivateUsers=false
|
|
||||||
###
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
@ -1,190 +0,0 @@
|
||||||
#!/opt/pythonenv/bin/python3 -u
|
|
||||||
|
|
||||||
import sys, os
|
|
||||||
import subprocess
|
|
||||||
import argparse
|
|
||||||
import platform
|
|
||||||
import shutil
|
|
||||||
import pathlib
|
|
||||||
import distro
|
|
||||||
import pwd
|
|
||||||
import getpass
|
|
||||||
import re
|
|
||||||
import platform
|
|
||||||
|
|
||||||
#import pymysql.cursors
|
|
||||||
#pymysql.install_as_MySQLdb
|
|
||||||
|
|
||||||
pyv=platform.python_version_tuple()
|
|
||||||
|
|
||||||
if pyv[0]!='3':
|
|
||||||
print('Need python 3 for execute this script')
|
|
||||||
sys.exit(1)
|
|
||||||
"""
|
|
||||||
parser = argparse.ArgumentParser(description='Script for create a Gitea site.')
|
|
||||||
|
|
||||||
parser.add_argument('--domain', help='The domain where is the site', required=True)
|
|
||||||
parser.add_argument('--home_user', help='The name of the new user', required=True)
|
|
||||||
parser.add_argument('--user', help='The name of the domain user', required=True)
|
|
||||||
parser.add_argument('--path', help='The path of the gitea install')
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
"""
|
|
||||||
|
|
||||||
linux_distro=distro.id()
|
|
||||||
"""
|
|
||||||
home_user=args.home_user
|
|
||||||
|
|
||||||
if home_user.find('/', -1)==-1:
|
|
||||||
print("Error: you need backslash in home_user option")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
user=args.user
|
|
||||||
"""
|
|
||||||
|
|
||||||
apache_cmd='apache2'
|
|
||||||
apachectl='apache2ctl'
|
|
||||||
|
|
||||||
if linux_distro!='debian' and linux_distro!='ubuntu':
|
|
||||||
|
|
||||||
apache_cmd='httpd'
|
|
||||||
apachectl='apachectl'
|
|
||||||
|
|
||||||
if linux_distro=='rocky' or linux_distro=='fedora':
|
|
||||||
apache_group='apache'
|
|
||||||
|
|
||||||
if linux_distro=='arch':
|
|
||||||
apache_group='http'
|
|
||||||
|
|
||||||
system_user=getpass.getuser()
|
|
||||||
"""
|
|
||||||
path='/'
|
|
||||||
|
|
||||||
if args.path:
|
|
||||||
|
|
||||||
if args.path.find('/', -1)==-1:
|
|
||||||
print("Error: you need backslash in path option")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
path=args.path[:-1]
|
|
||||||
|
|
||||||
if path=='':
|
|
||||||
path='/'
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
print("Downloading gitea binary...")
|
|
||||||
|
|
||||||
arch_cpu=platform.uname().machine
|
|
||||||
|
|
||||||
if arch_cpu!='aarch64' and arch_cpu!='x86_64':
|
|
||||||
print("Error, {} is not supported\n".format(arch_cpu))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# aarch64 x86_64 only
|
|
||||||
|
|
||||||
#sudo wget -O /tmp/gitea https://dl.gitea.io/gitea/1.20/gitea-1.20-linux-amd64 && sudo mv /tmp/gitea /usr/local/bin
|
|
||||||
#curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest | grep 'browser_download_url' | cut -d\" -f4 | grep 'linux-amd64$'
|
|
||||||
|
|
||||||
archs={}
|
|
||||||
|
|
||||||
archs['aarch64']='arm64'
|
|
||||||
archs['x86_64']='amd64'
|
|
||||||
|
|
||||||
if os.path.isfile('/usr/local/bin/gitea'):
|
|
||||||
print("Error, an installation of gitea exists, please, delete old installation\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
#get_url_last_version="wget -O /tmp/gitea `curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest | grep 'browser_download_url' | cut -d '\"' -f4 | grep 'linux-{}$'` && sudo mv /tmp/gitea /usr/local/bin && sudo useradd -m -s /bin/bash gitea && chmod +x /usr/local/bin/gitea".format(archs[arch_cpu])
|
|
||||||
|
|
||||||
# curl -o file.pdf https://your-domain-name/long-file-name.pdf
|
|
||||||
# wget -O /tmp/gitea https://dl.gitea.com/gitea/$GITEA_VERSION/gitea-$GITEA_VERSION-linux-{} &&\
|
|
||||||
|
|
||||||
get_url_last_version="curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest | grep 'browser_download_url' | cut -d '\"' -f4 | grep 'linux-{}$' | grep -Eo '[0-9]\.[0-9]+\.[0-9]+' | head -1".format(archs[arch_cpu])
|
|
||||||
|
|
||||||
print("Downloading and installing Gitea...\n")
|
|
||||||
|
|
||||||
#if subprocess.call(get_url_last_version, shell=True) > 0:
|
|
||||||
|
|
||||||
proc=subprocess.Popen(get_url_last_version, shell=True, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
if proc.returncode:
|
|
||||||
print("Error, cannot download the last version for Gitea\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
gitea_version=proc.stdout.read().decode('UTF-8').strip()
|
|
||||||
|
|
||||||
download_gitea="wget -O /tmp/gitea https://dl.gitea.com/gitea/{}/gitea-{}-linux-{} &&\
|
|
||||||
sudo mv /tmp/gitea /usr/local/bin && \
|
|
||||||
sudo useradd -m -s /bin/bash gitea && chmod +x /usr/local/bin/gitea".format(gitea_version, gitea_version, archs[arch_cpu])
|
|
||||||
|
|
||||||
print("Downloading Gitea...\n")
|
|
||||||
|
|
||||||
if subprocess.call(download_gitea, shell=True) > 0:
|
|
||||||
print("Error, cannot the last version for Gitea\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
print("Creating directory system for Gitea..\n")
|
|
||||||
|
|
||||||
dir_gitea="sudo mkdir -p /var/lib/gitea/{custom,data,log} && sudo chown -R gitea:gitea /var/lib/gitea/ && sudo chmod -R 750 /var/lib/gitea/ && sudo mkdir /etc/gitea && sudo chown root:gitea /etc/gitea && sudo chmod 770 /etc/gitea"
|
|
||||||
|
|
||||||
if subprocess.call(dir_gitea, shell=True) > 0:
|
|
||||||
print("Error, cannot create the directories for Gitea\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
print("Creating the Systemd service for GITEA...")
|
|
||||||
|
|
||||||
# && sudo systemctl enable --now gitea
|
|
||||||
|
|
||||||
"""
|
|
||||||
if subprocess.call('sudo wget https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service -P /etc/systemd/system/'), shell=True) > 0:
|
|
||||||
print("Error, cannot create the service for Gitea\n")
|
|
||||||
sys.exit(1)
|
|
||||||
"""
|
|
||||||
|
|
||||||
if subprocess.call('sudo cp modules/pastafari2/scripts/servers/cvs/files/gitea.service /etc/systemd/system/ && sudo systemctl start gitea && sudo systemctl enable gitea', shell=True) > 0:
|
|
||||||
print("Error, cannot create and run the service for Gitea\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
"""
|
|
||||||
base_name_file='{}-{}.conf'.format(args.domain, name)
|
|
||||||
|
|
||||||
name_file='/home/{}/{}-{}.conf'.format(system_user, args.domain, name)
|
|
||||||
|
|
||||||
with open(name_file, 'w') as f:
|
|
||||||
|
|
||||||
f.write("<Location %s>\n" % path)
|
|
||||||
#ProxyPass unix:/home/root/flask_rest/flaskrest.sock|http://127.0.0.1/
|
|
||||||
f.write("ProxyPass http://127.0.0.1:3000/\n")
|
|
||||||
f.write("ProxyPassReverse http://127.0.0.1:3000/\n")
|
|
||||||
f.write("</Location>\n")
|
|
||||||
|
|
||||||
if path=='/':
|
|
||||||
|
|
||||||
f.write("<Location %s.well-known/acme-challenge/>\n" % path)
|
|
||||||
f.write("ProxyPass !\n")
|
|
||||||
f.write("</Location>\n")
|
|
||||||
|
|
||||||
print('Updating apache configuration for wordpress outside of htdocs...')
|
|
||||||
if subprocess.call('sudo mv {} /etc/{}/vhosts.d/extra && sudo chown root:root /etc/{}/vhosts.d/extra/{}'.format(name_file, apache_cmd, apache_cmd, base_name_file), shell=True) > 0:
|
|
||||||
print('Error')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
print("Preparing apache for use proxy http...")
|
|
||||||
|
|
||||||
if linux_distro=='debian' or linux_distro=='ubuntu':
|
|
||||||
if subprocess.call('sudo a2enmod proxy_http', shell=True) > 0:
|
|
||||||
print("Error: cannot enable proxy_http in apache in debian/ubuntu distro")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
service=args.domain+'-'+name
|
|
||||||
|
|
||||||
if subprocess.call("sudo systemctl enable %s && sudo systemctl start %s && sudo systemctl restart %s" % (service, service, apache_cmd), shell=True) > 0:
|
|
||||||
print("Error: cannot update and restart apache")
|
|
||||||
sys.exit(1)
|
|
||||||
"""
|
|
||||||
|
|
||||||
print("Gitea installed successfully! You can access via :3000 http port")
|
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ sudo /opt/certbot/bin/pip install --upgrade pip
|
||||||
|
|
||||||
sudo /opt/certbot/bin/pip install certbot certbot
|
sudo /opt/certbot/bin/pip install certbot certbot
|
||||||
|
|
||||||
echo "0 0,12 * * * root /opt/certbot/bin/python -c 'import random; import time; time.sleep(random.random() * 3600)' && sudo certbot renew -q" | sudo tee -a /etc/cron.d/certbot > /dev/null
|
echo "0 0,12 * * * root /opt/certbot/bin/python -c 'import random; import time; time.sleep(random.random() * 3600)' && sudo certbot renew -q" | sudo tee -a /etc/crontab > /dev/null
|
||||||
|
|
||||||
sudo ln -sf /opt/certbot/bin/certbot /usr/bin/certbot
|
sudo ln -sf /opt/certbot/bin/certbot /usr/bin/certbot
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import distro
|
||||||
parser = argparse.ArgumentParser(description='A script for install leviathan user')
|
parser = argparse.ArgumentParser(description='A script for install leviathan user')
|
||||||
|
|
||||||
#parser.add_argument('--url', help='The url where notify updates', required=True)
|
#parser.add_argument('--url', help='The url where notify updates', required=True)
|
||||||
#parser.add_argument('--url_stats', help='The url where pastafaristats notify the stats', required=True)
|
parser.add_argument('--url_stats', help='The url where pastafaristats notify the stats', required=True)
|
||||||
parser.add_argument('--user', help='The user for pastafari', required=True)
|
parser.add_argument('--user', help='The user for pastafari', required=True)
|
||||||
parser.add_argument('--pub_key', help='The pub key used in pastafari user', required=True)
|
parser.add_argument('--pub_key', help='The pub key used in pastafari user', required=True)
|
||||||
parser.add_argument('--group', help='Server group', required=False)
|
parser.add_argument('--group', help='Server group', required=False)
|
||||||
|
|
@ -38,9 +38,9 @@ print('{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Ins
|
||||||
|
|
||||||
#check_url.match(args.url) and
|
#check_url.match(args.url) and
|
||||||
|
|
||||||
#if check_url.match(args.url_stats):
|
if check_url.match(args.url_stats):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
u=pwd.getpwnam(args.user)
|
u=pwd.getpwnam(args.user)
|
||||||
|
|
||||||
if call("sudo userdel -r %s" % args.user, shell=True) > 0:
|
if call("sudo userdel -r %s" % args.user, shell=True) > 0:
|
||||||
|
|
@ -49,12 +49,12 @@ try:
|
||||||
else:
|
else:
|
||||||
print('Cleaning user with the same name')
|
print('Cleaning user with the same name')
|
||||||
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Create users
|
# Create users
|
||||||
|
|
||||||
if call("sudo useradd -m -s /bin/bash %s" % args.user, shell=True) > 0:
|
if call("sudo useradd -m -s /bin/bash %s" % args.user, shell=True) > 0:
|
||||||
|
|
||||||
# Delete user with this name, you should not install it in a old server.
|
# Delete user with this name, you should not install it in a old server.
|
||||||
|
|
||||||
|
|
@ -67,70 +67,70 @@ if call("sudo useradd -m -s /bin/bash %s" % args.user, shell=True) > 0:
|
||||||
print('Error, cannot add a new user')
|
print('Error, cannot add a new user')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print('Added user')
|
print('Added user')
|
||||||
|
|
||||||
if call("sudo mkdir -p /home/"+args.user+"/.ssh && sudo chown "+args.user+":"+args.user+" /home/"+args.user+"/.ssh && sudo chmod 700 /home/"+args.user+"/.ssh", shell=True) > 0:
|
if call("sudo mkdir -p /home/"+args.user+"/.ssh && sudo chown "+args.user+":"+args.user+" /home/"+args.user+"/.ssh && sudo chmod 700 /home/"+args.user+"/.ssh", shell=True) > 0:
|
||||||
print('Error, cannot add ssh directory')
|
print('Error, cannot add ssh directory')
|
||||||
exit(1)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
print('Added ssh directory')
|
print('Added ssh directory')
|
||||||
|
|
||||||
if call("sudo cp "+args.pub_key+" /home/"+args.user+"/.ssh/authorized_keys && sudo chown "+args.user+":"+args.user+" /home/"+args.user+"/.ssh/authorized_keys && sudo chmod 600 /home/"+args.user+"/.ssh/authorized_keys", shell=True) > 0:
|
if call("sudo cp "+args.pub_key+" /home/"+args.user+"/.ssh/authorized_keys && sudo chown "+args.user+":"+args.user+" /home/"+args.user+"/.ssh/authorized_keys && sudo chmod 600 /home/"+args.user+"/.ssh/authorized_keys", shell=True) > 0:
|
||||||
print('Error, cannot pub key to user')
|
print('Error, cannot pub key to user')
|
||||||
exit(1)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
print('Added pub key to user')
|
print('Added pub key to user')
|
||||||
|
|
||||||
# Edit sudo file
|
# Edit sudo file
|
||||||
|
|
||||||
with open('modules/pastafari2/scripts/system/sudoers.d/spanel') as f:
|
with open('modules/pastafari2/scripts/system/sudoers.d/spanel') as f:
|
||||||
sudoers=f.read()
|
sudoers=f.read()
|
||||||
|
|
||||||
with open('/etc/sudoers.d/spanel', 'w') as f:
|
with open('/etc/sudoers.d/spanel', 'w') as f:
|
||||||
sudoers=sudoers.replace("spanel", args.user)
|
sudoers=sudoers.replace("spanel", args.user)
|
||||||
f.write(sudoers)
|
f.write(sudoers)
|
||||||
|
|
||||||
# Installing composer things for php alerts...
|
# Installing composer things for php alerts...
|
||||||
|
|
||||||
|
|
||||||
#mkdir $HOME/pzoo/scripts
|
#mkdir $HOME/pzoo/scripts
|
||||||
|
|
||||||
#chown $USER:$USER $HOME/pzoo/scripts
|
#chown $USER:$USER $HOME/pzoo/scripts
|
||||||
|
|
||||||
#su - $USER -s /bin/bash -c "composer --working-dir=$HOME/scripts require guzzlehttp/guzzle:~6.0"
|
#su - $USER -s /bin/bash -c "composer --working-dir=$HOME/scripts require guzzlehttp/guzzle:~6.0"
|
||||||
|
|
||||||
args.path=os.path.basename(args.path)
|
args.path=os.path.basename(args.path)
|
||||||
|
|
||||||
pt=Path('/home/'+args.user+'/'+args.path+'/tasks')
|
pt=Path('/home/'+args.user+'/'+args.path+'/tasks')
|
||||||
|
|
||||||
pt.mkdir(mode=0o755, parents=True, exist_ok=True)
|
pt.mkdir(mode=0o755, parents=True, exist_ok=True)
|
||||||
|
|
||||||
shutil.chown('/home/'+args.user+'/'+args.path, args.user, args.user)
|
shutil.chown('/home/'+args.user+'/'+args.path, args.user, args.user)
|
||||||
|
|
||||||
shutil.chown('/home/'+args.user+'/'+args.path+'/tasks', args.user, args.user)
|
shutil.chown('/home/'+args.user+'/'+args.path+'/tasks', args.user, args.user)
|
||||||
|
|
||||||
# Create scripts pzoo
|
# Create scripts pzoo
|
||||||
"""
|
"""
|
||||||
if call("sudo /opt/pythonenv/bin/pip3 install --upgrade git+https://bitbucket.org/paramecio/pastafaristats", shell=True)>0:
|
if call("sudo /opt/pythonenv/bin/pip3 install --upgrade git+https://bitbucket.org/paramecio/pastafaristats", shell=True)>0:
|
||||||
print('Error, cannot install pastafari stats')
|
print('Error, cannot install pastafari stats')
|
||||||
exit(1)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
print('Added pastafari stats')
|
print('Added pastafari stats')
|
||||||
|
|
||||||
# Add configuration to pastafari stats
|
# Add configuration to pastafari stats
|
||||||
|
|
||||||
if not os.path.isdir('/etc/pastafari'):
|
if not os.path.isdir('/etc/pastafari'):
|
||||||
# Create pastafari dir
|
# Create pastafari dir
|
||||||
p=Path('/etc/pastafari')
|
p=Path('/etc/pastafari')
|
||||||
p.mkdir(mode=0o755, parents=False, exist_ok=True)
|
p.mkdir(mode=0o755, parents=False, exist_ok=True)
|
||||||
|
|
||||||
with open('/etc/pastafari/stats.cfg', 'w') as f:
|
with open('/etc/pastafari/stats.cfg', 'w') as f:
|
||||||
|
|
||||||
f.write("[DEFAULT]\n\nurl_server="+args.url_stats+"\ngroup="+args.group)
|
f.write("[DEFAULT]\n\nurl_server="+args.url_stats+"\ngroup="+args.group)
|
||||||
|
|
||||||
|
|
||||||
with open('/etc/systemd/system/pastafaristats.service', 'w') as f:
|
with open('/etc/systemd/system/pastafaristats.service', 'w') as f:
|
||||||
|
|
||||||
#f.write(systemd_unit)
|
#f.write(systemd_unit)
|
||||||
f.write('# Save it in /etc/systemd/system/pastafaristats.service\n')
|
f.write('# Save it in /etc/systemd/system/pastafaristats.service\n')
|
||||||
|
|
@ -151,31 +151,29 @@ with open('/etc/systemd/system/pastafaristats.service', 'w') as f:
|
||||||
f.write('WantedBy=multi-user.target\n')
|
f.write('WantedBy=multi-user.target\n')
|
||||||
|
|
||||||
|
|
||||||
if call("sudo systemctl enable pastafaristats.service && sudo systemctl start pastafaristats.service", shell=True)>0:
|
if call("sudo systemctl enable pastafaristats.service && sudo systemctl start pastafaristats.service", shell=True)>0:
|
||||||
print('Error, cannot start pastafari stats')
|
print('Error, cannot start pastafari stats')
|
||||||
exit(1)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
print('Pastafari stats ready')
|
print('Pastafari stats ready')
|
||||||
|
|
||||||
print('{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Tools installed..."}')
|
print('{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Tools installed..."}')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
linux_distro=distro.id()
|
linux_distro=distro.id()
|
||||||
|
|
||||||
# sudo su - %s -s /bin/bash -c 'mkdir -p %s'
|
# sudo su - %s -s /bin/bash -c 'mkdir -p %s'
|
||||||
|
|
||||||
if linux_distro=='arch':
|
if linux_distro=='arch':
|
||||||
print('Add utilities for archlinux distro...')
|
print('Add utilities for archlinux distro...')
|
||||||
if call("sudo su - %s -s /bin/bash -c 'sudo pacman -S --noconfirm --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si --noconfirm --needed'" % args.user, shell=True) > 0:
|
if call("sudo su - %s -s /bin/bash -c 'sudo pacman -S --noconfirm --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si --noconfirm --needed'" % args.user, shell=True) > 0:
|
||||||
print('Error, cannot add utilities for archlinux')
|
print('Error, cannot add utilities for archlinux')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
"""
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
print('Error installing the module, not valid url')
|
print('Error installing the module, not valid url')
|
||||||
|
|
||||||
exit(1)
|
exit(1)
|
||||||
"""
|
|
||||||
|
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
#!/opt/pythonenv/bin/python3 -u
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import subprocess
|
|
||||||
import argparse
|
|
||||||
import platform
|
|
||||||
import distro
|
|
||||||
import os
|
|
||||||
|
|
||||||
pyv=platform.python_version_tuple()
|
|
||||||
|
|
||||||
if pyv[0]!='3':
|
|
||||||
print('Need python 3 for execute this script')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Script for ssh port of the server.')
|
|
||||||
|
|
||||||
parser.add_argument('--ssh_port', help='The new ssh port', required=True)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
linux_distro=distro.id()
|
|
||||||
|
|
||||||
try:
|
|
||||||
|
|
||||||
ssh_port=int(args.ssh_port)
|
|
||||||
|
|
||||||
except:
|
|
||||||
|
|
||||||
print('{"error": 1, "status": 1, "progress": 100, "no_progress":0, "message": "Error: wrong port value"}')
|
|
||||||
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
print('Changing ssh port...')
|
|
||||||
|
|
||||||
#sudo su -s /bin/bash -c ' echo "Port=%i" > /etc/ssh/sshd_config.d/port.conf' % ssh_port
|
|
||||||
|
|
||||||
#if subprocess.call('sudo echo "Port=%i" > /etc/ssh/sshd_config.d/port.conf' % ssh_port, shell=True) > 0:
|
|
||||||
if os.path.isfile('/etc/sshd_config.d/port.conf'):
|
|
||||||
if subprocess.call("sudo cp /etc/sshd_config.d/port.conf /etc/sshd_config.d/port.conf.bak", shell=True) > 0:
|
|
||||||
print('Error: cannot save the old sshd configuration')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if subprocess.call("sudo su -s /bin/bash -c ' echo \"Port=%i\" > /etc/ssh/sshd_config.d/port.conf'" % ssh_port, shell=True) > 0:
|
|
||||||
|
|
||||||
#print('{"error": 1, "status": 1, "progress": 100, "no_progress":0, "message": "Error: cannot save the new sshd configuration'+('sudo echo "Port=%i" > /etc/ssh/sshd_config.d/port.conf' % ssh_port)+'"}')
|
|
||||||
print('Error: cannot save the new sshd configuration sudo echo "Port=%i" > /etc/ssh/sshd_config.d/port.conf\n' % ssh_port)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if linux_distro=='fedora' or linux_distro=='centos' or linux_distro=='almalinux' or linux_distro=='rocky':
|
|
||||||
if subprocess.call("sudo getenforce", shell=True)==0:
|
|
||||||
if subprocess.call("sudo semanage port -a -t ssh_port_t -p tcp %s" % ssh_port, shell=True) > 0:
|
|
||||||
print('WARNING: probably the port is open for ssh in selinux\n')
|
|
||||||
#sys.exit(1)
|
|
||||||
|
|
||||||
if subprocess.call("sudo systemctl status firewalld", shell=True)==0:
|
|
||||||
if subprocess.call("sudo firewall-cmd --add-port=%s/tcp --permanent && sudo firewall-cmd --reload" % ssh_port, shell=True) > 0:
|
|
||||||
print('Error, cannot set firewall services for sshd...\n')
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
if subprocess.call("sudo systemctl restart sshd", shell=True) > 0:
|
|
||||||
|
|
||||||
#Fallout to
|
|
||||||
#print('{"error": 1, "status": 1, "progress": 100, "no_progress":0, "message": "Error: cannot save the new sshd configuration'+('sudo echo "Port=%i" > /etc/ssh/sshd_config.d/port.conf' % ssh_port)+'"}')
|
|
||||||
|
|
||||||
print('Error: cannot restart new sshd configuration!, dangerous!\n')
|
|
||||||
print('Restarting sshd with old value...')
|
|
||||||
|
|
||||||
if os.path.isfile('/etc/sshd_config.d/port.conf.bak'):
|
|
||||||
if subprocess.call("sudo cp /etc/sshd_config.d/port.conf.bak /etc/sshd_config.d/port.conf", shell=True) > 0:
|
|
||||||
print('Error: cannot get the old sshd configuration for restaure old port!, deleting old configuration and opening port 22!\n')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if subprocess.call("sudo rm -f /etc/sshd_config.d/port.conf && sudo systemctl restart sshd", shell=True) > 0:
|
|
||||||
print('Error: cannot delete configuration and restart sshd!!\n')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print('{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Done: changed the ssh port value..."}')
|
|
||||||
|
|
@ -51,7 +51,7 @@ def execute_script(task_id, executable='launcher.py'):
|
||||||
|
|
||||||
return_value=proc.returncode
|
return_value=proc.returncode
|
||||||
|
|
||||||
if return_value!=0:
|
if return_value>0:
|
||||||
connection=WebModel.connection()
|
connection=WebModel.connection()
|
||||||
|
|
||||||
if executable=='launcher.py':
|
if executable=='launcher.py':
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
#!/opt/pythonenv/python3
|
|
||||||
|
|
||||||
from modules.pastafari2.libraries.task import Task
|
|
||||||
from modules.pastafari2.models.pastafari2 import ServerDbTask, ServerGroup
|
|
||||||
from modules.pastafari2.libraries.configtask import config_task
|
|
||||||
from settings import config
|
|
||||||
from paramecio2.libraries.urls import make_url
|
|
||||||
|
|
||||||
try:
|
|
||||||
from modules.gitea.models.gitea import GiteaServer
|
|
||||||
server_db=True
|
|
||||||
except:
|
|
||||||
server_db=False
|
|
||||||
|
|
||||||
class ServerTask(Task):
|
|
||||||
|
|
||||||
def __init__(self, server, conn, remote_user='root', remote_password='', private_key='./ssh/id_rsa', password_key='', remote_path='pastafari2', task_id=0, data={}, port=22):
|
|
||||||
|
|
||||||
super().__init__(server, conn, remote_user, remote_password, private_key, password_key, remote_path, task_id, data, port)
|
|
||||||
|
|
||||||
self.name_task='Install Gitea in a server'
|
|
||||||
|
|
||||||
self.description_task='Install Gitea in a server standalone, without proxy.'
|
|
||||||
|
|
||||||
self.codename_task='gitea_server_standalone'
|
|
||||||
|
|
||||||
#self.files=[['modules/pastafari2/scripts/system/alive.sh', 0o755]]
|
|
||||||
|
|
||||||
self.files=[['modules/pastafari2/scripts/servers/cvs/install_gitea.py', 0o755], ['modules/pastafari2/scripts/servers/cvs/files/gitea.service', 0o644]]
|
|
||||||
|
|
||||||
self.commands_to_execute=[['modules/pastafari2/scripts/servers/cvs/install_gitea.py', '']]
|
|
||||||
|
|
||||||
self.one_time=True
|
|
||||||
|
|
||||||
self.version='1.0'
|
|
||||||
|
|
||||||
|
|
||||||
def post_task(self):
|
|
||||||
|
|
||||||
if server_db:
|
|
||||||
dbserver=GiteaServer(self.connection)
|
|
||||||
|
|
||||||
dbserver.safe_query()
|
|
||||||
|
|
||||||
serverdb=ServerDbTask(self.connection)
|
|
||||||
|
|
||||||
arr_server=serverdb.set_conditions('WHERE ip=%s', [self.server]).select_a_row_where()
|
|
||||||
|
|
||||||
if arr_server:
|
|
||||||
dbserver.insert({'server_id': arr_server['id']})
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
[info]
|
|
||||||
name=CVS servers
|
|
||||||
description=Install CVS servers
|
|
||||||
|
|
||||||
[modules]
|
|
||||||
gitea/gitea=Install Gitea
|
|
||||||
|
|
||||||
|
|
@ -60,14 +60,14 @@ class ServerTask(Task):
|
||||||
|
|
||||||
if arr_server:
|
if arr_server:
|
||||||
#dbserver.insert({'server_id': arr_server['id'], 'access_ip': self.data['ip']})
|
#dbserver.insert({'server_id': arr_server['id'], 'access_ip': self.data['ip']})
|
||||||
serverdb.query('update serverdbtask set ssh_port=%s WHERE id=%s', [self.data['ssh_port'], arr_server['id']])
|
server.query('update serverdbtask set ssh_port=%s WHERE id=%s', [arr_server['id']])
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def pre_task(self):
|
def pre_task(self):
|
||||||
|
|
||||||
self.commands_to_execute=[['modules/pastafari2/scripts/system/ssh/change_ssh_port.py', '--ssh_port=%s' % (self.data['ssh_port'])]]
|
self.commands_to_execute=[['modules/pastafari2/scripts/system/ssh/change_ssh_port.py', '--port=%s' % (self.data['ssh_port'])]]
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,7 @@ class ServerTask(Task):
|
||||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_php.py', ''])
|
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_php.py', ''])
|
||||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_unixutils.sh', ''])
|
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_unixutils.sh', ''])
|
||||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_psutil.sh', ''])
|
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_psutil.sh', ''])
|
||||||
|
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_pzoo_stats.py', '--user='+self.data['ssh_user']+' --pub_key='+self.data['pub_key']+' --url_stats='+self.data['url_stats']+' --group="'+self.data['group_name']+'" --path='+remote_path])
|
||||||
#' --url_stats='+self.data['url_stats']+
|
|
||||||
|
|
||||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_pzoo_stats.py', '--user='+self.data['ssh_user']+' --pub_key='+self.data['pub_key']+' --group="'+self.data['group_name']+'" --path='+remote_path])
|
|
||||||
|
|
||||||
def post_task(self):
|
def post_task(self):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
<form method="post" name="add_server" id="add_server_form">
|
<form method="post" name="add_server" id="add_server_form">
|
||||||
<p>Please fill the form for add the new server to the system.</p>
|
<p>Please fill the form for add the new server to the system.</p>
|
||||||
<p><label>${lang('pastafari2', 'server_host', 'Server host')}* <span class="pastafari2_error error" id="server_host_error"></span></label> <input type="text" name="server_host" value=""></p>
|
<p><label>${lang('pastafari2', 'server_host', 'Server host')}* <span class="pastafari2_error error" id="server_host_error"></span></label> <input type="text" name="server_host" value=""></p>
|
||||||
<p><label>${lang('pastafari2', 'server_group', 'Server group')}* <span class="pastafari2_error error" id="group_id_error"></span></label> ${group_form.form()|n}</p>
|
<p><label>${lang('pastafari2', 'server_group', 'Server group')} <span class="pastafari2_error error" id="group_id_error"></span></label> ${group_form.form()|n}</p>
|
||||||
<p><label>${lang('pastafari2', 'server_username', 'Server username')}* <span class="pastafari2_error error" id="server_username_error"></span></label> <input type="text" name="server_username" value=""></p>
|
<p><label>${lang('pastafari2', 'server_username', 'Server username')} <span class="pastafari2_error error" id="server_username_error"></span></label> <input type="text" name="server_username" value=""></p>
|
||||||
<p><label>${lang('pastafari2', 'server_password', 'Server password.')} <span class="pastafari2_error error" id="server_password_error"></span></label> <input type="password" name="server_password" value=""></p>
|
<p><label>${lang('pastafari2', 'server_password', 'Server password.')} <span class="pastafari2_error error" id="server_password_error"></span></label> <input type="password" name="server_password" value=""></p>
|
||||||
<p><label>${lang('pastafari2', 'repeat_server_password', 'Repeat server password')} <span class="pastafari2_error error" id="repeat_server_password_error"></span></label> <input type="password" name="repeat_server_password" value=""></p>
|
<p><label>${lang('pastafari2', 'repeat_server_password', 'Repeat server password')} <span class="pastafari2_error error" id="repeat_server_password_error"></span></label> <input type="password" name="repeat_server_password" value=""></p>
|
||||||
<p><label>${lang('pastafari2', 'ssh_port', 'SSH port')}* <span class="pastafari2_error error" id="ssh_port_error"></span></label> <input type="number" name="ssh_port" value="22"></p>
|
<p><label>${lang('pastafari2', 'ssh_port', 'SSH port')}* <span class="pastafari2_error error" id="ssh_port_error"></span></label> <input type="number" name="ssh_port" value="22"></p>
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<p><a href="${url_for('.pastafari2_dashboard')}">Servers</a> >> ${lang('pastafari2', 'add_server', 'Add server')}</p>
|
<p><a href="${url_for('.pastafari2_dashboard')}">Servers</a> >> ${lang('pastafari2', 'add_server', 'Add server')}</p>
|
||||||
<script type="text/javascript" src="${make_media_url('js/jsutils/posting2.js', 'pastafari2')}"></script>
|
<script type="text/javascript" src="${make_media_url('js/jsutils/posting2.js', 'monit')}"></script>
|
||||||
<script>
|
<script>
|
||||||
var options={url: "${url_for('.pastafari2_add_server_task')}", loading: '#layer_loading', success: function (data) {
|
var options={url: "${url_for('.pastafari2_add_server_task')}", loading: '#layer_loading', success: function (data) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<%block name="content">
|
<%block name="content">
|
||||||
<div id="principal_container">
|
<div id="principal_container">
|
||||||
<p><a href="${url_for('.pastafari2_add_server')}">${lang('pastafari2', 'add_server', 'Add server')}</a>
|
<p><a href="${url_for('.pastafari2_add_server')}">${lang('pastafari2', 'add_server', 'Add server')}</a>
|
||||||
<p>${lang('pastafari2', 'choose_group', 'Choose group')}:
|
<p>${lang('monit', 'choose_group', 'Choose group')}:
|
||||||
<select name="group_id" id="group_id">
|
<select name="group_id" id="group_id">
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -62,8 +62,8 @@ ${"\n".join(form_set)|n}
|
||||||
</div>
|
</div>
|
||||||
</%block>
|
</%block>
|
||||||
<%block name="jscript_block">
|
<%block name="jscript_block">
|
||||||
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'pastafari2')}"></script>
|
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'monit')}"></script>
|
||||||
<script language="Javascript" src="${make_media_url('js/jsutils/ajax_list.js', 'pastafari2')}"></script>
|
<script language="Javascript" src="${make_media_url('js/jsutils/ajax_list.js', 'monit')}"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<p><a href="${url_for('.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> >> ${lang('pastafari2', 'delete_server', 'Delete server')}</p>
|
<p><a href="${url_for('.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> >> ${lang('pastafari2', 'delete_server', 'Delete server')}</p>
|
||||||
</%block>
|
</%block>
|
||||||
<%block name="jscript_block">
|
<%block name="jscript_block">
|
||||||
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'pastafari2')}"></script>
|
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'monit')}"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var options={url: "${url_for('admin_app.pastafari2_delete_server_db')}", loading: '#layer_loading', pre_callback: function (data) {
|
var options={url: "${url_for('admin_app.pastafari2_delete_server_db')}", loading: '#layer_loading', pre_callback: function (data) {
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ ${form|n}
|
||||||
${links|n}
|
${links|n}
|
||||||
</%block>
|
</%block>
|
||||||
<%block name="jscript_block">
|
<%block name="jscript_block">
|
||||||
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'pastafari2')}"></script>
|
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'monit')}"></script>
|
||||||
<script language="Javascript" src="${make_media_url('js/jsutils/ajax_list.js', 'pastafari2')}"></script>
|
<script language="Javascript" src="${make_media_url('js/jsutils/ajax_list.js', 'monit')}"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var options={url: "${url_exec|n}", loading: '#layer_loading', success: function (data) {
|
var options={url: "${url_exec|n}", loading: '#layer_loading', success: function (data) {
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,6 @@
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#no_progress pre {
|
|
||||||
|
|
||||||
margin-top:2px;
|
|
||||||
margin-bottom:2px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</%block>
|
</%block>
|
||||||
<%block name="content">
|
<%block name="content">
|
||||||
|
|
@ -38,7 +30,7 @@ ${return_tree|n}
|
||||||
<hr />
|
<hr />
|
||||||
<i class="fa fa-cog fa-spin fa-5x fa-fw margin-bottom" id="gear"></i>
|
<i class="fa fa-cog fa-spin fa-5x fa-fw margin-bottom" id="gear"></i>
|
||||||
<div id="progressbar"><div class="progress-label">${lang('pastafari2', 'processing_task', 'Processing task...')}</div></div>
|
<div id="progressbar"><div class="progress-label">${lang('pastafari2', 'processing_task', 'Processing task...')}</div></div>
|
||||||
<div id="no_progress" style="border: solid #cbcbcb 1px;height:550px;overflow:scroll;padding:2px;color: #fbfbfb;background:#000000 !important;font-size:0.8em;"></div>
|
<div id="no_progress" style="border: solid #cbcbcb 1px;height:150px;overflow:scroll;padding:2px;"></div>
|
||||||
<p id="return_block"></p>
|
<p id="return_block"></p>
|
||||||
</%block>
|
</%block>
|
||||||
<%block name="jscript_block">
|
<%block name="jscript_block">
|
||||||
|
|
@ -108,7 +100,7 @@ ${return_tree|n}
|
||||||
|
|
||||||
progressbar.progressbar( "value", progress );
|
progressbar.progressbar( "value", progress );
|
||||||
|
|
||||||
$('#no_progress').append(message);
|
$('#no_progress').append(message+'<br />');
|
||||||
|
|
||||||
objDiv.scrollTop = objDiv.scrollHeight;
|
objDiv.scrollTop = objDiv.scrollHeight;
|
||||||
|
|
||||||
|
|
@ -151,7 +143,7 @@ ${return_tree|n}
|
||||||
{
|
{
|
||||||
//yes_progress=0;
|
//yes_progress=0;
|
||||||
//$('#no_progress').append(data[k].message+'<br />');
|
//$('#no_progress').append(data[k].message+'<br />');
|
||||||
update_messages_queue('<pre>'+data[k].message.trim()+'</pre>');
|
update_messages_queue(data[k].message+'<br />');
|
||||||
|
|
||||||
//Scroll
|
//Scroll
|
||||||
|
|
||||||
|
|
@ -160,7 +152,7 @@ ${return_tree|n}
|
||||||
if(data[k].no_progress==0)
|
if(data[k].no_progress==0)
|
||||||
{
|
{
|
||||||
|
|
||||||
update_progress_messages_queue('<pre>'+data[k].message.trim()+'</pre>', data[k].progress);
|
update_progress_messages_queue(data[k].message, data[k].progress);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
</div>
|
</div>
|
||||||
</%block>
|
</%block>
|
||||||
<%block name="jscript_block">
|
<%block name="jscript_block">
|
||||||
<script language="Javascript" src="${make_media_url('js/jsutils/ajax_list.js', 'pastafari2')}"></script>
|
<script language="Javascript" src="${make_media_url('js/jsutils/ajax_list.js', 'monit')}"></script>
|
||||||
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'pastafari2')}"></script>
|
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'monit')}"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
% if not regenerate:
|
% if not regenerate:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue