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

Enhancement Request: Test Environment Setup Guide #8

Open
jyluo opened this issue Apr 15, 2016 · 11 comments
Open

Enhancement Request: Test Environment Setup Guide #8

jyluo opened this issue Apr 15, 2016 · 11 comments

Comments

@jyluo
Copy link
Contributor

jyluo commented Apr 15, 2016

It would be good to provide a short instruction document to contributors of this project (present or future) on how to get a test environment running, namely the web server and how it should be configured.

@wmdietl
Copy link
Member

wmdietl commented Apr 15, 2016

I think you just run setup-and-run-8081.sh for a test server on port 8081.
But I agree that README.md should be expanded to point to what the different scripts do and what the different directories contain.

@CharlesZ-Chen
Copy link
Collaborator

The easiest choice would be directly using bottle server by running python bottle_server.py under web server directory. And if you already have apache2 and installed python module mod_wsgi, you can run setup-and-run-8081.sh to deploy a test server on 8081 port to apache.
I will make a short guide soon.

@CharlesZ-Chen
Copy link
Collaborator

CharlesZ-Chen commented Apr 17, 2016

Hi Jeff,

I've add a first version of a short guide on how to deploy a test server and also how to deploy a production server here:
https://github.com/eisop/webserver/blob/master/README.md

Please let me know if you meet problems when following this guide or have any suggestions on how to improve it. Thanks!

@jyluo
Copy link
Contributor Author

jyluo commented Apr 18, 2016

Hey Charles,

At the step to install mod-macro: I get the following:

jeff@cookie:~/workspace/jsr308/webserver$ sudo apt-get install libapache2-mod-macro
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libapache2-mod-macro is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  apache2-bin:i386 apache2-bin

E: Package 'libapache2-mod-macro' has no installation candidate

It looks like for ubuntu 15.10 and newer, mod-macro has been folded into apache2-bin which is installed with apache2 by default
https://bugs.launchpad.net/ubuntu/wily/amd64/libapache2-mod-macro

Also the guide has a typo at line 24: https://github.com/eisop/webserver/blob/master/README-eisop.txt#L24 and it would be better to separate a2enmod macro into a separate line of command.

The second a2enmod line of command results in the following:

jeff@cookie:~/workspace/jsr308/webserver/test$ (sudo a2enmod macro actives macro module)
Module macro already enabled
ERROR: Module actives does not exist!
Module macro already enabled
ERROR: Module module does not exist!

Are the modules actives and module required?

Lastly, for step 3 of https://github.com/eisop/webserver/blob/master/README.md what exactly do we need to configure?

@CharlesZ-Chen
Copy link
Collaborator

  1. Sorry, I didn't test it in ubuntu 15.10 before, mine ubuntu version is 14.10, will note this difference in our README.md.
  2. Thanks for revealing this typo, will correct it.
  3. "a2enmod macro actives macro module" is not a command, it just explains what a2enmod macro does. The real command is the line above it: https://github.com/eisop/webserver/blob/master/README-eisop.txt#L24

Maybe this way is confusing, I will enhance it.

Thanks a lot!

@CharlesZ-Chen
Copy link
Collaborator

For step 3 of https://github.com/eisop/webserver/blob/master/README.md, there actually have several things need to be configure.

The comments in https://github.com/eisop/webserver/blob/master/wsgi-scripts/checkerweb-wsgi.conf
describes the meaning of each line in this configure file. And in this file, you can customise whatever you want to change.

Maybe I should have a more detail instruction here... Will update it soon.

@CharlesZ-Chen
Copy link
Collaborator

Hi Jeff, I've already add a detail instruction on configuring apache2 host files.

  1. https://github.com/eisop/webserver/blob/master/README.md
  2. https://github.com/eisop/webserver/blob/master/wsgi-scripts/README

Hope that would be helpful. Thanks!

@jyluo
Copy link
Contributor Author

jyluo commented Apr 18, 2016

Hey Charles,

After updating the macro line with my local folder name (webserver), host name (localhost), and user name, i kept getting this error:

jeff@cookie:/home/jeff$ sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
jeff@cookie:/home/jeff$ systemctl status apache2.service
* apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Mon 2016-04-18 14:05:38 EDT; 11s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2312 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Apr 18 14:05:38 cookie apache2[2312]: *
Apr 18 14:05:38 cookie apache2[2312]: * The apache2 configtest failed.
Apr 18 14:05:38 cookie apache2[2312]: Output of config test was:
Apr 18 14:05:38 cookie apache2[2312]: AH00543: apache2: bad user name apache
Apr 18 14:05:38 cookie apache2[2312]: Action 'configtest' failed.
Apr 18 14:05:38 cookie apache2[2312]: The Apache error log may have more information.
Apr 18 14:05:38 cookie systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 18 14:05:38 cookie systemd[1]: Failed to start LSB: Apache2 web server.
Apr 18 14:05:38 cookie systemd[1]: apache2.service: Unit entered failed state.
Apr 18 14:05:38 cookie systemd[1]: apache2.service: Failed with result 'exit-code'.

It turns out that https://github.com/eisop/webserver/blob/master/wsgi-scripts/checkerweb-wsgi.conf#L19 is the cause, where it sets the user and group name to apache. By default the user and group name is www-data (according to http://askubuntu.com/questions/122330/unable-to-restart-apache-getting-error-apache2-bad-user-name-apache-run-use) and should probably be set to that. Does eisop server specifically have a special user called apache?

I've fixed this user and group ID problem locally by replacing apache with www-data, then it gave this error:

No such file or directory: AH02291: Cannot access directory '/var/www/webserver/log/' for error log of vhost defined at macro 'vhost_checkerweb' (d...b-wsgi.conf":1

This one was fixed by manually creating an empty log folder in webserver, which is the root of a clone of the webserver project. I think we need to either add an empty log folder to the project's repository, or add a few lines to an appropriate script to create this folder if it doesn't exist.

With these 2 fixes, I'm able to run the server at http://localhost/live.

@CharlesZ-Chen
Copy link
Collaborator

CharlesZ-Chen commented Apr 18, 2016

Hi Jeff,

Good to hear finally the web server is runnable in your local machine!

I've checked the configure file in eisop. It seems apache is a special user in eisop. And as you said, the default user and group name in Ubuntu should be www-data.

The apache2 in mine local Ubuntu VM would automatically create the /var/www/webserver/log directory, I thought this is the default way of apache2 to create log but it seems doesn't true.

I will think about how to fix these issues and let you know the result.

Thanks a lot for testing and providing so many useful feedback!

@wmdietl
Copy link
Member

wmdietl commented Apr 18, 2016

eisop runs Red Hat Enterprise Linux and there the user is called apache.
Create a separate script for Ubuntu if you want, but don't break the configuration for eisop.

I also had to manually create the log directory, so automating that would be good.

@CharlesZ-Chen
Copy link
Collaborator

Sure, I will automate the creation of log dir soon. thanks for revealing this issue!

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

3 participants