Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Shlink database build issue #1154

Closed
designsroman opened this issue Aug 15, 2021 · 13 comments
Closed

Shlink database build issue #1154

designsroman opened this issue Aug 15, 2021 · 13 comments
Labels

Comments

@designsroman
Copy link

Hi there,
I'm working to get shlink setup on my vps with cpanel. I initially tried just the SQLite option, but after that wouldn't work I tried creating a mySQL db and installing there.. I've unzipped the latest self-hosted folders into the root directory of a domain I added into my VPS server via cpanel (an addon domain method). I have used the CLI commands (sometimes when using -vvv I get php memory exhausted errors which I addressed by boosting the limit to 1024M for now)..

It seems there is some issue with creating the tables in the new database.. I enabled write access to the data directory using File Manager User & Group : Write permissions... Is there another way I need to recursively enable that write access? Is there something else going on that is blocking the bin/install or bin/update (I've attempted both) from properly building the DB? I've also tried the migrate route, nothing seems to resolve this..

Very grateful for your wisdom on this, and thank you for your brilliant work in creating this utility!


Custom configuration properly generated!

Initializing database... [Running "/opt/cpanel/ea-php80/root/usr/bin/php bin/cli db:create"] RUN '/opt/cpanel/ea-php80/root/usr/bin/php' 'bin/cli' 'db:create'
OUT
OUT [OK] Database already exists. Run "db:migrate" command to make sure it is up to
OUT date.
OUT
OUT
RES Command ran successfully
Success!
Updating database... [Running "/opt/cpanel/ea-php80/root/usr/bin/php bin/cli db:migrate"] RUN '/opt/cpanel/ea-php80/root/usr/bin/php' 'bin/cli' 'db:migrate'
OUT Migrating database...
OUT
ERR
ERR In Process.php line 270:
ERR
ERR The command "'/opt/cpanel/ea-php80/root/usr/bin/php' 'vendor/doctrine/migra
ERR tions/bin/doctrine-migrations.php' 'migrations:migrate' '--no-interaction'"
ERR failed.
ERR
ERR Exit Code: 10(Unknown error)
ERR
ERR Working directory: /home//*******
ERR
ERR Output:
ERR ================
ERR
ERR
ERR Error Output:
ERR ================
ERR
ERR In SchemaException.php line 34:
ERR
ERR There is no table with name '*********.short_urls' in the schema.
ERR
ERR
ERR migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--
ERR allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CO
ERR NFIGURATION] [--em EM] [--conn CONN] [--] []
ERR
ERR
ERR db:migrate
ERR
ERR
RES 1 Command did not run successfully

@acelaya
Copy link
Member

acelaya commented Aug 15, 2021

It's hard to tell why is it failing, as systems like cPanel mess with the system at their will.

I would try searching what that MySQL error code means "Exit Code: 10".

@designsroman
Copy link
Author

Oh OK. It says 10 is "Error allocating memory".

@designsroman
Copy link
Author

I also noticed in the error log file [07:07:26 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 35346191 bytes) in /home//****/vendor/shlinkio/shlink-ip-geolocation/src/GeoLite2/DbUpdater.php on line 68

@designsroman
Copy link
Author

Is there something I need to do for the GeoLite DB other than adding my license key?

@acelaya
Copy link
Member

acelaya commented Aug 15, 2021

What Shlink version are you using?

@designsroman
Copy link
Author

I'm using V.2.8.0

At the moment my mySQL db only has a "migrations" table.

@acelaya
Copy link
Member

acelaya commented Aug 15, 2021

Try increasing the reserved memory for PHP and MySQL

@designsroman
Copy link
Author

I've increased php mem limit to 1024M.
I'll look into the MySQL limits..

@designsroman
Copy link
Author

designsroman commented Aug 15, 2021

Retried it and it still throws the error

Custom configuration properly generated!

Updating database... [Running "/opt/cpanel/ea-php80/root/usr/bin/php bin/cli db:migrate"] RUN '/opt/cpanel/ea-php80/root/usr/bin/php' 'bin/cli' 'db:migrate'
OUT Migrating database...
OUT
ERR
ERR In Process.php line 270:
ERR
ERR The command "'/opt/cpanel/ea-php80/root/usr/bin/php' 'vendor/doctrine/migra
ERR tions/bin/doctrine-migrations.php' 'migrations:migrate' '--no-interaction'"
ERR failed.
ERR
ERR Exit Code: 10(Unknown error)
ERR
ERR Working directory: /home//***
ERR
ERR Output:
ERR ================
ERR
ERR
ERR Error Output:
ERR ================
ERR
ERR In SchemaException.php line 34:
ERR
ERR There is no table with name '**_****.short_urls' in the schema.
ERR
ERR
ERR migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--
ERR allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CO
ERR NFIGURATION] [--em EM] [--conn CONN] [--] []
ERR
ERR
ERR db:migrate
ERR
ERR

@designsroman
Copy link
Author

Hi,
I wonder if it's related to a configuration issue? I noticed on one of your guides you mentioned doing this with Apache.. But I'm not sure if I should change the "VirtualHost :80" to my VPS' IP and another port or keep that value as-is?
<VirtualHost :80>
ServerName ******
DocumentRoot "/home/**/
**/public";

