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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Themes missing when running composer create-project #1969

Closed
antiftw opened this issue Oct 8, 2020 · 12 comments · Fixed by #2083
Closed

Themes missing when running composer create-project #1969

antiftw opened this issue Oct 8, 2020 · 12 comments · Fixed by #2083

Comments

@antiftw
Copy link

antiftw commented Oct 8, 2020

Wanted to try a fresh install of the newest BoltCMS, and the themes directory is missing

Details

Question Answer
Relevant Bolt Version master
Install type Composer install
BC Break ?
PHP version 7.4.3
Web server Apache, version [ 2.4.41 (Ubuntu) ]
For UX/UI issues Firefox 81.0 (64-bit) Ubuntu

Reproduction

Bug summary

I wanted to install BoltCMS on my development machine to try and setup a fresh install. I am following the exact steps mentioned at https://docs.bolt.cm/4.0/installation/installation, but after finishing those steps, the browser gives me an error that:

public/theme/base-2021" directory does not exist

When looking in the public directory, the entire theme directory is missing.

Specifics

URL: localhost/index.php
VERSION: 4.0 (I think, just the one that installs using composer create-project bolt/project on 08 Oktober 2020)
METHOD: Composer install
BROWSER: Firefox 81.0 (64-bit) Ubuntu
CHECKED OTHERS: YES
ERROR MESSAGE: The "/var/www/antiftw/public/theme/base-2021" directory does not exist ("/var/www/antiftw/public/theme/base-2021").

Steps to reproduce

  • cd /var/www/
  • sudo mkdir antiftw
  • sudo chown antiftw:www-data antiftw/
  • composer create-project bolt/project antiftw/
  • cd antiftw/
  • change database credentials
  • bin/console bolt:setup
  • fill in details
  • say yes to fixtures
  • check in browser

Expected result

Expected to see bolt site filled with dummy data

Actual result

Get error The "/var/www/antiftw/public/theme/base-2021" directory does not exist ("/var/www/antiftw/public/theme/base-2021"). See screenshot
Screenshot_2020-10-08_bolt_error

@bobdenotter
Copy link
Member

For me it works as expected? What's the full output of composer create-project bolt/project antiftw/?

It ought to end with this, if no errors occured:

 Bolt version: 4.1.0

 * Install type: Composer install
 * Database: sqlite 3.31.1 - Tables not initialised (with JSON)
 * PHP version: 7.2.30
 * Symfony version: v5.1.7
 * Operating System: Darwin - 19.6.0


> php bin/post-create-project.php
> php bin/console bolt:copy-themes

 Installing Bolt themes as hard copies.

 --- ----------- ----------------
      Theme       Method / Error
 --- ----------- ----------------
  ✔   base-2021   copied
  ✔   base-2018   copied
  ✔   skeleton    copied
 --- ----------- ----------------

 [OK] All themes were successfully installed.

@antiftw
Copy link
Author

antiftw commented Oct 8, 2020

First of all I would like to say your response time is admirable, if only more people in the industry were this fast, the worlds problems would be solved in a heartbeat.

But about the problem: Ok, that points me in the right direction, since I did get some errors at the end of the composer create-project. I assumed these occurred because of the missing configuration of the database, because Symfony can complain about that if you are not using the expected database settings.

The error given is:

In AbstractSQLiteDriver.php line 73:
An exception occurred in driver: could not find driver
In PDOConnection.php line 31:
could not find driver
In PDOConnection.php line 27:
could not find driver

But then the error is most likely not with Bolt, but with something not going as expected with my update to Ubuntu 20.04. I will try if I can figure out why this error is occurring, since I thought I had installed all required packages.

Kind regards and thanks again for the quick response.

@antiftw
Copy link
Author

antiftw commented Oct 8, 2020

Well I'm at a loss, I thought maybe I forgot installing something like php7.4-mysql, but I have tried about everything and I keep getting the same error. Even tried installing sqlite, which I usually never do, but that also didn't solve the problem.

To try something, I installed the Symfony skeleton, which installs and works without errors.

The strange thing is, that after the create-project, when I run the bin/console bolt:setup, it does create a database and tables without any problems, so why it would complain about the database driver seems really weird to me.

Ill try tomorrow with a fresh perspective, because for tonight it's just not going to happen anymore.

@bobdenotter
Copy link
Member

Hi, @antiftw

It's strange, because during that initial setup, it shouldn't do anything with any database. Over the weekend i'm also going to try and see if i can reproduce this behaviour!

@antiftw
Copy link
Author

antiftw commented Oct 9, 2020

Hi @bobdenotter,

Ok, that is indeed strange then. I will keep looking into it today from my end.

Keep in mind that I just formatted my Ubuntu partition and installed a fresh Ubuntu 20.04 and LAMP stack using the distributions own repositories. Since this version of Ubuntu is rather new, I suspect the problem to originate in that area.

