RedpointArchive / phabricator

A Docker image that runs Phabricator, an open source software engineering tool
https://hub.docker.com/r/redpointgames/phabricator/
307 stars 98 forks source link

10-boot-conf startup issue #29

Closed jhameier closed 7 years ago

jhameier commented 8 years ago

I've been trying to get phabricator container to run with the mariadb container and It fails with the message (partial output ~ everything up to this point looks good):

[admin@R330SV3069 scripts]# ./phabricator.start.sh
Unable to find image 'hachque/phabricator:latest' locally
latest: Pulling from hachque/phabricator
7d3401a57fe8: Pull complete 
34f658f0bc1a: Pull complete 
6ab9be4fc512: Pull complete 
bfee2df15dde: Pull complete 
9ddc1611b88d: Pull complete 
87e16d7f95e7: Pull complete 
66d1a8b23d48: Pull complete 
Digest: sha256:7a1c1dee530fa48a7d52b1526c584148b645fd13c3a3613036371c1cd9263a9e
Status: Downloaded newer image for hachque/phabricator:latest
[ STARTING ] /etc/init.simple/10-boot-conf
+ '[' -f /baked ']'
+ '[' mariadb '!=' '' ']'
+ MYSQL_HOST_VARIABLE=mariadb_PORT_3306_TCP_ADDR
+ MYSQL_HOST=
+ MYSQL_PORT_VARIABLE=mariadb_PORT_3306_TCP_PORT
+ MYSQL_PORT=
+ unset MYSQL_HOST_VARIABLE
+ unset MYSQL_PORT_VARIABLE
+ '[' '' == '' ']'
+ MYSQL_STORAGE_NAMESPACE=phabricator
+ '[' letsencrypt == '' ']'
+ '[' '' == '' ']'
+ PHABRICATOR_STORAGE_TYPE=mysql
+ '[' '' '!=' '' ']'
+ '[' '' '!=' '' ']'
+ '[' '' '!=' '' ']'
+ '[' '' '!=' '' ']'
+ '[' '' '!=' '' ']'
+ '[' '' '!=' '' ']'
+ '[' -f /config/script.pre ']'
+ '[' -f /config/script.premig ']'
+ '[' -f /config/script.post ']'
+ '[' -f /config/script.phd ']'
+ '[' -f /config/script.letsencrypt ']'
+ '[' -f /config/letsencrypt.config ']'
+ '[' -d /config/keycache ']'
+ cat
+ source /config.saved
++ OVERRIDE_PHABRICATOR_URI=
++ OVERRIDE_PHABRICATOR_BRANCH=
++ OVERRIDE_ARCANIST_URI=
++ OVERRIDE_ARCANIST_BRANCH=
++ OVERRIDE_LIBPHUTIL_URI=
++ OVERRIDE_LIBPHUTIL_BRANCH=
++ PHABRICATOR_HOST=phabricator.etg.tgf.tc.faa.gov
++ PHABRICATOR_CDN=
++ PHABRICATOR_REPOSITORY_PATH=/repos
++ PHABRICATOR_STORAGE_TYPE=mysql
++ PHABRICATOR_STORAGE_PATH=/home/phab/phabricator/files
++ PHABRICATOR_STORAGE_BUCKET=
++ PHABRICATOR_HOST_KEYS_PATH=/home/phab/phabricator/keys
++ AWS_S3_ACCESS_KEY=
++ AWS_S3_SECRET_KEY=
++ MYSQL_HOST=
++ MYSQL_PORT=
++ MYSQL_USER=root
++ MYSQL_PASS=linux
++ MYSQL_STORAGE_NAMESPACE=phabricator
++ ENABLE_APCU=
++ ENABLE_UPDATE_ON_START=
++ SSL_TYPE=letsencrypt
++ SSL_CERTIFICATE=
++ SSL_PRIVATE_KEY=
++ SSL_EMAIL=
++ SCRIPT_BEFORE_UPDATE=
++ SCRIPT_BEFORE_MIGRATION=
++ SCRIPT_AFTER_MIGRATION=
++ SCRIPT_AFTER_LETS_ENCRYPT=
++ SCRIPT_BEFORE_DAEMONS=
++ SCRIPT_AFTER_DAEMONS=
+ '[' '' '!=' '' ']'
+ '[' '' == true ']'
+ pushd /srv/phabricator/phabricator
/srv/phabricator/phabricator /
+ '[' '' '!=' '' ']'
+ '[' '' '!=' '' ']'
+ '[' root '!=' '' ']'
+ sudo -u git ./bin/config set mysql.user root
Set 'mysql.user' in local configuration.
+ '[' linux '!=' '' ']'
+ sudo -u git ./bin/config set mysql.pass linux
Set 'mysql.pass' in local configuration.
+ '[' phabricator '!=' '' ']'
+ sudo -u git ./bin/config set storage.default-namespace phabricator
Set 'storage.default-namespace' in local configuration.
+ '[' phabricator.etg.tgf.tc.faa.gov '!=' '' ']'
+ '[' letsencrypt == none ']'
+ sudo -u git ./bin/config set phabricator.base-uri https://phabricator.etg.tgf.tc.faa.gov/
Set 'phabricator.base-uri' in local configuration.
+ '[' '' '!=' '' ']'
+ sudo -u git ./bin/config set phd.user git
Set 'phd.user' in local configuration.
+ sudo -u git ./bin/config set pygments.enabled true
Set 'pygments.enabled' in local configuration.
+ '[' /repos '!=' '' ']'
+ sudo -u git ./bin/config set repository.default-local-path /repos
Set 'repository.default-local-path' in local configuration.
+ '[' mysql == mysql ']'
+ sudo -u git ./bin/config set storage.mysql-engine.max-size 67108864
Set 'storage.mysql-engine.max-size' in local configuration.
+ '[' mysql == disk ']'
+ '[' mysql == s3 ']'
+ '[' '' '!=' '' ']'
+ '[' '' '!=' '' ']'
+ '[' letsencrypt == none ']'
+ APHLICT_PROTOCOL=https
+ APHLICT_PORT=443
+ sudo -u git ./bin/config set notification.servers '[{"type": "client","host": "phabricator.etg.tgf.tc.faa.gov","port": 443,"protocol": "https","path": "/ws/"},{"type": "admin","host": "127.0.0.1","port": 22281,"protocol": "http"}]'
Set 'notification.servers' in local configuration.
+ unset APHLICT_PROTOCOL
+ unset APHLICT_PORT
+ popd
/
+ '[' '' == true ']'
+ '[' '' '!=' '' ']'
+ mysqlcheck --host= --port= --user=root --password=linux --databases phabricator_search
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2 "No such file or directory") when trying to connect
+ true
+ /srv/phabricator/phabricator/bin/storage upgrade --force
MySQL Credentials Not Configured

