Mixpost
-
Full Upgrade Guide:
I followed this doc page:
https://docs.inovector.com/books/mixpost-pro-team/page/upgrading-to-v1In the terminal:
cd to app/data/mixpost-pro-team-app
run command:
composer require inovector/mixpost-pro-team "^1.0"
run command:
php artisan make:migration create_mixpost_v1_tables
Go to the file manager:
/app/data/mixpost-pro-team-app/database/migrations
and change ownership of 2023_08_21_121342_create_mixpost_v1_tables.php file fromroot
towww-data
Note: your file name will differ as it will have a different date at the beginning.Open
2023_08_21_121342_create_mixpost_v1_tables.php
and replace its content with the migration content from the source guide I posted above. For reference, the code is:<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use Inovector\Mixpost\Models\Account; return new class extends Migration { public function up(): void { Schema::table('mixpost_accounts', function (Blueprint $table) { $table->boolean('authorized')->default(false)->after('data'); }); Account::withoutWorkspace()->update(['authorized' => true]); Schema::table('mixpost_settings', function (Blueprint $table) { $table->unique(['user_id', 'name']); }); Schema::create('mixpost_user_two_factor_auth', function (Blueprint $table) { $table->id(); $table->bigInteger('user_id')->unsigned()->index(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->text('secret_key'); $table->text('recovery_codes'); $table->timestamp('confirmed_at')->nullable(); $table->timestamps(); }); Schema::create('mixpost_pages', function (Blueprint $table) { $table->id(); $table->uuid('uuid')->unique(); $table->string('name')->nullable(); $table->string('slug')->unique(); $table->string('meta_title')->nullable(); $table->text('meta_description')->nullable(); $table->string('layout'); $table->boolean('status')->default(0); $table->timestamps(); }); Schema::create('mixpost_blocks', function (Blueprint $table) { $table->id(); $table->string('name'); $table->string('module'); $table->json('content')->nullable(); $table->boolean('status')->default(0); $table->timestamps(); }); Schema::create('mixpost_page_block', function (Blueprint $table) { $table->id(); $table->foreignId('page_id')->constrained('mixpost_pages')->onDelete('cascade'); $table->foreignId('block_id')->constrained('mixpost_blocks')->onDelete('cascade'); $table->json('options')->nullable(); $table->integer('sort_order')->nullable(); }); Schema::create('mixpost_configs', function (Blueprint $table) { $table->id(); $table->string('group'); $table->string('name'); $table->json('payload')->nullable(); $table->unique(['group', 'name']); }); } };
Run command:
php artisan migrate
Note: if you get an error at this step, see my post above this one for a fix. Basically, it is a file name mismatch of what's in the /migration folder and the migration table in the database. Rename the file manager files to match the database to fix.run commands (one at a time):
php artisan vendor:publish --tag=mixpost-config --force
php artisan route:cache
php artisan mixpost:clear-settings-cache
php artisan mixpost:clear-services-cache
php artisan horizon:terminate
Restart the app
run commands:
cd /app/data/mixpost-pro-team-app/
php artisan horizon
Make sure Horizon isn't killing itself and that it reports back. If so, you are DONE!
-
@girish something is keeping horizon alive. Dima and I have no clue what or how. This cron job isn't doing that. Any idea what's going on? Is there some function that comes preinstalled with Cloudron that could be replacing/handling the supervisor job?
* * * * * cd /app/data/mixpost-pro-team-app && php artisan schedule:run >> /app/data/null 2>&1
-
@privsec a fresh install will get you to v1 but you might still encounter an error when running php artisan migrate. In that case, follow my post above the upgrade guide to get that sorted out. I think we’ll encounter the same issues when upgrading in the future because the file ownership defaults to root and not www-data for newly added files, so the upgrade guide should apply to future updates.
-
@humptydumpty Ayeee! GG +1
Well done. I have not messed with my instance recently - my Horizon would eventually kill or become inactive somehow and I would have to manually restart.I was planning on a rebuild and more TS so i will test your steps and report back
-
@plusone-nick I just checked Horizon and it's still running on my instance. I linked Twitter yesterday and made two posts which worked as intended. I think we got a working and stable guide going for Mixpost! The only issue left is figuring out the Horizon magic. How is it alive?! It feels like we created Frankenstein and now trying to see what makes him tick
-
@girish We sorted out all Mixpost installation errors but the Horizon mystery remains. Dima has no clue how Horizon is staying alive without Supervisor. Any thoughts?
-
@humptydumpty and @plusone-nick
Do we need to have Horizon stay alive? Is there a way we can confirm it is up, and if it is not working, what do you do? -
@privsec Horizon has to stay alive. It's a must.
Go to your domain.com/mixpost/admin/system/status page and it should all be green like this.
Also, when you ran the command:
php artisan horizon
If you wait a few seconds, you should see it report back something similar to a ping test:
bla bla bla.... 15ms
bla bla bla... 8msOtherwise, it will say KILLED instead.
If its not working, then you need to redo the installation and apply the "fix" that I posted in comment #83
-
-
@privsec Please keep in mind, I just installed it too and I haven't used the app before, so I'm in the same boat as you. However, since we worked out all the errors, the upgrade path should keep all existing posts/users/media/etc. intact.
Start with Nick's installation guide (#49) (skip step 10; somehow the app works without supervisor) and apply the fixes in #83 to get rid of the errors during the outlined steps. Yes, I believe we will have to do the fixes for each upgrade since any new files that get added by the upgrade will default to root ownership which need to be changed to www-data.
My suggestion is to try to install it the first time while keeping in mind that it's a test run just to familiarize yourself with the process. Then, you'll know when to apply the fixes during the intial installation. A cool thing you can do here is to create a backup of the fresh LAMP that you can restore to. If you delete the app and reinstall it, then all the credentials (mysql, phpmyadmin, etc.) will change.
One thing that wasn't mentioned yet, during the installation, you'll be asked "do you want to save these credentials". Say Yes!
I feel comfortable enough to start using the app for my own use. I wouldn't dare give it out to paid clients since it's not a packaged app and Horizon is working automagically but no one knows how because it shouldn't be able to stay alive! With that said, Cloudron backups work and the app itself is stable enough for production use.
-
@privsec I just realized my mistake. For the initial installation follow #49 (skip step 10; somehow the app works without supervisor) and apply the fixes in #83 to get rid of the errors during the outlined steps.
In the future when you need to upgrade from v1.0 to v1.X, follow the upgrade guide in comment #84 and apply the fixes in comment #83. If you do #49 again, user data won't transfer over.
-
@humptydumpty interesting. LAMP app has no special code to run horizon in the background. There must be something else running it. Have you tried to use ps to figure out what the parent process of horizon is?
-
@girish I ran ps aux (had to look that up, I love that you're mistaking my copy/paste skills with actual coding knowledge )
root@fb19c14f-edfa-432b-b7a1-89f306948ce0:/app/data/mixpost-pro-team-app# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 320052 53260 pts/0 Ss+ Aug21 0:13 /usr/sbin/apache2 -DFOREGROUND root 17 0.0 0.0 2928 1008 pts/0 S+ Aug21 0:00 /bin/cat root 18 0.0 0.0 2928 1000 pts/0 S+ Aug21 0:01 /bin/cat root 22 0.0 0.0 5048 4032 pts/1 Ss Aug21 0:00 /bin/bash root 34 0.1 0.2 292272 80148 pts/1 S+ Aug21 3:33 php artisan horizon root 36 0.1 0.2 292276 79832 pts/1 S+ Aug21 3:36 /usr/bin/php8.1 artisan horizon:supervisor fb19c14f-edfa-432b-b7a1-89f306948ce0-CXZh:supervisor-1 redis --workers-name=default --balance=auto -- root 37 0.1 0.2 292276 80208 pts/1 S+ Aug21 3:22 /usr/bin/php8.1 artisan horizon:supervisor fb19c14f-edfa-432b-b7a1-89f306948ce0-CXZh:mixpost-heavy mixpost-redis --workers-name=default --balanc root 1528 0.0 0.2 369804 90236 pts/1 S+ Aug21 1:09 /usr/bin/php8.1 artisan horizon:work mixpost-redis --name=default --supervisor=fb19c14f-edfa-432b-b7a1-89f306948ce0-CXZh:mixpost-heavy --backoff www-data 9960 0.1 0.1 321308 43272 pts/0 S+ 02:25 0:02 /usr/sbin/apache2 -DFOREGROUND www-data 10041 0.2 0.1 321056 42980 pts/0 S+ 02:44 0:00 /usr/sbin/apache2 -DFOREGROUND root 10042 0.0 0.0 5048 4012 pts/2 Ss 02:45 0:00 /bin/bash root 10078 6.8 0.2 292228 79640 pts/1 S+ 02:49 0:00 /usr/bin/php8.1 artisan horizon:work redis --name=default --supervisor=fb19c14f-edfa-432b-b7a1-89f306948ce0-CXZh:supervisor-1 --backoff=0 --max- root 10083 0.0 0.0 7480 3224 pts/2 R+ 02:49 0:00 ps aux
Edit: old dog learned a new trick (ps auxf)
root@fb19c14f-edfa-432b-b7a1-89f306948ce0:/app/data/mixpost-pro-team-app# ps auxf USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 10042 0.0 0.0 5048 4016 pts/2 Ss 02:45 0:00 /bin/bash root 10148 0.0 0.0 7480 3084 pts/2 R+ 03:04 0:00 \_ ps auxf root 22 0.0 0.0 5048 4032 pts/1 Ss Aug21 0:00 /bin/bash root 34 0.1 0.2 292272 80148 pts/1 S+ Aug21 3:35 \_ php artisan horizon root 36 0.1 0.2 292276 79832 pts/1 S+ Aug21 3:38 \_ /usr/bin/php8.1 artisan horizon:supervisor fb19c14f-edfa-432b-b7a1-89f306948ce0-CXZh:supervisor-1 redis --workers-name=default --balance root 10143 0.9 0.2 292228 79708 pts/1 S+ 03:03 0:00 | \_ /usr/bin/php8.1 artisan horizon:work redis --name=default --supervisor=fb19c14f-edfa-432b-b7a1-89f306948ce0-CXZh:supervisor-1 --back root 37 0.1 0.2 292276 80208 pts/1 S+ Aug21 3:23 \_ /usr/bin/php8.1 artisan horizon:supervisor fb19c14f-edfa-432b-b7a1-89f306948ce0-CXZh:mixpost-heavy mixpost-redis --workers-name=default root 1528 0.0 0.2 369804 90236 pts/1 S+ Aug21 1:09 \_ /usr/bin/php8.1 artisan horizon:work mixpost-redis --name=default --supervisor=fb19c14f-edfa-432b-b7a1-89f306948ce0-CXZh:mixpost-hea root 1 0.0 0.1 320052 53260 pts/0 Ss+ Aug21 0:13 /usr/sbin/apache2 -DFOREGROUND root 17 0.0 0.0 2928 1008 pts/0 S+ Aug21 0:00 /bin/cat root 18 0.0 0.0 2928 1000 pts/0 S+ Aug21 0:01 /bin/cat www-data 9960 0.1 0.1 321308 43276 pts/0 S+ 02:25 0:04 /usr/sbin/apache2 -DFOREGROUND www-data 10041 0.1 0.1 321056 43004 pts/0 S+ 02:44 0:02 /usr/sbin/apache2 -DFOREGROUND www-data 10090 0.1 0.1 321056 42988 pts/0 S+ 02:51 0:01 /usr/sbin/apache2 -DFOREGROUND
more copy paste info i found online
root@fb19c14f-edfa-432b-b7a1-89f306948ce0:/app/data/mixpost-pro-team-app# ps -Flww -p 34 F S UID PID PPID C PRI NI ADDR SZ WCHAN RSS PSR STIME TTY TIME CMD 0 S root 34 22 0 80 0 - 73068 hrtime 80148 5 Aug21 pts/1 00:03:35 php artisan horizon root@fb19c14f-edfa-432b-b7a1-89f306948ce0:/app/data/mixpost-pro-team-app# cd /proc/34 root@fb19c14f-edfa-432b-b7a1-89f306948ce0:/proc/34# ls arch_status cgroup coredump_filter environ gid_map map_files mounts numa_maps pagemap root setgroups stat task uid_map attr clear_refs cpu_resctrl_groups exe io maps mountstats oom_adj patch_state sched smaps statm timens_offsets wchan autogroup cmdline cpuset fd limits mem net oom_score personality schedstat smaps_rollup status timers auxv comm cwd fdinfo loginuid mountinfo ns oom_score_adj projid_map sessionid stack syscall timerslack_ns root@fb19c14f-edfa-432b-b7a1-89f306948ce0:/proc/34# cat /proc/34/status Name: php Umask: 0022 State: S (sleeping) Tgid: 34 Ngid: 0 Pid: 34 PPid: 22 TracerPid: 0 Uid: 0 0 0 0 Gid: 0 0 0 0 FDSize: 256 Groups: 0 NStgid: 34 NSpid: 34 NSpgid: 34 NSsid: 22 VmPeak: 292324 kB VmSize: 292272 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 80148 kB VmRSS: 80148 kB RssAnon: 20828 kB RssFile: 37968 kB RssShmem: 21352 kB VmData: 21536 kB VmStk: 132 kB VmExe: 3020 kB VmLib: 62052 kB VmPTE: 312 kB VmSwap: 0 kB HugetlbPages: 0 kB CoreDumping: 0 THP_enabled: 1 Threads: 1 SigQ: 2/120015 SigPnd: 0000000000000000 ShdPnd: 0000000000000000 SigBlk: 0000000000000000 SigIgn: 0000000000001000 SigCgt: 0000000004024a07 CapInh: 0000000000000000 CapPrm: 00000000a80405fb CapEff: 00000000a80405fb CapBnd: 00000000a80405fb CapAmb: 0000000000000000 NoNewPrivs: 0 Seccomp: 2 Seccomp_filters: 1 Speculation_Store_Bypass: thread force mitigated SpeculationIndirectBranch: conditional force disabled Cpus_allowed: ff Cpus_allowed_list: 0-7 Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001 Mems_allowed_list: 0 voluntary_ctxt_switches: 339836 nonvoluntary_ctxt_switches: 387995
-
@humptydumpty Could it be that you started
php artisan horizon
manually on a web terminal ? Have you tested that it starts up automatically after restarting the app ? (which kills all the existing web terminal sessions). -
@humptydumpty yes, correct, you can just put it in the app's cron . Alternately, the LAMP app supports a startup script - https://docs.cloudron.io/apps/lamp/#custom-startup-script .
-
App won't start. I think I know why its because the php artisan horizon has to be cd'd to /app/data/mixpost-pro-team-app/ first. How do you enter that in run.sh?startup script didn't work.After much trial and error, I got the cron method to start horizon automatically after I remembered the @service cron Girish mentioned in an earlier post.
@service cd /app/data/mixpost-pro-team-app && php artisan horizon * * * * * cd /app/data/mixpost-pro-team-app && php artisan schedule:run >> /app/data/null 2>&1
@plusone-nick add this cron to your install guide
-
I updated from Mixpost Pro v.1.0.0 to v.1.2.0 using the official Mixpost update guide. But you need to do one thing beforehand, and another at the end to complete the steps on Cloudron.
Step 1: navigate to the mixpost folder before starting the update process
cd /app/data/mixpost-pro-team-app/
Step 2: follow update guide https://docs.inovector.com/books/mixpost-pro/page/in-your-standalone-or-laravel-app
Step 3: finish it off by running
php artisan horizon
Done.