scysys / AzuraCast-Ubuntu

Effortless AzuraCast Setup on Ubuntu LTS with Classic Installer Approach
GNU General Public License v3.0
5 stars 6 forks source link

azuracast won't restore backup on installation using script #15

Closed DocTator2281 closed 1 year ago

DocTator2281 commented 1 year ago

Not sure if this is going to be in your ballpark or not, but figured you might want to know about it anyway:

I have two installations of AzuraCast running locally, one using your installer script, and one using the normal docker method. When I try to restore a backup on the installation using your script, it dies. See below:

root@azuraautomate:/home/doc# /var/azuracast/www/bin/console azuracast:restore /home/doc/automatic_backup_20230708_054046.tgz 

AzuraCast Restore
=================

Please wait while the backup is restored...

Extracting backup file...
-------------------------

tmp/azuracast_backup_mariadb/db.sql

Importing database...
---------------------

Running standard updates...
---------------------------

AzuraCast Setup
===============

Welcome to AzuraCast. Please wait while some key dependencies of AzuraCast are set up...

Initialize AzuraCast
====================

Initializing essential settings...
 * Environment: Production
 * Installation Method: Ansible

Running Database Migrations
---------------------------

Database Migrations
===================

 [OK] Database is already up to date!                                                                                   

Generating Database Proxy Classes
---------------------------------

 Processing entity "App\Entity\Settings"
 Processing entity "App\Entity\SongHistory"
 Processing entity "App\Entity\StorageLocation"
 Processing entity "App\Entity\StationMedia"
 Processing entity "App\Entity\StationPlaylistMedia"
 Processing entity "App\Entity\StationSchedule"
 Processing entity "App\Entity\UnprocessableMedia"
 Processing entity "App\Entity\Analytics"
 Processing entity "App\Entity\AuditLog"
 Processing entity "App\Entity\PodcastCategory"
 Processing entity "App\Entity\StationQueue"
 Processing entity "App\Entity\StationWebhook"
 Processing entity "App\Entity\Role"
 Processing entity "App\Entity\Listener"
 Processing entity "App\Entity\Station"
 Processing entity "App\Entity\StationHlsStream"
 Processing entity "App\Entity\StationPlaylistFolder"
 Processing entity "App\Entity\RolePermission"
 Processing entity "App\Entity\UserLoginToken"
 Processing entity "App\Entity\StationRemote"
 Processing entity "App\Entity\User"
 Processing entity "App\Entity\StationMediaCustomField"
 Processing entity "App\Entity\Relay"
 Processing entity "App\Entity\SftpUser"
 Processing entity "App\Entity\PodcastEpisode"
 Processing entity "App\Entity\StationRequest"
 Processing entity "App\Entity\StationPlaylist"
 Processing entity "App\Entity\StationStreamer"
 Processing entity "App\Entity\Podcast"
 Processing entity "App\Entity\CustomField"
 Processing entity "App\Entity\ApiKey"
 Processing entity "App\Entity\PodcastMedia"
 Processing entity "App\Entity\StationMount"
 Processing entity "App\Entity\StationStreamerBroadcast"

 Proxy classes generated to "/var/azuracast/www_tmp/proxies"

Reload System Data
------------------

[2023-07-10T01:27:03.871323+00:00] AzuraCast.ERROR: Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'nowplaying' in 'field list' (uncaught exception) at /var/azuracast/www/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 67 while running console command `azuracast:restore` {"exception":"[object] (Doctrine\\DBAL\\Exception\\InvalidFieldNameException(code: 1054): An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'nowplaying' in 'field list' at /var/azuracast/www/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:67)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1054): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'nowplaying' in 'field list' at /var/azuracast/www/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'nowplaying' in 'field list' at /var/azuracast/www/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:31)"} []
[2023-07-10T01:27:03.872080+00:00] AzuraCast.WARNING: Console command `azuracast:restore` exited with error code 1054. [] []

In ExceptionConverter.php line 67:

  An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'nowplaying' in 'field list'  

In Exception.php line 28:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'nowplaying' in 'field list'  

In Connection.php line 31:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'nowplaying' in 'field list'  

azuracast:restore [--restore] [--release] [--] [<path>]

The one I restored with the docker installation worked fine. This is a restore without media, and is a known good backup.

scysys commented 1 year ago

Not sure if this is going to be in your ballpark or not, but figured you might want to know about it anyway:

I haven't changed anything on AzuraCast itself. So backup and restore should work as expected. Are you sure you tried to import a backup of the same version? If you want to import a backup from another version, that's something you should never do. But we can try it if you want.


I also tried it here with this 0.17.6 version, and I had no errors.

root@dev:/home/ubuntu# /var/azuracast/www/bin/console azuracast:backup /root/lala.zip

AzuraCast Backup
================

Please wait while a backup is generated...

Creating temporary directories...
---------------------------------

Backing up MariaDB...
---------------------

