Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help wanted] How to run and see the webpage #141

Open
gongzelong0718 opened this issue Oct 30, 2019 · 4 comments
Open

[Help wanted] How to run and see the webpage #141

gongzelong0718 opened this issue Oct 30, 2019 · 4 comments

Comments

@gongzelong0718
Copy link

Sorry, I installed it before, but it has been a long time since that. And the issue comes.

zelong@zelong-ThinkPad-T430:/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic$ sudo python install.py
[sudo] password for zelong: 

ERROR: Found an .installed file in the directory you're installing from.

This typically means that Critic is already installed on this system, and if so
then the upgrade.py script should be used to upgrade the installation rather than
re-running install.py.

zelong@zelong-ThinkPad-T430:/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic$ sudo python upgrade.py 

ERROR: /etc/critic/main: no such directory
HINT: Make sure the --etc-dir[=/etc/critic] and --identity[=main] options
      correctly define where the installed system's configuration is stored.

I am on a new Ubuntu 16.04 and I guess the etc/critic is missing if I created that dir before on the previous machine.

Anyone knows how to run the code and see the Critic web page?

Really want to get it started

@gongzelong0718 gongzelong0718 changed the title How to run and see the webpage [Help wanted] How to run and see the webpage Oct 30, 2019
@jensl
Copy link
Owner

jensl commented Oct 30, 2019

If you've installed Critic on one machine, and then copied the Git checkout to a new machine, you'd get this error. In that case, just moving the .installed file out of the way (e.g. delete it) should solve the problem. After that, sudo python install.py should work.

@gongzelong0718
Copy link
Author

Hi, jensl, I have trouble to login the github before, now it is okay. Thanks for your reply. Long time no see.
BTW, cute baby :D

@gongzelong0718
Copy link
Author

zelong@zelong-ThinkPad-T430:/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic$ rm -rf .installed 
zelong@zelong-ThinkPad-T430:/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic$ sudo python install.py 

WARNING: You're about to install an unstable development version of Critic.

If you're setting up a production server, you're most likely better off
installing from the latest stable branch.

The latest stable branch is the default branch (i.e. HEAD) in Critic's GitHub
repository at

  https://github.com/jensl/critic.git

To interrogate it from the command-line, run

  $ git ls-remote --symref https://github.com/jensl/critic.git HEAD

Do you want to continue installing the unstable version? [Y/n] Y

Critic Installation: System
===========================

What is the machine's FQDN? [zelong-ThinkPad-T430] 
What system user should Critic run as? [critic] 

The system user 'critic' doesn't exists.

Create a system user named 'critic'? [Y/n] 
What system group should Critic run as? [critic] 

The system group 'critic' doesn't exists.

Create a system group named 'critic'? [Y/n] 
What address should be used as the sender of emails from the system? [critic@zelong-ThinkPad-T430] 

Critic Installation: Paths
==========================

Where should Critic's configuration files be installed? [/etc/critic] 
Where should Critic's source code be installed? [/usr/share/critic] 
Where should Critic's persistent data files live? [/var/lib/critic] 
Where should Critic's temporary data files live? [/var/cache/critic] 
Where should Critic's Git repositories live? [/var/git] 
Where should Critic's log files live? [/var/log/critic] 
Where should Critic's runtime files live? [/var/run/critic] 

Critic Installation: Authentication
===================================

Critic needs to identify (via HTTP authentication) users who access
the Web front-end.  This can be handled in two different ways:

  host    The Web server (Apache) handles authentication and Critic
          only makes use of the user name that it reports via the
          WSGI API.

  critic  Critic implements HTTP authentication itself using passwords
          stored (encrypted) in its database.

Which authentication mode should be used? [critic] 

Critic can authenticate users either via HTTP authentication or via a
"Sign in" form and session cookies.  The major difference is that HTTP
authentication requires a valid login to access any page whereas the
other type of authentication supports limited anonymous access.

  httpauth  Use HTTP authentication.

  cookie    Use session cookie based authentication.

Which session type should be used? [cookie] 

With cookie based authentication, Critic can support anonymous access.
Users still have to sign in in order to make any changes (such as
write comments in reviews) but will be able to view most information
in the system without signin in.

Do you want to allow anonymous access? [Y/n] 

With cookie based authentication, Critic can support unattended user
registration.  With this enabled, the "Sign in" page has a link to a
page where a new user can register a Critic user without needing to
contact the system administrator(s).

Do you want to allow user registration? [y/N] 

Critic Installation: Web Server Integration
===========================================

This installation script can install and do basic configuration of a
few different host web servers.  Supported web servers are:

  1) nginx + uWSGI

     Use the nginx web server together with uWSGI as the WSGI
     application server to actually run Critic.

     This is the recommended option for new installs.

  2) uWSGI

     Use uWSGI as both HTTP(S) front-end and as the WSGI application
     server to actually run Critic.

  3) Apache + mod_wsgi

     Use the Apache web server and its third-party WSGI module
     (mod_wsgi) to actually run Critic.  This is the traditional
     configuration used to run Critic, but mod_wsgi is not actively
     maintained, and has some known issues.

  4) no integration

     Don't configure any web server.  The installation performed by
     this script will be incomplete and the system administrator will
     need to set the integration up themselves.

