fix: make installation portable
This commit is contained in:
parent
fa10e9185a
commit
6b2da8c83e
2 changed files with 13 additions and 9 deletions
|
@ -57,7 +57,7 @@ class Forgejo:
|
||||||
"""
|
"""
|
||||||
count = 0
|
count = 0
|
||||||
parsed = urlparse(host)
|
parsed = urlparse(host)
|
||||||
url = urlunparse((parsed.scheme, parsed.netloc, "api/v1/nodeinfo", "", "", ""))
|
url = urlunparse((parsed.scheme, parsed.netloc, "/", "", "", ""))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -75,6 +75,8 @@ class Forgejo:
|
||||||
Install Forgejo, first form that a user sees when a new instance is
|
Install Forgejo, first form that a user sees when a new instance is
|
||||||
deployed
|
deployed
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
parsed = urlparse(self.host)
|
||||||
# cwd = os.environ.get("PWD")
|
# cwd = os.environ.get("PWD")
|
||||||
# user = os.environ.get("USER")
|
# user = os.environ.get("USER")
|
||||||
payload = {
|
payload = {
|
||||||
|
@ -91,10 +93,10 @@ class Forgejo:
|
||||||
"repo_root_path": "/data/git/repositories",
|
"repo_root_path": "/data/git/repositories",
|
||||||
"lfs_root_path": "/data/git/lfs",
|
"lfs_root_path": "/data/git/lfs",
|
||||||
"run_user": "git",
|
"run_user": "git",
|
||||||
"domain": "localhost",
|
"domain": parsed.netloc,
|
||||||
"ssh_port": "22",
|
"ssh_port": "22",
|
||||||
"http_port": "3000",
|
"http_port": "3000",
|
||||||
"app_url": "http://localhost:3000/",
|
"app_url": self.get_uri(""),
|
||||||
"log_root_path": "/data/gitea/log",
|
"log_root_path": "/data/gitea/log",
|
||||||
"smtp_host": "",
|
"smtp_host": "",
|
||||||
"smtp_from": "",
|
"smtp_from": "",
|
||||||
|
@ -107,13 +109,13 @@ class Forgejo:
|
||||||
"default_enable_timetracking": "on",
|
"default_enable_timetracking": "on",
|
||||||
"no_reply_address": "noreply.localhost",
|
"no_reply_address": "noreply.localhost",
|
||||||
"password_algorithm": "pbkdf2",
|
"password_algorithm": "pbkdf2",
|
||||||
"admin_name": "",
|
"admin_name": self.username,
|
||||||
"admin_passwd": "",
|
"admin_passwd": self.password,
|
||||||
"admin_confirm_passwd": "",
|
"admin_confirm_passwd": self.password,
|
||||||
"admin_email": "",
|
"admin_email": self.email,
|
||||||
}
|
}
|
||||||
|
|
||||||
resp = self.c.post(self.get_uri(""), data=payload)
|
resp = self.c.post(self.get_uri(""), data=payload, allow_redirects=False)
|
||||||
sleep(10)
|
sleep(10)
|
||||||
|
|
||||||
def get_csrf_token(self, url: str) -> str:
|
def get_csrf_token(self, url: str) -> str:
|
||||||
|
@ -122,7 +124,7 @@ class Forgejo:
|
||||||
"""
|
"""
|
||||||
resp = self.c.get(url, allow_redirects=False)
|
resp = self.c.get(url, allow_redirects=False)
|
||||||
if resp.status_code != 200 and resp.status_code != 302:
|
if resp.status_code != 200 and resp.status_code != 302:
|
||||||
print(resp.status_code, resp.text)
|
print(url, resp.status_code)
|
||||||
raise Exception(f"Can't get csrf token: {resp.status_code}")
|
raise Exception(f"Can't get csrf token: {resp.status_code}")
|
||||||
parser = ParseCSRF(name=self.__csrf_key)
|
parser = ParseCSRF(name=self.__csrf_key)
|
||||||
parser.feed(resp.text)
|
parser.feed(resp.text)
|
||||||
|
|
|
@ -49,6 +49,8 @@ forgejo_root(){
|
||||||
$FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \
|
$FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \
|
||||||
$FORGEJO_ROOT_EMAIL \
|
$FORGEJO_ROOT_EMAIL \
|
||||||
$FORGEJO_URL
|
$FORGEJO_URL
|
||||||
|
sleep 10
|
||||||
|
curl $FORGEJO_URL
|
||||||
python -m integration \
|
python -m integration \
|
||||||
forgejo register \
|
forgejo register \
|
||||||
$FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \
|
$FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \
|
||||||
|
|
Loading…
Reference in a new issue