Creating backup archive...
--------------------------

  adding: tmp/azuracast_backup_mariadb/db.sql (deflated 88%)

Cleaning up temporary files...
------------------------------

 [OK] Backup complete in 0.60 seconds.                                                                          

root@dev:/home/ubuntu# /var/azuracast/www/bin/console azuracast:restore /root/lala.zip

AzuraCast Restore
=================

Please wait while the backup is restored...

Extracting backup file...
-------------------------

Archive:  /root/lala.zip
  inflating: tmp/azuracast_backup_mariadb/db.sql  

Importing database...
---------------------

Running standard updates...
---------------------------

AzuraCast Setup
===============

Welcome to AzuraCast. Please wait while some key dependencies of AzuraCast are set up...

Initialize AzuraCast
====================

Initializing essential settings...
 * Environment: Production
 * Installation Method: Ansible

Running Database Migrations
---------------------------

Database Migrations
===================

 [OK] Database is already up to date!                                                                           

Generating Database Proxy Classes
---------------------------------

 Processing entity "App\Entity\Settings"
 Processing entity "App\Entity\SongHistory"
 Processing entity "App\Entity\StorageLocation"
 Processing entity "App\Entity\StationMedia"
 Processing entity "App\Entity\Analytics"
 Processing entity "App\Entity\PodcastEpisode"
 Processing entity "App\Entity\UnprocessableMedia"
 Processing entity "App\Entity\StationPlaylist"
 Processing entity "App\Entity\CustomField"
 Processing entity "App\Entity\User"
 Processing entity "App\Entity\StationQueue"
 Processing entity "App\Entity\UserLoginToken"
 Processing entity "App\Entity\StationMediaCustomField"
 Processing entity "App\Entity\StationPlaylistFolder"
 Processing entity "App\Entity\PodcastMedia"
 Processing entity "App\Entity\StationWebhook"
 Processing entity "App\Entity\ApiKey"
 Processing entity "App\Entity\AuditLog"
 Processing entity "App\Entity\SftpUser"
 Processing entity "App\Entity\StationPlaylistMedia"
 Processing entity "App\Entity\StationRequest"
 Processing entity "App\Entity\Relay"
 Processing entity "App\Entity\Station"
 Processing entity "App\Entity\Role"
 Processing entity "App\Entity\Podcast"
 Processing entity "App\Entity\StationRemote"
 Processing entity "App\Entity\StationStreamerBroadcast"
 Processing entity "App\Entity\StationSchedule"
 Processing entity "App\Entity\Listener"
 Processing entity "App\Entity\StationMount"
 Processing entity "App\Entity\PodcastCategory"
 Processing entity "App\Entity\RolePermission"
 Processing entity "App\Entity\StationStreamer"
 Processing entity "App\Entity\StationHlsStream"

 Proxy classes generated to "/var/azuracast/www_tmp/proxies"

Reload System Data
------------------

 [OK] Local cache flushed.                                                                                      

 [OK] AzuraCast is now initialized.                                                                             

Refreshing All Stations
-----------------------

 [OK] Unplayed station queues cleared.                                                                          

Restarting all radio stations...
--------------------------------

 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%[2023-07-13T17:56:15.265395+00:00] AzuraCast.ERROR: Could not parse Mount Point AutoDJ Mount: /stream (320kbps MP3) Relay URL URL "" {"exception":"[object] (RuntimeException(code: 0): URL field is empty. at /var/azuracast/www/src/Utilities/Urls.php:18)"} []
[2023-07-13T17:56:26.187290+00:00] AzuraCast.ERROR: Supervisor fault: SPAWN_ERROR: station_2:station_2_backend {"faultString":"SPAWN_ERROR: station_2:station_2_backend","faultCode":50} []

 [ERROR] AutoDJ: station_2:station_2_backend encountered an error: SpawnErrorException                          

 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 [OK] AzuraCast is now updated to the latest version!                                                           

 [OK] Restore complete in 13.911 seconds.                                                                       

root@dev:/home/ubuntu#

The one I restored with the docker installation worked fine. This is a restore without media, and is a known good backup.

With Docker, you are on the latest rolling release or the latest stable version, which is 0.18.5. However, what you have here is actually version 0.17.6.

DocTator2281 commented 1 year ago

Interesting.. So I'm trying to take a config backup from a production docker installation, which would be on the latest stable version... and restore it to the version installed when using your script. Basically I'm trying to get rid of Docker, because it'll be easier to do a lot of things that way. Any way we could make your script install the latest stable version so this works? Even if only temporarily?

scysys commented 1 year ago

I plan to update this to the next stable version over the weekend. After the update, what you're trying to do should work.

scysys commented 1 year ago

@DocTator2281 Just give it a try now. Upgrade or install 0.18.5 from new. If you are at Stable and not Rolling Release with Docker, it should work as you expect.

DocTator2281 commented 1 year ago