What web server should be set up? [nginx+uwsgi] 

Critic Installation: Scheme
===========================

Critic can be set up to be accessed over HTTP, HTTPS, or both.  This
installation script will not do the actual configuration of the host
web server (Apache) necessary for it to support the desired schemes
(in particular HTTPS, which is non-trivial,) but can at least set up
Critic's Apache site declaration appropriately.

You have three choices:

  http   Critic will be accessible only over HTTP.

  https  Critic will be accessible only over HTTPS.

  both   Critic will be accessible over both HTTP and HTTPS.

If you choose "both", Critic will redirect all authenticated accesses
to HTTPS, to avoid sending credentials over plain text connections.
Anonymous users will be allowed to access the site over HTTP, though.
If this is not desirable, you should select "https" and configure the
web server to redirect all HTTP accesses to HTTPS.

How will Critic be accessed? [http] 

Critic Installation: Administrator
==================================

An administrator user is a Critic user with some special privileges;
they can do various things using the Web interface that other users
are not allowed to do.  Additional administrator users can be added
post-installation using the 'criticctl' utility.

This user does not need to match a system user on this machine.

Administrator user name: 
Invalid input: empty.
Administrator user name: 
Invalid input: empty.
Administrator user name: 
Invalid input: empty.
Administrator user name: 
Invalid input: empty.
Administrator user name: 
Invalid input: empty.
Administrator user name: 
Invalid input: empty.
Administrator user name: gongzelong
Administrator email address: [email protected]
Administrator full name: gongzelong
Password for 'gongzelong': 
And again: 

Critic Installation: System Messages
====================================

Critic sends out email notifications when unexpected errors (crashes)
occur, and in various other cases when things happen that the system
administrators might need to know about right away.

Where should system messages be sent? [gongzelong <[email protected]>] 

Critic Installation: SMTP
=========================

Critic needs an SMTP server to use for outgoing email traffic.  Emails
are sent to regular Critic users to notify about changes in reviews, as
well as to the system administrator to alert about problems.

Use SSL when connecting to the SMTP server? [y/N] 
Use STARTTLS when connecting to the SMTP server? [y/N] 
SMTP host: [localhost] 
SMTP port: [25] 
Does the SMTP server require authentication? [y/N] 

Do you want to send a test email to verify the SMTP configuration? [Y/n] 
To which email address? [[email protected]] 

Couldn't send the test email:

  Couldn't connect to the SMTP server.

Please check the configuration!

Use SSL when connecting to the SMTP server? [y/N] 
Use STARTTLS when connecting to the SMTP server? [y/N] N
SMTP host: [localhost] 
SMTP port: [25] 
Does the SMTP server require authentication? [y/N] 

Do you want to send a test email to verify the SMTP configuration? [y/n] 
Please answer 'y'/'yes' or 'n'/'no'.

Do you want to send a test email to verify the SMTP configuration? [y/n] n


Critic Installation: Prerequisites
==================================

No 'uwsgi' executable found in $PATH

Make sure the uWSGI application container server is installed.  In
Debian/Ubuntu, the package you need to install is 'uwsgi'.

In addition, the uWSGI Python plugin needs to be installed.  In Debian/Ubuntu,
the package you need to install is 'uwsgi-plugin-python'.

Found 'apt-get' executable in your $PATH.  This script can attempt to install
missing software using it.

Do you want to use 'apt-get' to install missing packages? [Y/n] Y
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          E: Sub-process /usr/bin/dpkg returned an error code (1)
FAILED: installation.prereqs.install()
Traceback (most recent call last):
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/install_main.py", line 160, in main
    if hasattr(module, "install") and not module.install(data):
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/prereqs.py", line 315, in install
    if not all(prerequisite.install() for prerequisite in prerequisites):
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/prereqs.py", line 315, in <genexpr>
    if not all(prerequisite.install() for prerequisite in prerequisites):
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/prereqs.py", line 133, in install
    return super(Executable, self).install()
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/prereqs.py", line 111, in install
    install_packages(*self.packages)
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/prereqs.py", line 75, in install_packages
    env=aptget_env)
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['/usr/bin/apt-get', '-qq', '-y', 'install', 'uwsgi', 'uwsgi-plugin-python']' returned non-zero exit status 100

ERROR: Installation aborted.

I guess there is something wrong with the uwsgi and uwsgi-plugin-python installation.

