Page MenuHomePhabricator

Having trouble with docker-compose on SVG Translate
Closed, DeclinedPublic

Description

I used to have an old (7 months) version of SVG translate that would work fine with docker-compose. I have recently updated to the latest code and I am no longer able to get the instance running.

~/wmf
▶ git clone git@github.com:wikimedia/svgtranslate.git
Cloning into 'svgtranslate'...
remote: Enumerating objects: 35, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 3911 (delta 5), reused 17 (delta 4), pack-reused 3876
Receiving objects: 100% (3911/3911), 2.55 MiB | 2.29 MiB/s, done.
Resolving deltas: 100% (1679/1679), done.

~/wmf
▶ cd svgtranslate

~/wmf/svgtranslate  master ✔                                                                                                                                                 3d
▶ cp .env.dist .env

~/wmf/svgtranslate  master ✔                                                                                                                                                 3d
▶ docker-compose up
Starting svgtranslate_assets_1 ... done
Starting svgtranslate_wiki_1   ... done
Starting svgtranslate_web_1    ... error

ERROR: for svgtranslate_web_1  Cannot start service web: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"./bin/dockerstart\": stat ./bin/dockerstart: no such file or directory": unknown

ERROR: for web  Cannot start service web: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"./bin/dockerstart\": stat ./bin/dockerstart: no such file or directory": unknown
ERROR: Encountered errors while bringing up the project.

Related Objects

Event Timeline

Prtksxna created this task.Jul 22 2019, 2:48 AM
Restricted Application added a project: Community-Tech. · View Herald TranscriptJul 22 2019, 2:48 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

If you have existing svgtranslate containers, you probably need to rebuild. Try:

docker-compose up --force-recreate --build

Thanks @Samwilson, that worked. Also, is there a workaround for the WIKI_URL if I don't have a local wiki?

You do have a local wiki! :-) It's the 3rd docker image; try http://localhost:8043/

The address given in in the .env file is the docker-compose internal address, so should stay as WIKI_URL=https://wiki/api.php (the hostname is the same as the image name).

You do have a local wiki! :-) It's the 3rd docker image; try http://localhost:8043/

😳I do!

The address given in in the .env file is the docker-compose internal address, so should stay as WIKI_URL=https://wiki/api.php (the hostname is the same as the image name).

I am getting this error when I try to translate something, so I thought it was the lack of a wiki. Any ideas?

It looks like maybe the wiki container isn't set up properly. Can you view the wiki at http://localhost:8043/, edit pages and upload files?

Looking into it, I think there might be a situation in which the cache sqlite file isn't created with the right permissions (in var/wiki/); it should be writable by www-data. I might have a patch for this in a mo'. But yeah, in the meantime see if your wiki is working okay.