Unable to connect to MySQL using the configured credentials. You must
configure standard credentials before you can upgrade storage. Run these
commands to set up credentials:

  phabricator/ $ ./bin/config set mysql.host __host__
  phabricator/ $ ./bin/config set mysql.user __username__
  phabricator/ $ ./bin/config set mysql.pass __password__

These standard credentials are separate from any administrative credentials
provided to this command with __--user__ or __--password__, and must be
configured correctly before you can proceed.

Raw MySQL Error: Attempt to connect to root@localhost failed with error
#2002: No such file or directory.
[ FAILED ] /etc/init.simple/10-boot-conf

Here is my config file:

docker run -it \
    --rm -p 80:80 -p 443:443 \
    --env PHABRICATOR_HOST=phabricator.etg.tgf.tc.faa.gov \
    --env PHABRICATOR_REPOSITORY_PATH=/repos \
    --env PHABRICATOR_STORAGE_TYPE=disk \
    --env PHABRICATOR_STORAGE_PATH=/files \
    --env PHABRICATOR_HOST_KEYS_PATH=/keys \
    --env MYSQL_LINKED_CONTAINER=mariadb \
    --env MYSQL_USER=root \
    --env MYSQL_PASS=linux \
    --link mariadb:mysql \
    --env SSL_TYPE=letsencrypt \
    -v /home/phab/phabricator/repos:/repos \
    -v /home/phab/phabricator/files:/files \
    -v /home/phab/phabricator/keys:/keys \
    --name phabricator hachque/phabricator

It should be noted that I had to also remove the -p 22:22 as that was causing in issue stating that port 22 was already in use which I'm assuming is being used by mariadb container.

docker: Error response from daemon: driver failed programming external connectivity on endpoint phabricator (9dff53b551da421c3f419a482d9b29c386b6b92ef4bece9d1b15fec6948b1081): Error starting userland proxy: listen tcp 0.0.0.0:22: bind: address already in use.
hach-que commented 8 years ago

You're renaming mariadb to mysql in your link argument, so I think it needs to be MYSQL_LINKED_CONTAINER=mysql.

On Fri., 3 Jun. 2016, 3:28 am John Hameier, notifications@github.com wrote:

I've been trying to get phabricator container to run with the mariadb container and It fails with the message (partial output ~ everything up to this point looks good):

[admin@R330SV3069 scripts]# ./phabricator.start.sh Unable to find image 'hachque/phabricator:latest' locally latest: Pulling from hachque/phabricator 7d3401a57fe8: Pull complete 34f658f0bc1a: Pull complete 6ab9be4fc512: Pull complete bfee2df15dde: Pull complete 9ddc1611b88d: Pull complete 87e16d7f95e7: Pull complete 66d1a8b23d48: Pull complete Digest: sha256:7a1c1dee530fa48a7d52b1526c584148b645fd13c3a3613036371c1cd9263a9e Status: Downloaded newer image for hachque/phabricator:latest [ STARTING ] /etc/init.simple/10-boot-conf

  • '[' -f /baked ']'
  • '[' mariadb '!=' '' ']'
  • MYSQL_HOST_VARIABLE=mariadb_PORT_3306_TCP_ADDR
  • MYSQL_HOST=
  • MYSQL_PORT_VARIABLE=mariadb_PORT_3306_TCP_PORT
  • MYSQL_PORT=
  • unset MYSQL_HOST_VARIABLE
  • unset MYSQL_PORT_VARIABLE
  • '[' '' == '' ']'
  • MYSQL_STORAGE_NAMESPACE=phabricator
  • '[' letsencrypt == '' ']'
  • '[' '' == '' ']'
  • PHABRICATOR_STORAGE_TYPE=mysql
  • '[' '' '!=' '' ']'
  • '[' '' '!=' '' ']'
  • '[' '' '!=' '' ']'
  • '[' '' '!=' '' ']'
  • '[' '' '!=' '' ']'
  • '[' '' '!=' '' ']'
  • '[' -f /config/script.pre ']'
  • '[' -f /config/script.premig ']'
  • '[' -f /config/script.post ']'
  • '[' -f /config/script.phd ']'
  • '[' -f /config/script.letsencrypt ']'
  • '[' -f /config/letsencrypt.config ']'
  • '[' -d /config/keycache ']'
  • cat
  • source /config.saved ++ OVERRIDE_PHABRICATOR_URI= ++ OVERRIDE_PHABRICATOR_BRANCH= ++ OVERRIDE_ARCANIST_URI= ++ OVERRIDE_ARCANIST_BRANCH= ++ OVERRIDE_LIBPHUTIL_URI= ++ OVERRIDE_LIBPHUTIL_BRANCH= ++ PHABRICATOR_HOST=phabricator.etg.tgf.tc.faa.gov ++ PHABRICATOR_CDN= ++ PHABRICATOR_REPOSITORY_PATH=/repos ++ PHABRICATOR_STORAGE_TYPE=mysql ++ PHABRICATOR_STORAGE_PATH=/home/phab/phabricator/files ++ PHABRICATOR_STORAGE_BUCKET= ++ PHABRICATOR_HOST_KEYS_PATH=/home/phab/phabricator/keys ++ AWS_S3_ACCESS_KEY= ++ AWS_S3_SECRET_KEY= ++ MYSQL_HOST= ++ MYSQL_PORT= ++ MYSQL_USER=root ++ MYSQL_PASS=linux ++ MYSQL_STORAGE_NAMESPACE=phabricator ++ ENABLE_APCU= ++ ENABLE_UPDATE_ON_START= ++ SSL_TYPE=letsencrypt ++ SSL_CERTIFICATE= ++ SSL_PRIVATE_KEY= ++ SSL_EMAIL= ++ SCRIPT_BEFORE_UPDATE= ++ SCRIPT_BEFORE_MIGRATION= ++ SCRIPT_AFTER_MIGRATION= ++ SCRIPT_AFTER_LETS_ENCRYPT= ++ SCRIPT_BEFORE_DAEMONS= ++ SCRIPT_AFTER_DAEMONS=
  • '[' '' '!=' '' ']'
  • '[' '' == true ']'
  • pushd /srv/phabricator/phabricator /srv/phabricator/phabricator /
  • '[' '' '!=' '' ']'
  • '[' '' '!=' '' ']'
  • '[' root '!=' '' ']'
  • sudo -u git ./bin/config set mysql.user root Set 'mysql.user' in local configuration.
  • '[' linux '!=' '' ']'
  • sudo -u git ./bin/config set mysql.pass linux Set 'mysql.pass' in local configuration.
  • '[' phabricator '!=' '' ']'
  • sudo -u git ./bin/config set storage.default-namespace phabricator Set 'storage.default-namespace' in local configuration.
  • '[' phabricator.etg.tgf.tc.faa.gov '!=' '' ']'
  • '[' letsencrypt == none ']'
  • sudo -u git ./bin/config set phabricator.base-uri https://phabricator.etg.tgf.tc.faa.gov/ Set 'phabricator.base-uri' in local configuration.
  • '[' '' '!=' '' ']'
  • sudo -u git ./bin/config set phd.user git Set 'phd.user' in local configuration.
  • sudo -u git ./bin/config set pygments.enabled true Set 'pygments.enabled' in local configuration.
  • '[' /repos '!=' '' ']'
  • sudo -u git ./bin/config set repository.default-local-path /repos Set 'repository.default-local-path' in local configuration.
  • '[' mysql == mysql ']'
  • sudo -u git ./bin/config set storage.mysql-engine.max-size 67108864 Set 'storage.mysql-engine.max-size' in local configuration.
  • '[' mysql == disk ']'
  • '[' mysql == s3 ']'
  • '[' '' '!=' '' ']'
  • '[' '' '!=' '' ']'
  • '[' letsencrypt == none ']'
  • APHLICT_PROTOCOL=https
  • APHLICT_PORT=443
  • sudo -u git ./bin/config set notification.servers '[{"type": "client","host": "phabricator.etg.tgf.tc.faa.gov","port": 443,"protocol": "https","path": "/ws/"},{"type": "admin","host": "127.0.0.1","port": 22281,"protocol": "http"}]' Set 'notification.servers' in local configuration.
  • unset APHLICT_PROTOCOL
  • unset APHLICT_PORT
  • popd /
  • '[' '' == true ']'
  • '[' '' '!=' '' ']'
  • mysqlcheck --host= --port= --user=root --password=linux --databases phabricator_search mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2 "No such file or directory") when trying to connect
  • true
  • /srv/phabricator/phabricator/bin/storage upgrade --force MySQL Credentials Not Configured