zelong@zelong-ThinkPad-T430:/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic$ apt-get install uwsgi uwsgi-plugin-python
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
zelong@zelong-ThinkPad-T430:/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic$ sudo apt-get install uwsgi uwsgi-plugin-python
Reading package lists... Done
Building dependency tree       
Reading state information... Done
uwsgi is already the newest version (2.0.12-5ubuntu3.2).
uwsgi-plugin-python is already the newest version (2.0.12-5ubuntu3.2).
The following package was automatically installed and is no longer required:
  snapd-login-service
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up nginx-core (1.10.3-0ubuntu0.16.04.4) ...
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since 一 2019-11-11 12:02:35 CST; 7ms ago
  Process: 12127 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 12124 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

11月 11 12:02:33 zelong-ThinkPad-T430 nginx[12127]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:02:33 zelong-ThinkPad-T430 nginx[12127]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:02:34 zelong-ThinkPad-T430 nginx[12127]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:02:34 zelong-ThinkPad-T430 nginx[12127]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:02:35 zelong-ThinkPad-T430 nginx[12127]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:02:35 zelong-ThinkPad-T430 nginx[12127]: nginx: [emerg] still could not bind()
11月 11 12:02:35 zelong-ThinkPad-T430 systemd[1]: nginx.service: Control process exited, code=exited status=1
11月 11 12:02:35 zelong-ThinkPad-T430 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
11月 11 12:02:35 zelong-ThinkPad-T430 systemd[1]: nginx.service: Unit entered failed state.
11月 11 12:02:35 zelong-ThinkPad-T430 systemd[1]: nginx.service: Failed with result 'exit-code'.
dpkg: error processing package nginx-core (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-core (>= 1.10.3-0ubuntu0.16.04.4) | nginx-full (>= 1.10.3-0ubuntu0.16.04.4) | nginx-light (>= 1.10.3-0ubuntu0.16.04.4) | nginx-extras (>= 1.10.3-0ubuntu0.16.04.4); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-core (<< 1.10.3-0ubuntu0.16.04.4.1~) | nginx-full (<< 1.10.3-0ubuntu0.16.04.4.1~) | nginx-light (<< 1.10.3-0ubuntu0.16.04.4.1~) | nginx-extras (<< 1.10.3-0ubuntu0.16.04.4.1~); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 nginx-core
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

@gongzelong0718
Copy link
Author

gongzelong0718 commented Nov 11, 2019

Then I reintalled it.

reating directory '/var/log/critic/main' ...
Creating directory '/var/run/critic' ...
Creating directory '/var/run/critic/main' ...
Creating directory '/var/run/critic/main/sockets' ...
Creating directory '/var/run/critic/main/wsgi' ...
Copied 412 files into /usr/share/critic ...
Creating database ...





Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
WARNING: The nginx service failed to start.

You can now either abort this Critic installation/upgrade, or you can
go ahead anyway, fix the configuration problem manually (now or
later), and then make sure the nginx service is running yourself
using the command

  service nginx (start|restart)

Note that if you don't abort, the Critic system will most likely not
be accessible until the configuration problem has been fixed.

Do you want to abort this Critic installation/upgrade? [y/n] y

ERROR: Installation aborted.






^CFAILED: installation.httpd.undo()
Traceback (most recent call last):
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/install_main.py", line 74, in abort
    module.undo()
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/httpd.py", line 473, in undo
    instance.undo()
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/httpd.py", line 428, in undo
    service.undo()
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/httpd.py", line 308, in undo
    self.restart()
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/httpd.py", line 129, in restart
    return self.start()
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/httpd.py", line 113, in start
    if not self.service_command("start", errors_are_fatal):
  File "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic/installation/httpd.py", line 90, in service_command
    subprocess.check_call(["service", self.service_name, command])
  File "/usr/lib/python2.7/subprocess.py", line 536, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 523, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1392, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
could not change directory to "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic": Permission denied
could not change directory to "/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic": Permission denied


zelong@zelong-ThinkPad-T430:/media/zelong/2828a0f1-cc41-4428-854d-a7a18c59f5c6/Opera/critic/critic$ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since 一 2019-11-11 12:06:47 CST; 8s ago
  Process: 12688 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 12686 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

11月 11 12:06:45 zelong-ThinkPad-T430 nginx[12688]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:06:45 zelong-ThinkPad-T430 nginx[12688]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:06:46 zelong-ThinkPad-T430 nginx[12688]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:06:46 zelong-ThinkPad-T430 nginx[12688]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:06:47 zelong-ThinkPad-T430 nginx[12688]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 11 12:06:47 zelong-ThinkPad-T430 nginx[12688]: nginx: [emerg] still could not bind()
11月 11 12:06:47 zelong-ThinkPad-T430 systemd[1]: nginx.service: Control process exited, code=exited status=1
11月 11 12:06:47 zelong-ThinkPad-T430 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
11月 11 12:06:47 zelong-ThinkPad-T430 systemd[1]: nginx.service: Unit entered failed state.
11月 11 12:06:47 zelong-ThinkPad-T430 systemd[1]: nginx.service: Failed with result 'exit-code'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants