YunoHost-Apps / gogs_ynh_old

Gogs package for YunoHost
https://gogs.io
MIT License
15 stars 5 forks source link

Check domain/path failed and can't log-in to web interface. #11

Closed M5oul closed 8 years ago

M5oul commented 9 years ago

Thanks @Josue-T and @mbugeia for that package. I installed gogs on my ARM board and I encounter two issues:

root@cubieboard2:~# yunohost app install https://github.com/mbugeia/gogs_ynh
Downloading...
^[[AExtracting...
Done.
Choose a domain for Gogs: moul.re
Choose a path for Gogs (default: /gogs): /repo 
Choose the admin user for Gogs: moul
Enter a password for the administrator: psswd
Is it a public site ? (Yes|No) (default: Yes): 
Executing script...
+ app=gogsmoul.re'
+ path=/repo
+ admin=moul
+ password=psswd
+ is_public=Yes               moul.re/repo' -a gogs
Error: Unknown domainheckurl '
+ [[ ! 22 -eq 0 ]]
+ exit 1
Error: Installation failed

sudo yunohost app checkurl moul.re/repo -a gogs did not tell me this domain/path is ever used. That is strange. I installed a secound time. It works.

root@cubieboard2:~# yunohost app install https://github.com/mbugeia/gogs_ynh
Downloading...
^CCloning into '/var/cache/yunohost/from_file'...
remote: Counting objects: 497, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 497 (delta 0), reused 0 (delta 0), pack-reused 493
Receiving objects: 100% (497/497), 67.51 MiB | 887.00 KiB/s, done.
Resolving deltas: 100% (112/112), done.
Checking connectivity... done.
Done.
Choose a domain for Gogs: moul.re
Choose a path for Gogs (default: /gogs): 
Choose the admin user for Gogs: moul
Enter a password for the administrator: psswd
Is it a public site ? (Yes|No) (default: Yes): 
Executing script...
+ app=gogs
+ domain=moul.re
+ path=/gogs
+ admin=moul
+ password=psswd
+ is_public=Yes
+ sudo yunohost app checkurl moul.re/gogs -a gogs
+ [[ ! 0 -eq 0 ]]
++ dd if=/dev/urandom bs=1 count=200
++ sed -n 's/\(.\{24\}\).*/\1/p'
++ tr -c -d A-Za-z0-9
+ db_pwd=O6hChG9jnz4hF8zLHd5g6saf
+ sudo yunohost app initdb gogs -p O6hChG9jnz4hF8zLHd5g6saf
Success! MySQL database successfully initialized
+ sudo yunohost app setting gogs mysqlpwd -v O6hChG9jnz4hF8zLHd5g6saf
++ dd if=/dev/urandom bs=1 count=200
++ tr -c -d A-Za-z0-9
++ sed -n 's/\(.\{15\}\).*/\1/p'
+ key=JIMn9YsnJnTD06y
+ sudo yunohost app setting gogs adminusername -v moul
+ sudo yunohost app setting gogs is_public -v Yes
+ sudo yunohost app setting gogs secret_key -v JIMn9YsnJnTD06y
++ cat /etc/debian_version
+ [[ 8.2 = \7\.* ]]
+ sudo apt-get -y install git golang
Reading package lists...
Building dependency tree...
Reading state information...
git is already the newest version.
The following extra packages will be installed:
  golang-doc golang-go golang-go-linux-arm golang-src
Recommended packages:
  golang-go.tools
The following NEW packages will be installed:
  golang golang-doc golang-go golang-go-linux-arm golang-src
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.7 MB of archives.
After this operation, 110 MB of additional disk space will be used.
Get:1 http://ftp.de.debian.org/debian/ jessie/main golang-src armhf 2:1.3.3-1 [5,143 kB]
Get:2 http://ftp.de.debian.org/debian/ jessie/main golang-go-linux-arm armhf 2:1.3.3-1 [3,361 kB]
Get:3 http://ftp.de.debian.org/debian/ jessie/main golang-go armhf 2:1.3.3-1 [8,193 kB]
Get:4 http://ftp.de.debian.org/debian/ jessie/main golang-doc all 2:1.3.3-1 [1,950 kB]
Get:5 http://ftp.de.debian.org/debian/ jessie/main golang all 2:1.3.3-1 [25.0 kB]
dpkg-preconfigure: unable to re-open stdin: No such file or directory
Fetched 18.7 MB in 25s (746 kB/s)
                                 Selecting previously unselected package golang-src.
(Reading database ... 54601 files and directories currently installed.)             (Reading database ... 
                                                                       Preparing to unpack .../golang-src_2%3a1.3.3-1_armhf.deb ...
                                                                                                                                   Unpacking golang-src (2:1.3.3-1) ...
                                                                                                                                                                       Selecting previously unselected package golang-go-linux-arm.
                                                           Preparing to unpack .../golang-go-linux-arm_2%3a1.3.3-1_armhf.deb ...
                                                                                                                                Unpacking golang-go-linux-arm (2:1.3.3-1) ...
     Selecting previously unselected package golang-go.
                                                       Preparing to unpack .../golang-go_2%3a1.3.3-1_armhf.deb ...
                                                                                                                  Unpacking golang-go (2:1.3.3-1) ...
                                                                                                                                                     Selecting previously unselected package golang-doc.
                                Preparing to unpack .../golang-doc_2%3a1.3.3-1_all.deb ...
                                                                                          Unpacking golang-doc (2:1.3.3-1) ...
                                                                                                                              Selecting previously unselected package golang.
     Preparing to unpack .../golang_2%3a1.3.3-1_all.deb ...
                                                           Unpacking golang (2:1.3.3-1) ...
                                                                                           Processing triggers for man-db (2.7.0.2-5) ...
                                                                                                                                         Setting up golang-src (2:1.3.3-1) ...
      Setting up golang-go-linux-arm (2:1.3.3-1) ...
                                                    Setting up golang-go (2:1.3.3-1) ...
                                                                                        Setting up golang-doc (2:1.3.3-1) ...
                                                                                                                             Setting up golang (2:1.3.3-1) ...
                                                                                                                                                              + sudo addgroup gogs --system --quiet
+ sudo adduser gogs --disabled-login --ingroup gogs --system --quiet --shell /bin/bash
+ base_directory=/var/cache/yunohost/from_file/scripts
+ export GOPATH=/opt/gogs_src
+ GOPATH=/opt/gogs_src
+ tar xzf ../sources/gogs_src.tar.gz
+ sudo mv gogs_src /opt/gogs_src
+ cd /opt/gogs_src/src/github.com/gogits/gogs
+ sudo GOPATH=/opt/gogs_src: go get ./...
+ sudo GOPATH=/opt/gogs_src: go build
+ cd /var/cache/yunohost/from_file/scripts
+ sudo ln -s /opt/gogs_src/src/github.com/gogits/gogs /opt/gogs
+ repo_path=/home/yunohost.app/gogs
+ sudo mkdir -p /home/yunohost.app/gogs
+ sudo yunohost app setting gogs repopath -v /home/yunohost.app/gogs
+ sudo mkdir -p /etc/gogs/conf
+ sudo mkdir -p /home/gogs/data/avatars
+ sudo mkdir -p /var/log/gogs
+ sudo rm -rf /opt/gogs/log
+ sudo rm -rf /opt/gogs/custom
+ sudo rm -rf /opt/gogs/data
+ sudo ln -fs /etc/gogs /opt/gogs/custom
+ sudo ln -fs /home/gogs/data /opt/gogs/data
+ sudo ln -fs /var/log/gogs /opt/gogs/log
+ sudo cp ../conf/logrotate /etc/logrotate.d/gogs
+ sudo service rsyslog restart
Failed to open /dev/tty: No such device or address
++ cat /etc/debian_version
+ [[ 8.2 = \7\.* ]]
+ sudo cp ../conf/systemd/gogs.service /etc/systemd/system/
+ sudo systemctl daemon-reload
+ sudo systemctl enable gogs.service
Created symlink from /etc/systemd/system/multi-user.target.wants/gogs.service to /etc/systemd/system/gogs.service.
+ sudo chown gogs:gogs -R /opt/gogs_src
+ sudo chown gogs:gogs -R /etc/gogs
+ sudo chown -hR gogs:gogs /home/yunohost.app/gogs
+ sudo chown -R gogs:gogs /var/log/gogs
+ sudo chown -R gogs:gogs /home/gogs
+ sudo cp ../conf/app.ini /opt/gogs/custom/conf
+ sudo sed -i s@yuno_repo@/home/yunohost.app/gogs@g /opt/gogs/custom/conf/app.ini
+ sudo sed -i s@yuno_url@moul.re/gogs@g /opt/gogs/custom/conf/app.ini
+ sudo sed -i s/yuno_dbpdw/O6hChG9jnz4hF8zLHd5g6saf/g /opt/gogs/custom/conf/app.ini
+ sudo sed -i s/yuno_dbuser/gogs/g /opt/gogs/custom/conf/app.ini
+ sudo sed -i s/yuno_domain/moul.re/g /opt/gogs/custom/conf/app.ini
+ sudo sed -i s/yuno_key/JIMn9YsnJnTD06y/g /opt/gogs/custom/conf/app.ini
+ sudo chown gogs:gogs /opt/gogs/custom/conf/app.ini
+ sudo service gogs restart
Failed to open /dev/tty: No such device or address
+ sleep 30
++ sudo cat /etc/yunohost/mysql
+ mysql -u root -p8wH3WedwcG
ERROR 1146 (42S02) at line 1: Table 'gogs.login_source' doesn't exist
+ curl --user moul:psswd http://localhost:6000
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to localhost port 6000: Connection refused
++ sudo cat /etc/yunohost/mysql
+ mysql -u root -p8wH3WedwcG
+ sudo yunohost service add gogs --log /var/log/gogs.log
Success! Service successfully added
+ sed -i s@PATHTOCHANGE@/gogs@g ../conf/nginx.conf
+ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/moul.re.d/gogs.conf
+ '[' Yes = Yes ']'
+ sudo yunohost app setting gogs unprotected_uris -v /
+ sudo yunohost app ssowatconf
Success! SSOwat configuration successfully generated
+ sudo service nginx reload
Failed to open /dev/tty: No such device or address
+ sudo service gogs restart
Failed to open /dev/tty: No such device or address
Success! SSOwat configuration successfully generated
Success! Installation complete
M5oul commented 9 years ago

Ok, finally, I succed with:

root@moulinette:~# mysql -u root -p$(sudo cat /etc/yunohost/mysql) < login_source.sql 
root@moulinette:~# curl --user moul:psswd http://localhost:6000 > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5348    0  5348    0     0  87500      0 --:--:-- --:--:-- --:--:-- 89133
root@moulinette:~# mysql -u root -p$(sudo cat /etc/yunohost/mysql) < add_admin.sql 
root@moulinette:~# sudo service gogs restart

I do not know why it fail in the install script. It is may be linked to Failed to open /dev/tty: No such device or address errors. May be root rights are needed.

mbugeia commented 9 years ago

Well I did have a similar behaviour the first time I tried @Josue-T pull request but after a reboot of my server and a reinstall everything went right so I don't really know what happen.

I think the error "Failed to open /dev/tty: No such device or address" is not related, since Jessie I have this error for all app that use "sudo service someservice someaction"

M5oul commented 9 years ago

Ok, I understand, account is linked to LDAP. We log-in with YunoHost account and not with the one we created. So password asking and co is useless.

mbugeia commented 8 years ago

I think everything in this issue has been fixed. I've changed the way the admin user is created (now it's a ldap filter) so there is no longer curl call.