Unable to connect to MySQL using the configured credentials. You must configure standard credentials before you can upgrade storage. Run these commands to set up credentials:

phabricator/ $ ./bin/config set mysql.host host phabricator/ $ ./bin/config set mysql.user username phabricator/ $ ./bin/config set mysql.pass password

These standard credentials are separate from any administrative credentials provided to this command with --user or --password, and must be configured correctly before you can proceed.

Raw MySQL Error: Attempt to connect to root@localhost failed with error

2002: No such file or directory.

[ FAILED ] /etc/init.simple/10-boot-conf

Here is my config file:

docker run -it \ --rm -p 80:80 -p 443:443 \ --env PHABRICATOR_HOST=phabricator.etg.tgf.tc.faa.gov \ --env PHABRICATOR_REPOSITORY_PATH=/repos \ --env PHABRICATOR_STORAGE_TYPE=disk \ --env PHABRICATOR_STORAGE_PATH=/files \ --env PHABRICATOR_HOST_KEYS_PATH=/keys \ --env MYSQL_LINKED_CONTAINER=mariadb \ --env MYSQL_USER=root \ --env MYSQL_PASS=linux \ --link mariadb:mysql \ --env SSL_TYPE=letsencrypt \ -v /home/phab/phabricator/repos:/repos \ -v /home/phab/phabricator/files:/files \ -v /home/phab/phabricator/keys:/keys \ --name phabricator hachque/phabricator

It should be noted that I had to also remove the -p 22:22 as that was causing in issue stating that port 22 was already in use which I'm assuming is being used by mariadb container.

docker: Error response from daemon: driver failed programming external connectivity on endpoint phabricator (9dff53b551da421c3f419a482d9b29c386b6b92ef4bece9d1b15fec6948b1081): Error starting userland proxy: listen tcp 0.0.0.0:22: bind: address already in use.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hach-que-docker/phabricator/issues/29, or mute the thread https://github.com/notifications/unsubscribe/AAez-hfuOE85Lu-U5IZoc74h_otWOxmLks5qHxLWgaJpZM4Isyt0 .

jhameier commented 8 years ago

I've changed MYSQL_LINKED_CONTAINER=mariadb to MYSQL_LINKED_CONTAINER=mysql and still have the identical issue. It appears to be that MYSQL_USER=root & MYSQL_PASS=linux are not being set in to allow phabricator to connect to mariadb causing the failure.

From the Basic Configuration instructions:

docker run ... \
    --env MYSQL_LINKED_CONTAINER=MYSQL \
    --env MYSQL_USER=phabricator \
    --env MYSQL_PASS=password \
    --link somecontainer:mysql \
    ...

And from the hackque/mariadb instructions:

SSH / Login
Username: root
Password: linux

It looks like it fails when commanding the container mysqlcheck. I'm curious if the --host= --port= are supposed to be the internal address and port for the mariadb container.

+ mysqlcheck --host= --port= --user=root --password=linux --databases phabricator_search

causing this error:

mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2 "No such file or directory") when trying to connect
hach-que commented 8 years ago

If there's no text passed to --host, then it indicates that ${MYSQL_LINKED_CONTAINER}_PORT_3306_TCP_ADDR isn't resolving to a variable that contains any text.

Try --link mariadb:mysql --env MYSQL_LINKED_CONTAINER=MYSQL.

gauravarora commented 8 years ago

I had the exact same problem and I fixed it by setting MYSQL_PORT_3306_TCP_ADDR & MYSQL_PORT_3306_TCP_PORT manually for the phabricator service in docker-compose.yml

SalahAdDin commented 8 years ago

I have the same error with docker-compose up.

kocsenc commented 8 years ago

FWIW I was experiencing this after successfully linking a MySQL container and then trying to link it to another one with a different name.

Miggleness commented 8 years ago

@hach-que having both --link mysql:mysql --env MYSQL_LINKED_CONTAINER=MYSQL has gotten me over. the first hump. Is the --link command supposed to be included?

I"m getting the error below now.

+ sudo -u git ./bin/config set storage.default-namespace phabricator
[2016-09-27 00:10:47] EXCEPTION: (AphrontAccessDeniedQueryException) #1044: Access denied for user 'phabricator'@'%' to database 'phabricator_config' at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:319]
arcanist(head=master, ref.master=483e985d08d2), phabricator(head=master, ref.master=38b10f05a224), phutil(head=master, ref.master=1a0371a2247a)
  #0 AphrontBaseMySQLDatabaseConnection::throwCommonException(integer, string) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:334]
Miggleness commented 8 years ago

Same error as OP with docker compose.

mysqlcheck --host= --port= --user=phabricator --password=password --databases phabricator_search mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2 "No such file or directory") when trying to connect

Compose file

version: '2'
services:
  phabricator:
    restart: always
    expose:
     - "443"
     - "80"
     - "22"
    volumes:
     - /srv/docker/phab/repos:/repos
     - /srv/docker/phab/extensions:/srv/phabricator/phabricator/src/extensions
    depends_on:
     - mysql
    links:
     - mysql
    environment:
     - MYSQL_LINKED_CONTAINER=MYSQL
     - MYSQL_USER=phabricator
     - MYSQL_PASS=password
     - PHABRICATOR_REPOSITORY_PATH=/repos
     - PHABRICATOR_HOST=myhost.com
     - VIRTUAL_HOST=myhost.com
    image: hachque/phabricator
  mysql:
    restart: always
    volumes:
     - /srv/docker/phab/mysql:/var/lib/mysql
    image: mysql
    environment:
     - MYSQL_RANDOM_ROOT_PASSWORD=yes
     - MYSQL_USER=phabricator
     - MYSQL_PASSWORD=password
zhongqf commented 8 years ago

The newest docker engine use an embedded dns server for link container ( instead of using old environment variable definitions ). So using

environment:
    - MYSQL_HOST=mysql
    - MYSQL_PORT=3306

directly will fix this problem. ( confirmed by myself)

majuansari commented 7 years ago

.

hach-que commented 7 years ago

This should be fixed by using MYSQL_HOST instead of MYSQL_LINKED_CONTAINER. I don't believe there's any further action required on this issue.