Maybe helpful, some more context about where the error occurred, the last part of the composer create-project output:

php bin/console extensions:configure --with-config
php bin/console bolt:info

⚙️ Bolt

Bolt version: 4.1.0

In AbstractSQLiteDriver.php line 73:
An exception occurred in driver: could not find driver
In PDOConnection.php line 31:
could not find driver
In PDOConnection.php line 27:
could not find driver

So it seems it doesn't even reach the part of sqlite which you mention above.

@antiftw
Copy link
Author

antiftw commented Oct 9, 2020

Found it, took me a few hours but I got it!

It was infact the consquence of not having SQLite installed on my system, which appears to be required for the successful execution of the composer create-project bolt/project antiftw/ command.

Using the knowledge of my previous post, I looked into the InfoCommand, since that is where the output stops.

After some debugging I have traced the exception to:

vendor/bolt/core/src/Command/InfoCommand.php:57 => $platform = $this->doctrineVersion->getPlatform();
->
vendor/bolt/core/src/Doctrine/Version.php:33 = $wrapped => $this->connection->getWrappedConnection();
->
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1473 => $this->connect();
->
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:362 => $this->_conn = $this->_driver->connect($this->params, $user, $password, $driverOptions);
->
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php:39 => $pdo = new PDOConnection(...)
->
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27 => parent::__construct($dsn, (string) $user, (string) $password, (array) $options);

Which results in the throwing of the exception on line 46 of that PDOSqlite/Driver.php:
throw DBALException::driverException($this, $ex);

So there is in fact some database action going on during the composer create-project, since it calls the InfoCommand. But since it leads to the Doctrine code, it is not something specific to the Bolt CMS.

However, because I noticed I landed in PDOSqlite, since this was another fresh install, I tried changing the .env to use MySQL again, and now the ./bin/console bolt:info command does give the expected output:

⚙️ Bolt

Bolt version: 4.1.0

  • Install type: Composer install
  • Database: mysql 8.0.21-0ubuntu0.20.04.4 - Localhost via UNIX socket (with JSON)
  • PHP version: 7.4.3
  • Symfony version: v5.1.7
  • Operating System: Linux - 5.4.0-48-generic

So knowing this, I installed all the SQLite packages: libsqlite0, sqlite3, sqlite and php7.4-sqlite and after changing the settings to use SQLite again in the .env file, by uncommenting:

DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/bolt.sqlite

Now it also gives the expected output:

⚙️ Bolt

Bolt version: 4.1.0

  • Install type: Composer install
  • Database: sqlite 3.31.1 - Tables not initialised (with JSON)
  • PHP version: 7.4.3
  • Symfony version: v5.1.7
  • Operating System: Linux - 5.4.0-48-generic

Finally I tried removing the entire antiftw/ folder containing the bolt/project, and running the command again:

composer create-project bolt/project antiftw/

which now results in the same output that you posted, succesfully installing the themes:

.
.
.
✔ base-2021 copied
✔ base-2018 copied
✔ skeleton copied


[OK] All themes were successfully installed.

So no need for you to try and reproduce it in the weekend, although it might be a good idea to change some of the installing procedure ;)

@bobdenotter
Copy link
Member

So there is in fact some database action going on during the composer create-project, since it calls the InfoCommand. But since it leads to the Doctrine code, it is not something specific to the Bolt CMS.

Good find!

I'll see if we can work around that, so that it won't fail (and stop progress)!

@antiftw
Copy link
Author

antiftw commented Oct 9, 2020

Thanks, and yes the solution shouldn't be too difficult, catch the exception and don't display the version of the database but instead show some other logical output.

Since there is no real "recommended" database it might be smartest to say that there is no database installed currently, or use a different way of displaying the information when running the create-project command.

But indeed most important is that it shouldn't halt progress of the installer :)

@mattiaslundback
Copy link

Can confirm the error. Got the same problem. Is delete and reinstall the best solution?

@bobdenotter
Copy link
Member

That's not necessary. for now, just run this:

bin/console bolt:copy-assets
bin/console extensions:configure

We're working on fixing so SQLite is no longer required during installation.

@mattiaslundback
Copy link

That's not necessary. for now, just run this:

bin/console bolt:copy-assets
bin/console extensions:configure

We're working on fixing so SQLite is no longer required during installation.

Thanks!

@andysh-uk
Copy link
Contributor

Thanks @bobdenotter, I've had this on 2 new Bolt sites I've created recently, and thought it was just me. On my first site, I'd created it on a system that had SQLite installed so hadn't noticed the error before; I'd just copied the base-2021 theme in from my first site for the second site.

I've tried your steps for my third site today, but found I also had to do:

bin/console bolt:copy-themes

to get the themes there, but all working happily now 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants