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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server from dockerfile do not work #427

Closed
oxedions opened this issue Nov 15, 2020 · 14 comments
Closed

Server from dockerfile do not work #427

oxedions opened this issue Nov 15, 2020 · 14 comments
Assignees
Labels
Fixed Issues that after being labeled as Bug have been resolved

Comments

@oxedions
Copy link

oxedions commented Nov 15, 2020

Hi,

First thanks a lot for this project 馃檪

I am trying to start my own server, but I fail. Not sure if this is a bug, or if I just don't do it the right way.
I tried to follow the main README, that says to just reach main page.

Describe the bug
I used the provided Dockerfile to spawn a server. But, when trying to use it, it seems to fail.
Container building is ok, container launch is ok, apache2 is running inside, and server is answering requests. However, if I browse http://localhost/src/upload/public/, which I assume to be the correct place to test, I have this:

 XG Proyect Logo

500. That鈥檚 an error.

The requested URL throw an error. Contact the game Administrator. That鈥檚 all we know. 

So I tried other path (public/install, admin, etc), I always see this error. Is there anything to initialize first, or is this really a bug ?

To Reproduce

podman build --tag php:7.3-apache-xg -f ./Dockerfile
podman run -d --net=host --name xg php:7.3-apache-xg
podman start xg

Ensure firewall allows 80/tcp if not using localhost browser.

Then try http://localhost/src/upload/public/ url.

Expected behavior
I should see, for what I understand from the README, something to follow a setup procedure.

Screenshots
image

Desktop (please complete the following information):

  • OS: Centos 8.2 VM, hosting the podman (docker) container. Hypervisor is HyperV on Windows 10 x64.
  • Browser : Firefox
  • Version : 82.0.2

Server (please complete the following information):

  • PHP Version: Dockerfile provided
  • MySQL Version: Dockerfile provided
@oxedions
Copy link
Author

oxedions commented Nov 16, 2020

Few comments more.

Test 1

I tried using an ubuntu 20.04, with PHP 7.4 and Mysql 8.0.22 (and Mysqli for PHP).
Copied all files under /var/www/html, even the .htaccess, and ensured rewrite module is on on apache2.

When I navigate to http://localhost/, I just see the directory.
I tried to go into public/install. I then see this:

image

I tried "Install" Tab, but no way to get the database connection working.

image

On host side, I see mysql is running. Also tried to login as root with the password, it works.
php shows mysqli extention is enabled.

Apache2 logs shows nothing relevant:

127.0.0.1 - - [16/Nov/2020:11:17:43 +0100] "GET /public/install/ HTTP/1.1" 200 1774 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
127.0.0.1 - - [16/Nov/2020:11:17:45 +0100] "GET /public/install/index.php?page=installation&mode=step1 HTTP/1.1" 200 1494 "http://localhost/public/install/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
127.0.0.1 - - [16/Nov/2020:11:17:55 +0100] "POST /public/install/index.php?page=installation&mode=step1 HTTP/1.1" 200 1585 "http://localhost/public/install/index.php?page=installation&mode=step1" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"

Test 2

Using docker compose.
I tried the provided docker compose file.

root@xg:~/XG# docker-compose up
Starting xg_db_1         ... done
Starting xg_phpmyadmin_1 ... done
Starting xgproyect-v3    ... done
Attaching to xg_phpmyadmin_1, xg_db_1, xgproyect-v3
phpmyadmin_1    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
phpmyadmin_1    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
phpmyadmin_1    | [Mon Nov 16 10:14:36.945372 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.11 configured -- resuming normal operations
phpmyadmin_1    | [Mon Nov 16 10:14:36.945404 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
db_1            | 2020-11-16 10:14:36+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.32-1debian10 started.
db_1            | 2020-11-16 10:14:36+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1            | 2020-11-16 10:14:36+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.32-1debian10 started.
db_1            | 2020-11-16T10:14:37.065616Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1            | 2020-11-16T10:14:37.066373Z 0 [Note] mysqld (mysqld 5.7.32) starting as process 1 ...
db_1            | 2020-11-16T10:14:37.068115Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1            | 2020-11-16T10:14:37.068130Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1            | 2020-11-16T10:14:37.068132Z 0 [Note] InnoDB: Uses event mutexes
db_1            | 2020-11-16T10:14:37.068134Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1            | 2020-11-16T10:14:37.068135Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1            | 2020-11-16T10:14:37.068137Z 0 [Note] InnoDB: Using Linux native AIO
db_1            | 2020-11-16T10:14:37.068377Z 0 [Note] InnoDB: Number of pools: 1
db_1            | 2020-11-16T10:14:37.068486Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1            | 2020-11-16T10:14:37.069364Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1            | 2020-11-16T10:14:37.073428Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1            | 2020-11-16T10:14:37.074754Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1            | 2020-11-16T10:14:37.085988Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1            | 2020-11-16T10:14:37.094027Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1            | 2020-11-16T10:14:37.094064Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1            | 2020-11-16T10:14:37.113234Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1            | 2020-11-16T10:14:37.113621Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1            | 2020-11-16T10:14:37.113629Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1            | 2020-11-16T10:14:37.113784Z 0 [Note] InnoDB: Waiting for purge to start
db_1            | 2020-11-16T10:14:37.164115Z 0 [Note] InnoDB: 5.7.32 started; log sequence number 12605057
db_1            | 2020-11-16T10:14:37.164651Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1            | 2020-11-16T10:14:37.167768Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
db_1            | 2020-11-16T10:14:37.167891Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
db_1            | 2020-11-16T10:14:37.168792Z 0 [Warning] CA certificate ca.pem is self signed.
db_1            | 2020-11-16T10:14:37.168870Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
db_1            | 2020-11-16T10:14:37.169249Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1            | 2020-11-16T10:14:37.169415Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1            | 2020-11-16T10:14:37.170347Z 0 [Note] IPv6 is available.
db_1            | 2020-11-16T10:14:37.170375Z 0 [Note]   - '::' resolves to '::';
db_1            | 2020-11-16T10:14:37.170656Z 0 [Note] Server socket created on IP: '::'.
db_1            | 2020-11-16T10:14:37.176002Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
xgproyect-v3    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
db_1            | 2020-11-16T10:14:37.195511Z 0 [Note] Event Scheduler: Loaded 0 events
db_1            | 2020-11-16T10:14:37.195929Z 0 [Note] mysqld: ready for connections.
db_1            | Version: '5.7.32'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
db_1            | 2020-11-16T10:14:37.196420Z 0 [Note] InnoDB: Buffer pool(s) load completed at 201116 10:14:37
xgproyect-v3    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
xgproyect-v3    | [Mon Nov 16 10:14:37.249058 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.3.24 configured -- resuming normal operations
xgproyect-v3    | [Mon Nov 16 10:14:37.249603 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

But when I try to reach localhost, I have this:

image

And on the log sides, in the shell:
xgproyect-v3 | 172.18.0.1 - - [16/Nov/2020:10:15:47 +0000] "GET / HTTP/1.1" 200 572 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"

So I did an docker exec -ti 8595a952dcc4 /bin/bash, then an chmod -R 777 on application/config, I then see the main screen, but have same issue than before: Unable to connect to database.

I used 127.0.0.1:33060, and root for password.

Nothing more.

Any idea ?

@duhow
Copy link
Contributor

duhow commented Nov 16, 2020

@oxedions path to be set in DocumentRoot is src/upload, not src/upload/public .
Also can you provide the commit or branch you're using?

@duhow
Copy link
Contributor

duhow commented Nov 16, 2020

鈿狅笍 Found the issue.
Dockerfile copies the entire content from the build path - which contains src/upload/* - to /var/www/html
Docker compose mounts volume src/upload directly to /var/www/html, so the path differs.

@duhow
Copy link
Contributor

duhow commented Nov 16, 2020

Also permission denied is because container uses user www-data (id 33) which probably does not own the mounted volume data.
A dirty chmod 777 fixes the issue, but this should not be the fix.

@oxedions
Copy link
Author

oxedions commented Nov 16, 2020

Dear @duhow

Thanks a lot for this reply.

I am using XGP v3.1.0 release (I took the zip provided).

Regarding test 1, bare metal test on ubuntu 20.04, when I copy the whole upload dir into /var/www/html, since I only see directories into my browser, it probably means that the .htaccess is baldy used by my apache2. I must be missing something.

Regarding test 2, using docker compose, I still do not understand why I just cannot connect to database 馃檨 No way to connect to it using the web installer. By default, with the composer, it should be localhost:33060, am I right ? I have no firewall running. My apache2 container is reachable at localhost:80 and this part works.

@duhow
Copy link
Contributor

duhow commented Nov 16, 2020

For docker-compose database access, you have to specify the Database container, not the apache host (localhost).
So by default details should be:

  • Host: db
  • Database: xgp
  • User: root
  • Password: root

@oxedions
Copy link
Author

Thanks a lot ! 馃槉

Much better, it works with these stetting.

Then 2 small questions more:

  1. Is there a documentation for all of that somewhere ? I tried to look everywhere, but did not found anything.
  2. How do you create the first universe ? Then first user ? I checked in the admin interface (admin.php) but found nothing related to create a universe.

@duhow
Copy link
Contributor

duhow commented Nov 16, 2020

Afaik there's no documentation on Docker setup, sorry.

Regarding universes, XGProyect at the moment uses a single universe. The UI shows a selector of multiple universes, but only will use one - the same installation.
First admin user is created during install / setup.

@oxedions
Copy link
Author

oxedions commented Nov 16, 2020

Thank you for this answer 馃檪

If I succeed using all of this, I think it worth I propose a small PR if you accept it to document the process.

Regarding second question, how to generate the single universe ? I see none in the users login/register UI :

image

So I created a user, in the admin UI, but this user just cannot login as it is impossible to select any universe. I tried by using this empty named universe, but no login occur, I just go back to this same login page.

@LucasKovacs
Copy link
Member

@oxedions 3.2 fixes that problem. But we haven't built the multi-universe feature yet :) So for the moment it's always going to default to Universe 1. XGP 3.2 will be released on November 28th

@oxedions
Copy link
Author

oxedions commented Nov 16, 2020

Dear @LucasKovacs
Thanks a lot for this reply.

Well, I do not really need multi universe, I can spawn instances to compensate that 馃槉
So only one universe is ok.

Until 3.2 is out, if I use master branch to start the server, will I benefit from the fix that allows a single universe ? Or do I need to use a specific dev branch (development branch) ?
I do not need to put a server into production right now, just start learning how XG works. :-)

@BeReal86
Copy link
Member

Hello @oxedions ,

I recommend using development branch instead of master branch. But, you can use development branch. But remember, it is not the published version.

@LucasKovacs
Copy link
Member

@oxedions

  • development branch is currently at 3.2.
  • Master is currently at 3.1.
  • We only move to master when we are sure that development is stable.

You can, of course, work directly with master and wait for stable releases.

@LucasKovacs LucasKovacs added the Fixed Issues that after being labeled as Bug have been resolved label Nov 17, 2020
@oxedions
Copy link
Author

I will test 3.2 then.

Thanks a lot to everyone for the help 馃檪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Issues that after being labeled as Bug have been resolved
Projects
None yet
Development

No branches or pull requests

4 participants