The issue here seems to be with the mismatch of hostnames between the host machine (where we can get both svgtranslate and its wiki via http://localhost) and the Docker-internal communication for oauth (where they're http://wiki and http://web). So svgtranslate makes a request to http://wiki/ to get the oauth request token (this is successful), and (the ToolforgeBundle) redirects the user to http://wiki/index.php?title=Special:OAuth/authorize (which fails).

I think we need to modify the bundle to be able to set the Oauth client's "redirect URL". It seems that the current Client service is created via a method that doesn't allow setting that very easily, so maybe we need to make our own service class. Anyway, if we could set the redirect-URL to http://localhost:8042/index.php?title=Special:OAuth/authorize& then things would perhaps be fine. We'd probably introduce this via a new env var for the bundle, e.g. OAUTH_REDIRECT_URL (alongside the current OAUTH_URL).

It looks like maybe the wiki container isn't set up properly. Can you view the wiki at http://localhost:8043/, edit pages and upload files?

Yep, I can edit pages, create accounts, and upload files.

I pulled the most recent changes and recreated the instance, still the same error F29836908.

I think we need to modify the bundle to be able to set the Oauth client's "redirect URL". It seems that the current Client service is created via a method that doesn't allow setting that very easily, so maybe we need to make our own service class. Anyway, if we could set the redirect-URL to http://localhost:8042/index.php?title=Special:OAuth/authorize& then things would perhaps be fine. We'd probably introduce this via a new env var for the bundle, e.g. OAUTH_REDIRECT_URL (alongside the current OAUTH_URL).

Is this something I can do manually to test? I'm only setting it up locally to test https://github.com/wikimedia/svgtranslate/pull/116.

If you're not trying to log in, it should be working correctly. Make sure your .env has WIKI_URL=https://wiki/api.php and not localhost.

Yup, the .env file is correct, and I am not trying to log in. When I try to navigate to - http://localhost:8042/File:Speech_bubbles.svg I get an error. Here is the stack trace:

1GuzzleHttp\Exception\ConnectException:
2cURL error 7: Failed to connect to wiki port 443: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
3
4 at vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:185
5 at GuzzleHttp\Handler\CurlFactory::createRejection(object(EasyHandle), array('errno' => 7, 'error' => 'Failed to connect to wiki port 443: Connection refused', 'url' => 'https://wiki/api.php?action=query&prop=imageinfo&iiprop=url&titles=File%3ASpeech_bubbles.svg&format=json&formatversion=2', 'content_type' => null, 'http_code' => 0, 'header_size' => 0, 'request_size' => 0, 'filetime' => -1, 'ssl_verify_result' => 0, 'redirect_count' => 0, 'total_time' => 0.029843, 'namelookup_time' => 0.029396, 'connect_time' => 0.0, 'pretransfer_time' => 0.0, 'size_upload' => 0.0, 'size_download' => 0.0, 'speed_download' => 0.0, 'speed_upload' => 0.0, 'download_content_length' => -1.0, 'upload_content_length' => -1.0, 'starttransfer_time' => 0.0, 'redirect_time' => 0.0, 'redirect_url' => '', 'primary_ip' => '', 'certinfo' => array(), 'primary_port' => 0, 'local_ip' => '', 'local_port' => 0))
6 (vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:149)
7 at GuzzleHttp\Handler\CurlFactory::finishError(object(CurlHandler), object(EasyHandle), object(CurlFactory))
8 (vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:102)
9 at GuzzleHttp\Handler\CurlFactory::finish(object(CurlHandler), object(EasyHandle), object(CurlFactory))
10 (vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php:43)
11 at GuzzleHttp\Handler\CurlHandler->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
12 (vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:28)
13 at GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
14 (vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:51)
15 at GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
16 (vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php:37)
17 at GuzzleHttp\PrepareBodyMiddleware->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
18 (vendor/guzzlehttp/guzzle/src/Middleware.php:30)
19 at GuzzleHttp\Middleware::GuzzleHttp\{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
20 (vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php:70)
21 at GuzzleHttp\RedirectMiddleware->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
22 (vendor/guzzlehttp/guzzle/src/Middleware.php:60)
23 at GuzzleHttp\Middleware::GuzzleHttp\{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
24 (vendor/guzzlehttp/guzzle/src/HandlerStack.php:67)
25 at GuzzleHttp\HandlerStack->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
26 (vendor/guzzlehttp/guzzle/src/Client.php:277)
27 at GuzzleHttp\Client->transfer(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false))
28 (vendor/guzzlehttp/guzzle/src/Client.php:125)
29 at GuzzleHttp\Client->requestAsync('GET', object(Uri), array('query' => array('action' => 'query', 'prop' => 'imageinfo', 'iiprop' => 'url', 'titles' => 'File:Speech_bubbles.svg', 'format' => 'json', 'formatversion' => 2), 'synchronous' => true, 'base_uri' => object(Uri), 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => 5, 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false, '_conditional' => array('User-Agent' => 'GuzzleHttp/6.3.3 curl/7.52.1 PHP/7.2.8-1+0~20180725124257.2+stretch~1.gbp571e56')))
30 (vendor/guzzlehttp/guzzle/src/Client.php:131)
31 at GuzzleHttp\Client->request('GET', '', array('query' => array('action' => 'query', 'prop' => 'imageinfo', 'iiprop' => 'url', 'titles' => 'File:Speech_bubbles.svg', 'format' => 'json', 'formatversion' => 2), 'headers' => array('User-Agent' => 'SvgTranslate - https://github.com/wikimedia/svgtranslate'), 'synchronous' => true))
32 (src/Service/MediaWikiApi.php:88)
33 at App\Service\MediaWikiApi->request(array('action' => 'query', 'prop' => 'imageinfo', 'iiprop' => 'url', 'titles' => 'File:Speech_bubbles.svg', 'format' => 'json', 'formatversion' => 2))
34 (src/Service/MediaWikiApi.php:56)
35 at App\Service\MediaWikiApi->imageInfo('Speech_bubbles.svg')
36 (src/Service/Retriever.php:29)
37 at App\Service\Retriever->retrieve('Speech_bubbles.svg')
38 (src/Service/FileCache.php:46)
39 at App\Service\FileCache->getPath('Speech_bubbles.svg')
40 (src/Controller/TranslateController.php:58)
41 at App\Controller\TranslateController->translate(object(Request), object(Intuition), object(Session), object(FileCache), 'Speech_bubbles.svg', 'File')
42 (vendor/symfony/http-kernel/HttpKernel.php:150)
43 at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
44 (vendor/symfony/http-kernel/HttpKernel.php:67)
45 at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
46 (vendor/symfony/http-kernel/Kernel.php:198)
47 at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
48 (public/index.php:33)

Prtksxna closed this task as Declined.Aug 2 2019, 1:28 AM

I don't really need this any more, so no need to help me debug 😊
Happy to provide more info if you'd like though.

Okay, thanks.

We can pick this up again later if anyone needs it.