acoustid / acoustid-server

AcoustID's web site and API
MIT License
65 stars 21 forks source link

acoustid-server not working uwsgi #34

Closed mihwas closed 7 years ago

mihwas commented 8 years ago

Hello! I have installed a acoustid-server, using the clone of the master branch. I'm using virtualenv, as it describe from README.md. After all steps has been done - i run a standalone server for testing. after connection to http://myhost_ip:5000 - i see a page.

Then i have tried to configure it to run via uwsgi. I have created a uwsgi configuration file: /etc/uwsgi/apps-enabled/acoustid.ini `[uwsgi] project = acoustid base = /usr/local/acoustid-server

chdir = %(base)/ home = %(base)/e/ venv = %(base)/e/ module = %(project).wsgi:application

module = %(project).test

master = true workers = 5

env = ACOUSTID_CONFIG=/usr/local/acoustid-server/acoustid.conf uid = root gid = root http =:8080 vacuum = true ` After i have run uwsgi - it starts correctly, but when i trying to connect to the server to 8080 port - i have received 404_not_foud error for each GET. In wsgi logs at that moment i see something like this:

[pid: 14710|app: 0|req: 3/4] ip () {36 vars in 649 bytes} [Fri Oct 14 11:51:10 2016] GET / => generated 233 bytes in 0 msecs (HTTP/1.1 404) 2 headers in 72 bytes (1 switches on core 0) [pid: 14714|app: 0|req: 2/5] ip () {36 vars in 603 bytes} [Fri Oct 14 11:51:11 2016] GET /favicon.ico => generated 233 bytes in 0 msecs (HTTP/1.1 404) 2 headers in 72 bytes (1 switches on core 0

For testing i have created a small script, called test.py, which returns "Hello world!" string - it works fine. Also i have tried to use gunicorn - i'we got the same issue with 404.

Uwsgi version is 2.0.12-debian Where can i find an issue? Thank you very much!

lalinsky commented 8 years ago

The module acoustid.wsgi only serves the API, which has no handler for /. A request to /ws/lookup should give you some response.

mihwas commented 8 years ago

Yes, thank you. It's really works. But one more question - can i find some documentation about the /ws/ api anywhere? At the acoustid.org website i have saw only /v2/ preffix for api access. For example - how can i register new application or user keys, if my local server runs only in API mode (using uwsgi)? Is there any API commands using website secret variable, or only one way to do this - INSERT directly into PostgreSQL database by default db algorithm? Thanks a lot!

lalinsky commented 8 years ago

The /ws prefix was there historically to allow me to serve both api and the website from the same uwsgi app. For the api domain, it's just removed from the path. This is the nginx config part used in production:

    location / {
        rewrite ^/?(.*)$ /ws/$1 break;
        include uwsgi_params;
        uwsgi_pass acoustid_live_api_rw;
    }

Regarding the api keys, the easiest way is probably to insert things into the database. This was never really designed to run anywhere but on acoustid.org, so the website is the only tool that can manage api keys.

mihwas commented 8 years ago

Yes, i got it. But have one more offtopic question. I tried to ask it at the google mailing lists, but it looks like some questions are unanswered from september.

Hello! I have sucessfully installed acoustid-server on standalone dedicated server. Then i have imported all data from fulldump, also create a musicbrainz schema and import data inside it too. Now i'm trying to use automated sync script, provided in ./admin directory.

So, i have seted up an acoustid-server and trying to use replication script. It works fine, but extremely slow. For hourly dump near 5 Mb it took near 30min - 1 hour for operation. I have tried to drop Primary keys, Indexes, Constraints. I have allready did VACUUM on acoustid db, but it did not bring any effect. Is anybody have the same issue? Or it is default time for sync?

Thanks a lot!