Setting up Contao through Terminal

by winnie

Progress today was slow but it was ultimately worth it. Lost this the original post when i was almost finished so this will be very brief:

How I did it:

  • Connect with SSH
  • Create with mkdir and navigate to a new directory
  • Run these commands to install Composer
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"php composer-setup.phpphp -r "unlink('composer-setup.php');"
  • Composer is now installed in the project directory
  • Now to install the Contao Managed Edition (but without Contao Manager). Have to run the command but with a different PHP (This is usually not necessary, but this hosting is running an out of date PHP Version). Instead of php it will be /usr/bin/php81
    • /usr/bin/php81 composer.phar create-project contao/managed-edition <directory> <version>
  • At this point we need to migrate data into a new database an make sure its up to date
  • paraters.yml needs to be in config/ containing the data to connect to the DB. So i create that file and edit it with nano and fill in the details.
  • Will need to delete and build the cache with these two commands:
    • /usr/bin/php81 vendor/bin/contao-console cache:clear --no-warmup
    • /usr/bin/php81 vendor/bin/contao-console cache:warmup
  • After that, the migration will work using
    • /usr/bin/php81 vendor/bin/contao-console contao:migrate
  • DB is now up to date but is still missing a Backend user. Create user with:
    • /usr/bin/php81 vendor/bin/contao-console contao:user:create
  • Now, Contao does not come with any basic page setup so we do need to install the demo. This is usually done via Contao-Manager but its essentially just GUI for composer. So lets grab the package:
    • /usr/bin/php81 composer.phar require contao/official-demo
  • It will install the necessary packeges and dependencies. Rebuild the Cache again and then import the template via the install Tool (domain.com/contao/install)
  • At this point im a bit disappointed, because until now there was no need for the installtool to be run at all. I think this step cannot be properly done from the terminal. Also, the Contao Demo overwrites the Adminuser created earlier and we gotta use the demouser. Good enough for me.

So, was it worth it?

For gaining experience and confidence in how to use the Terminal. YES, definately.

Will I be using the method in the future? NO. The Contao-Manager was made for a reason and i can see that now. Even if youre really proefficient executing all these commands you probably still lose time. Good news is that i can install the Manager retroactively and then continue the project from there.

 

Ah yeah, and that message gave me a little scare. Guess thats a rite of passage...

 

 

 

Go back