aiegoo / ansible Goto Github PK
View Code? Open in Web Editor NEWdeploy automation
deploy automation
sudo apt-get install curl openssh-server ca-certificates postfix
sudo dpkg-reconfigure postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
apt-get update
sudo apt-get install gitlab-ce
sudo gitlab-ctl reconfigure
cd / etc/gitlab/gitlab.rb
sudo vi cd /etc/gitlab/gitlab.rb
대표적으로 바꿀 곳은 3가지로 external_url, gitlab_workhorse[‘auth_backend’], unicorn[‘port’] 이다. 서버에 80, 8080포트가 비어있다면 크게 다루지 않아도 되나. 서버 80, 8080포트에 웹페이지, Apache 서버를 구동 하고 있는 경우가 있기에 수정하는 것을 권장한다. Gitlab은 추가 설정을 하지 않을 시 80 포트를 설정한다. 따라서 만약 수정을 하지 않을 시 포트 내부에서 충돌이 일어나 502 에러가 뜨게 될 것이다.
external_url 'http://ip(입력):포트번호(입력)'
external_url 'http://localhost(입력):포트번호(입력)'
gitlab_workhorse['auth_backend'] = "http://localhost(수정안함):포트번호(입력)"
unicorn['port'] = 포트번호(입력)
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-ctl status
http://external_url
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys EB3E94ADBE1229CF && sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893 && sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list' && sudo apt update && sudo apt install dotnet-sdk-3.0
cd Spire/Spire/slave/
dotnet build -c Release
mkdir scripts
echo "" > secret.txt
cd scripts/
nano example.sh
chmod +x example.sh
nohup ./slave &
[1] 7708
nohup: ignoring input and appending output to 'nohup.out'
curl
apt install curl
curl ifconfig.co
106.251.252.2
cd scripts/
./example.sh
ufw allow 10000
netstat -tulpn
curl ifconfig.co
106.251.252.2
cd server_update/
dotnet build -c Release
cd bin/Release/netcoreapp3.0/
nano slavelist.yaml
echo "" > secret.txt
./server_update Local example.sh
ufw allow 10000
ufw default allow incoming
ufw default allow outgoing
netstat -tulpn
curl ifconfig.co
106.251.252.2
fg
nohup ./slave (wd: ~/repos/Spire/Spire/slave/bin/Release/netcoreapp3.0)
~/repos/Spire/Spire/server_update/bin/Release/netcoreapp3.0# ls
output.log
cd bin/Release/netcoreapp3.0/
./slave
nohup ./slave &
[1] 3567
nohup: ignoring input and appending output to 'nohup.out'
ifconfig
./server_update Local example.sh
E: Unable to locate package libXcomposite
E: Unable to locate package libXcursor
E: Unable to locate package libXi
E: Unable to locate package libXtst
E: Unable to locate package libXrandr
E: Unable to locate package alsa-lib
E: Unable to locate package mesa-libEGL
E: Unable to locate package libXdamage
E: Unable to locate package mesa-libGL
E: Unable to locate package libXScrnSaver
File "threading.py", line 296, in wait
File "/root/repos/ansible/slave/slave.py", line 23, in default
return("Cannot serve " + str(sys.argv[1]))
IndexError: list index out of range
@app.route('/')
def default():
try:
with open(str(sys.argv[1]), 'r') as file:
contents = file.read()
return(contents)
except:
return("Cannot serve " + str(sys.argv[1]))
app.run(host='0.0.0.0', debug=True, port=80)
80 cd repos/webhook/b
81 cd repos/webhook/
82 ls
83 python git_hook.py
84 ps -aef |grep git
85 kill -9 3160
86 ps -aef |grep git
87 python git_hook.py
88 ls
89 cd repos
90 ls
91 cd webhook/
92 ls
93 vi git_hook.py
94 python git_hook.py
95 vi git_hook.py
96 python git_hook.py
97 vi git_hook.py
98 python git_hook.py
99 netstat -na|grep 80
100 ps -aef|grep git
101 kill -9 3249
102 ps -aef|grep git
103* python git_hook.py
104 cat git_hook.py
root tony
#!/usr/bin/python
import git
from git.refs.tag import TagReference
import os
import time
while True:
repo = git.Repo(os.getcwd())
remote = repo.remotes.origin
remote.fetch()
print(repo.head.commit == remote.refs.master.commit)
if repo.head.commit != remote.refs.master.commit:
tagref = ''
if TagReference.list_items(repo):
tagref = TagReference.list_items(repo)[-1]
print(tagref.tag.message)
remote.pull()
with open('status.txt', 'a+') as f:
f.write(f'{repo.head.commit.authored_datetime} {remote.refs.master.commit} {repo.head.commit.message} {tagref.tag.message}\n')
print('pulled')
f.close()
else:
print('Not pulled')
print(repo.head.commit == remote.refs.master.commit)
# print(remote.refs.master.commit)
# print(repo.head.commit)
# print(repo.head.commit.message)
time.sleep(60*5)
#!/usr/bin/bash
conf_file="/etc/server-update/slavelist.txt"
while IFS= read -r line
do
echo "Updating slave on $line";
curl "$line/get/?repo=$1"
done < "$conf_file"
/bin/ on slave
#!/bin/bash/
rm -rf "$HOME/repos/$1"
git clone "https://github.com/aiegoo/$1.git" "$HOME/repos/$1"
set clipboard=unnamed
%y"+
set list listchars=tab:\ \ ,trail:∙
28517-28bdd
bf640-28351
eb664-db059
579f9-09bb6
4c3e4-69dff
e5d43-ee7c1
93538-6c3ee
cd36a-43e20
859be-02e8c
b3a8b-8a485
1bc44-9b58e
d1582-c4d9e
70485-2126b
9737b-528d0
4f5c3-46ad2
1383d-3ec5a
cd repos/
1064 ls
1065 cd ..
1066 cd ansible/
1067 ls
1068 git pull
1069 cp post-receive /root/repos/test_bare.git/hooks/post-receive
1070 ls
1071 cd /root/repos/test_bare.git/
1072 ls
1073 cd hooks
1074 kls
1075 ls
1076 vi post-receive
1077 cd /root/ansible/
1078 ls
1079 vi playbooks/roles/git_update/defaults/main.yml
1080 ls
1081 cd ansible/
1082 ls
1083 vi playbooks/inventory.ini
1084 git status
1085 cd logs
1086 ls
1087 cd ..
1088 ls
1089 git status
1090 rm -r logs
1091 git status
1092 rm playbooks/inventory.ini~
1093 r
1094 git status
1095 git rm playbooks/roles/git_update/defaults/main.yml~
1096 rm playbooks/roles/git_update/defaults/main.yml~
1097 ls
1098 git status
1099 git diff
1100 git add .
1101 git commit -am "changes to run on 206.189.85.199"
1102 git push
#!/usr/bin/python
import git
from git import Git
from git.refs.tag import TagReference
from sendemail import send_email
import os
import time
from pathlib import Path
tag_count = 0
try:
while True:
git_repo = '/root/repos/pawan/'
repo = git.Repo(git_repo)
c = Git(git_repo)
remote = repo.remotes.origin
c.checkout('master')
# remote.fetch()
print('Is Commits Same: ', repo.head.commit == remote.refs.master.commit)
remote.pull()
if not os.path.exists('tagcount'):
Path('tagcount.txt').touch()
with open('tagcount.txt', 'r+') as t:
temp = t.readline()
print('TEMP', temp)
tag_count = 0 if temp == '' else int(temp)
if tag_count < len(TagReference.list_items(repo)):
t.seek(0)
t.write(str(len(TagReference.list_items(repo))))
t.close()
if TagReference.list_items(repo):
tagref = TagReference.list_items(repo)[-1]
latest_tag = tagref.path.replace('refs/tags/', '')
c.checkout(latest_tag)
my_new_branch = repo.create_head(latest_tag)
my_new_branch.checkout()
# print(repo.refs)
# repo.git.push("--set-upstream", remote, repo.head.ref)
tag = tagref.tag.message if hasattr(tagref.tag, 'message') else tagref
# print(tag)
else:
tag = ''
print('tag_count: ', tag_count)
print(tag_count, len(TagReference.list_items(repo)))
print(tag_count == len(TagReference.list_items(repo)))
if repo.head.commit != remote.refs.master.commit or tag_count != len(TagReference.list_items(repo)):
with open('status.txt', 'a+') as f:
f.write(f"Time:{repo.head.commit.authored_datetime} Commit:{remote.refs.master.commit} \
Message:{repo.head.commit.message} Tag:{tag}\n")
print('pulled')
f.close()
print(repo.head.commit == remote.refs.master.commit)
# print(remote.refs.master.commit)
# print(repo.head.commit)
# print(repo.head.commit.message)
time.sleep(5 * 60) # change time here in seconds 5*60 is 5 minutes here
except BaseException as e:
print(e)
send_email(html_text=str(e) + '
' + 'The script has stopped due to this error.
Please fix before running again.')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.