@scysys that seems to work properly. Thanks so much for your help!

DocTator2281 commented 1 year ago

hey sorry to bug you again... but I'm having some weird issues that aren't happening on the docker install. After restoring the backup (successfully) and then restoring the media, liquidsoap throws this error when trying to start the autodj service:

SupervisorException at /var/azuracast/www/src/Exception/SupervisorException.php L69: station_1:station_1_backend encountered an error: SpawnErrorException
Check the log for details.

After I do that, I usually notice the PHP queue processing worker in administration has stopped, but that starts up again successfully. When I look at the supervisor logs, I'm seeing these errors:

2023-07-16 17:28:53,846 INFO spawned: 'station_1_backend' with pid 12461
2023-07-16 17:28:57,945 INFO exited: station_1_backend (exit status 1; not expected)
2023-07-16 17:28:58,959 INFO spawned: 'station_1_backend' with pid 12478
2023-07-16 17:29:02,097 INFO exited: station_1_backend (exit status 1; not expected)
2023-07-16 17:29:04,326 INFO spawned: 'station_1_backend' with pid 12526
2023-07-16 17:29:07,712 INFO exited: station_1_backend (exit status 1; not expected)
2023-07-16 17:29:11,517 INFO spawned: 'station_1_backend' with pid 12537
2023-07-16 17:29:14,477 INFO exited: station_1_backend (exit status 1; not expected)
2023-07-16 17:29:18,778 INFO spawned: 'station_1_backend' with pid 12554
2023-07-16 17:29:22,014 INFO exited: station_1_backend (exit status 1; not expected)
2023-07-16 17:29:27,197 INFO spawned: 'station_1_backend' with pid 12571
2023-07-16 17:29:29,998 INFO exited: station_1_backend (exit status 1; not expected)
2023-07-16 17:29:30,566 INFO gave up: station_1_backend entered FATAL state, too many start retries too quickly

The other thing I've noticed is that even though this is supposed to be a stable installation, it comes up saying rolling release on the footer :

Powered by [AzuraCast](https://www.azuracast.com/) • Rolling Release #[a58f837](https://github.com/AzuraCast/AzuraCast/commit/a58f8370502752045274bbf0c6abd17d9b5ea2e1) (2023-06-16 17:15) • Ansible • PHP 8.2
Like our software? [Donate to support AzuraCast!](https://docs.azuracast.com/en/contribute/donate)

The installation itself goes perfectly, except for the fact that I tend to have to chmod -R 777 /var/azuracast in order to be able to connect to FTP to upload media.

The reason I'm trying to install this way is I've been having problems with database errors caused by what seems like dangling partial uploads in the database. So when you search for certain artists, it'll error out. I've found it a lot easier to search and edit the database when Docker isn't in the way. I might have to bug the Azuracast devs for that one though if I can't get it figured out.

As for the stuff above, do you have any ideas of what I might be doing wrong here? Thanks!

UPDATE : I figured out the problem with liquidsoap not starting - ended up being another permissions issue in /var/azuracast/stations/station_name/

scysys commented 1 year ago

Never CHMOD anything with 0777. But you can do what you want :) I'll prefer not to do that.

Please do this as the root user:

chown -R azuracast.azuracast /var/azuracast/www*

I'll updated the process after I write here again. I made a little mistake in first step. Maybe this is the error on your side.

After this, do

supervisorctl restart all

If you had no errors, everything is okay now.

The other thing I've noticed is that even though this is supposed to be a stable installation, it comes up saying rolling release on the footer.

But when you click on it, you will be redirected here: https://github.com/AzuraCast/AzuraCast/commit/a58f8370502752045274bbf0c6abd17d9b5ea2e1, which is the latest stable commit.

DocTator2281 commented 1 year ago

everything started ok except this ... station_1:station_1_backend: ERROR (spawn error) So went to /var/azuracast/stations/genesis_radio/config/liquidsoap.log -- it was complaining about the master_me compression being turned on..

Error 5: this value has no method `master_me`
INFO: Loading Sdl_ttf, Target = linux
INFO: Loading Sdl_image, Target = linux
At /var/azuracast/stations/genesis_radio/config/liquidsoap.liq, line 370, char 8-14:
radio = ladspa.master_me(

Error 5: this value has no method `master_me`

Soon as I turned that off everything started right up. This is a non-production installation, so when I do it on the production instance I won't chmod 777 anything, and hopefully it all works out. Thanks again :)

scysys commented 1 year ago

It seems i forgot to add new master_me ^^Ill will correct today

scysys commented 1 year ago

Added to update & install. On this actual test system do this

cd /root && curl -s -o /root/master_me.sh https://raw.githubusercontent.com/scysys/AzuraCast-Ubuntu/main/stations/setup/master_me.sh && chmod +x master_me.sh && ./master_me.sh

DocTator2281 commented 1 year ago

Works :)