<Directory "/home/**/****/public">
    Options FollowSymLinks Includes ExecCGI
    AllowOverride all
    Order allow,deny
    Allow from all
</Directory>

@designsroman
Copy link
Author

We retried after updating the memory limits and got:

[15-Aug-2021 07:36:57 UTC] PHP Fatal error: Uncaught TypeError: Shlinkio\Shlink\Installer\Config\Option\Database\DatabaseUserConfigOption::askRequired(): Return value must be of type string, null returned in /home//****/vendor/shlinkio/shlink-installer/src/Util/AskUtilsTrait.php:20
Stack trace:
#0 /home/
//vendor/shlinkio/shlink-installer/src/Config/Option/Database/DatabaseUserConfigOption.php(22): Shlinkio\Shlink\Installer\Config\Option\Database\DatabaseUserConfigOption->askRequired(Object(Symfony\Component\Console\Style\SymfonyStyle), 'username', 'Database userna...')
#1 /home/**/
/vendor/shlinkio/shlink-installer/src/Config/ConfigGenerator.php(51): Shlinkio\Shlink\Installer\Config\Option\Database\DatabaseUserConfigOption->ask(Object(Symfony\Component\Console\Style\SymfonyStyle), Object(Shlinkio\Shlink\Config\Collection\PathCollection))
#2 /home//****/vendor/shlinkio/shlink-installer/src/Command/AbstractInstallCommand.php(48): Shlinkio\Shlink\Installer\Config\ConfigGenerator->generateConfigInteractively(Object(Symfony\Component\Console\Style\SymfonyStyle), Array)
#3 /home/
//vendor/symfony/console/Command/Command.php(299): Shlinkio\Shlink\Installer\Command\AbstractInstallCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /home/**/
/vendor/symfony/console/Application.php(978): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /home//****/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Application->doRunCommand(Object(Shlinkio\Shlink\Installer\Command\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /home/
//vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /home/**/
/vendor/shlinkio/shlink-installer/bin/run.php(12): Symfony\Component\Console\Application->run()
#8 /home//****/vendor/shlinkio/shlink-installer/bin/run.php(15): Shlinkio\Shlink\Installer{closure}('install')
#9 /home/
//bin/install(12): Shlinkio\Shlink\Installer{closure}()
#10 {main}
thrown in /home/**/
/vendor/shlinkio/shlink-installer/src/Util/AskUtilsTrait.php on line 20

@designsroman
Copy link
Author

Tried running db:migrate after db:create said the db already exists and to run the migrate command with -vvv on... and got:


bin/cli db:migrate -vvv
Migrating database...
RUN '/opt/cpanel/ea-php80/root/usr/bin/php' 'vendor/doctrine/migrations/bin/doctrine-migrations.php' 'migrations:migrate' '--no-interaction'
ERR
ERR In SchemaException.php line 34:
ERR
ERR There is no table with name '/.short_urls' in the schema.
ERR
ERR
ERR migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] []
ERR
ERR
In Process.php line 270:

[Symfony\Component\Process\Exception\ProcessFailedException]
The command "'/opt/cpanel/ea-php80/root/usr/bin/php' 'vendor/doctrine/migrations/bin/doctrine-migrations.php' 'migrations:migrate' '--no-interactio
n'" failed.

Exit Code: 10(Unknown error)

Working directory: /home//

Output:

Error Output:

In SchemaException.php line 34:

There is no table with name '**/**.short_urls' in the schema.

migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration
CONFIGURATION] [--em EM] [--conn CONN] [--] []

Exception trace:
at /home///vendor/symfony/process/Process.php:270
Symfony\Component\Process\Process->mustRun() at /home///module/CLI/src/Util/ProcessRunner.php:48
Shlinkio\Shlink\CLI\Util\ProcessRunner->run() at /home///module/CLI/src/Command/Db/AbstractDatabaseCommand.php:30
Shlinkio\Shlink\CLI\Command\Db\AbstractDatabaseCommand->runPhpCommand() at /home///module/CLI/src/Command/Db/MigrateDatabaseCommand.php:30
Shlinkio\Shlink\CLI\Command\Db\MigrateDatabaseCommand->lockedExecute() at /home///module/CLI/src/Command/Util/AbstractLockedCommand.php:35
Shlinkio\Shlink\CLI\Command\Util\AbstractLockedCommand->execute() at /home///vendor/symfony/console/Command/Command.php:299
Symfony\Component\Console\Command\Command->run() at /home///vendor/symfony/console/Application.php:978
Symfony\Component\Console\Application->doRunCommand() at /home///vendor/symfony/console/Application.php:295
Symfony\Component\Console\Application->doRun() at /home///vendor/symfony/console/Application.php:167
Symfony\Component\Console\Application->run() at /home///bin/cli:10

db:migrate

@designsroman
Copy link
Author

Do I add the virtual host code to the public or root htaccess file?

@shlinkio shlinkio locked and limited conversation to collaborators Sep 11, 2021
@acelaya acelaya closed this as completed Sep 11, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

2 participants