thomthom

thomthom

Member Since 3 Years Ago

Experience Points 31,640
Experience Level 7

3,360 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 299
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

08 Jun
1 year ago

thomthom left a reply on Webpack + Vue + TypeScript => ES5?

Any examples of a working webpack.mix.js for .vuefiles with TypeScript to ES5?

thomthom left a reply on Webpack + Vue + TypeScript => ES5?

Any examples of getting .vue files working with TypeScript to ES5 using Mix? (Or any kind of build tool?)

thomthom left a reply on Webpack + Vue + TypeScript => ES5?

@martinbean if Laravel Mix can be used without a Laravel application, then I'd be happy to use that if it allow me to achieve my goal.

thomthom left a reply on Webpack + Vue + TypeScript => ES5?

@martinbean This particular project isn't a Laravel project. (I hope it's still ok to ask on this forum?)

thomthom started a new conversation Webpack + Vue + TypeScript => ES5?

I've been trying to compile single file Vue components, .vue files, with TypeScript into ES5 via Webpack 4.

As far as i got with the rules section of my Webpack config:

    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          loaders: {
            // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
            // the "scss" and "sass" values for the lang attribute to the right configs here.
            // other preprocessors should work out of the box, no loader config like this necessary.
            'scss': 'vue-style-loader!css-loader!sass-loader',
            'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax',
          }
          // other vue-loader options go here
        }
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/
      },
      {
        test: /\.tsx?$/,
        loader: 'ts-loader',
        exclude: /node_modules/,
        options: {
          appendTsSuffixTo: [/\.vue$/],
        }
      },
      {
        test: /\.(png|jpg|gif|svg)$/,
        loader: 'file-loader',
        options: {
          name: 'images/[name].[ext]',
          // emitFile: false
        }
      },
      {
        test: /\.css$/,
        use: [
          'vue-style-loader',
          'css-loader'
        ]
      }
    ]

This will convert .ts files to ES5 (TypeScript compiler generates ES6 JS and Babel then transpiles to ES5 with polyfills).

However, the TypeScript in the .vue files are not processed by Babel. So I end up with a mix of ES5 and ES6 JS.

And I'm not able to find any good example of how to achieve this.

I can't just tell TypeScript to target ES5 because it needs to polyfill stuff like .findIndex and convert other things so IE11 will be happy.

Anyone have an example setup on how to achieve this?

25 May
1 year ago

thomthom started a new conversation HTTP Statistics For Nginx Servers?

I'm considering migrating an old website I have on a shared hosting to a DO droplet (maybe via Forge).

The old site uses Apache to serve PHP and the host offer web statistics via Cpanel+Awstats.

Any recommendations on HTTP statistics generators for nginx environments?

19 Apr
1 year ago

thomthom left a reply on Forge Auto-updating Pip Packages?

@adaptivemedia If you haven't done so already, I'd recommend you mention this to Forge support. And suggest that updating major package versions automatically without notice isn't ideal. I already mentioned it - though I didn't get any response to that.

16 Apr
1 year ago

thomthom left a reply on Forge Auto-updating Pip Packages?

I just got confirmation from Forge support on this. I responded with a request to be more conservative in upgrading packages - avoiding automatically updating major versions due to potential breaking changes.

thomthom left a reply on Forge Auto-updating Pip Packages?

Ah, LetEncrypt was something I had only enabled on the new server. Explains why the old remained the same.

I got to say, updating major versions of a package like that isn't a great thing to do. That should be left to the owner of the server. And if a newer version would be needed the owner should be notified and given the option to control the upgrade.

This is why I'm not buying into the "always on the latest and greatest". There is always some compatibility friction with that.

15 Apr
1 year ago

thomthom left a reply on Forge Auto-updating Pip Packages?

Ottomatik is activly working updates right now. Hence the errors changing.

thomthom left a reply on Forge Auto-updating Pip Packages?

Now I'm getting messages from Ottomatik every 5 minutes...

thomthom left a reply on Forge Auto-updating Pip Packages?

Here's what I find in the cron job directories:

[email protected]:~$ ls /etc/cron.hourly
[email protected]:~$ ls /etc/cron.daily
apport  apt-compat  bsdmainutils  dpkg  logrotate  man-db  mdadm  mlocate  passwd  popularity-contest  sendmail  update-notifier-common
[email protected]:~$ ls /etc/cron.weekly
fstrim  man-db  update-notifier-common
[email protected]:~$ ls /etc/cron.monthly

Haven't inspected them all though.

crontab looks like this:

[email protected]:~$ cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

# Laravel Forge Scheduler 261483
0 0 * * * root /usr/local/bin/composer self-update > /home/forge/.forge/scheduled-261483.log 2>&1

thomthom left a reply on Forge Auto-updating Pip Packages?

Btw, isn't it doubtful that ottomatik is trying to install something?

From the error message from ottomatik it appear that it will check pip dependencies and attempt to install packages if they don't need their requirement.

But all my dependencies met the requirements. Even pip, so it should not have triggered anything.

thomthom left a reply on Forge Auto-updating Pip Packages?

@m-rk - same thing here. Nothing that appear relevant in the apt log on my server either.

thomthom left a reply on Forge Auto-updating Pip Packages?

@gillidanda - do you have a sense of the age of the servers?

Maybe it's related to when they were provisioned.

I just set up a new forge server a couple of weeks ago. Migrating from an older Ubuntu 14.04 server to a new droplet. This newer server enabled some extra forge features (such as being able to update PHP etc).

I still have the old droplet and I just checked its pip version, it's still at 9.0.1.

thomthom left a reply on Forge Auto-updating Pip Packages?

I've fired off a message to Forge support for information. (Via that widget they have on Forge dashboard, but last few times I tried that I never got a response. Had to track down the actual email address and only then did I get a reply. Seems like the widget tend to eat my messages.)

thomthom left a reply on Forge Auto-updating Pip Packages?

@m-rk can I presume that you also didn't touch your server today? Any explicit setup of pip updates on your server that you can recall?

(Btw, have you contacted their support? Just to bump the ticket in their court and indicate it's not an issue local to only my machine that pip changed.)

thomthom left a reply on Forge Auto-updating Pip Packages?

Haven't had tried Forge support yet, no. (Lately I've not been too impressed with response.) I'll throw them a question to see what they say.

But yea, I'm sure I haven't put in any pip install --upgrade pip myself. Haven't had any need to particularly manage them. Using forge because I wanted a more hands off experience.

I checked the time stamps on the pip libs, and it appear that pip is the only thing that got modified today:

/usr/local/lib/python2.7/dist-packages$ ls -lht
total 240K
drwxr-sr-x 2 root staff 4.0K Apr 15 07:04 pip-10.0.0.dist-info
drwxr-sr-x 4 root staff 4.0K Apr 15 07:04 pip
drwxr-sr-x 2 root staff 4.0K Apr 10 12:25 setuptools-39.0.1.dist-info
drwxr-sr-x 5 root staff 4.0K Apr 10 12:25 setuptools
drwxr-sr-x 4 root staff 4.0K Apr 10 12:25 pkg_resources
-rw-r--r-- 1 root staff  315 Apr 10 12:25 easy_install.pyc
-rw-r--r-- 1 root staff  126 Apr 10 12:25 easy_install.py
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 awscli-1.15.1.dist-info
drwxr-sr-x 6 root staff 4.0K Apr  5 20:56 awscli
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 rsa-3.4.2.dist-info
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 rsa
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 pyasn1-0.4.2.dist-info
drwxr-sr-x 5 root staff 4.0K Apr  5 20:56 pyasn1
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 s3transfer
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 s3transfer-0.1.13.dist-info
drwxr-sr-x 3 root staff 4.0K Apr  5 20:56 concurrent
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 futures-3.2.0.dist-info
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 PyYAML-3.12.dist-info
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 yaml
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 colorama
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 colorama-0.3.7.dist-info
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 botocore-1.10.1.dist-info
drwxr-sr-x 5 root staff 4.0K Apr  5 20:56 botocore
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 docutils-0.14.dist-info
drwxr-sr-x 8 root staff 4.0K Apr  5 20:56 docutils
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 python_dateutil-2.6.1.dist-info
drwxr-sr-x 4 root staff 4.0K Apr  5 20:56 dateutil
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 six-1.11.0.dist-info
-rw-r--r-- 1 root staff  30K Apr  5 20:56 six.pyc
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 jmespath-0.9.3.dist-info
drwxr-sr-x 2 root staff 4.0K Apr  5 20:56 jmespath
-rw-r--r-- 1 root staff  31K Apr  5 20:56 six.py
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 httpie-0.9.9.dist-info
drwxr-sr-x 4 root staff 4.0K Apr  3 19:14 httpie
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 requests-2.18.4.dist-info
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 requests
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 urllib3-1.22.dist-info
drwxr-sr-x 5 root staff 4.0K Apr  3 19:14 urllib3
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 idna
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 idna-2.6.dist-info
drwxr-sr-x 3 root staff 4.0K Apr  3 19:14 chardet
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 chardet-3.0.4.dist-info
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 certifi
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 certifi-2018.1.18.dist-info
drwxr-sr-x 2 root staff 4.0K Apr  3 19:14 Pygments-2.2.0.dist-info
drwxr-sr-x 6 root staff 4.0K Apr  3 19:14 pygments

thomthom left a reply on Forge Auto-updating Pip Packages?

I tried to find out whether pip keeps a log or not. But from what I can tell it doesn't unless you manually use the --log argument.

thomthom left a reply on Forge Auto-updating Pip Packages?

I haven't set up anything in the scheduler. It's a pretty plain Laravel+forge+ottomatik setup.

Only thing I added was in the deploy script to notify BugSnag about new releases.

And I haven't touched the server for over a week. Haven't pushed anything. Hence my surprise over the backups failing. Since Pip 10 was released yesterday it's clear that something is running. But I have no idea what that something might be.

I found this file: /var/log/unattended-upgrades/unattended-upgrades.logbut there isn't anything there for the last couple of days:

2018-04-04 06:42:34,840 INFO Initial blacklisted packages:
2018-04-04 06:42:34,840 INFO Initial whitelisted packages:
2018-04-04 06:42:34,840 INFO Starting unattended upgrades script
2018-04-04 06:42:34,840 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-04 06:42:37,150 INFO No packages found that can be upgraded unattended and no pending auto-removals
2018-04-05 06:16:22,834 INFO Initial blacklisted packages:
2018-04-05 06:16:22,835 INFO Initial whitelisted packages:
2018-04-05 06:16:22,835 INFO Starting unattended upgrades script
2018-04-05 06:16:22,836 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-05 06:16:28,751 INFO Packages that will be upgraded: linux-headers-generic linux-headers-virtual linux-image-virtual linux-libc-dev linux-virtual
2018-04-05 06:16:28,752 INFO Writing dpkg log to '/var/log/unattended-upgrades/unattended-upgrades-dpkg.log'
2018-04-05 06:16:45,590 INFO All upgrades installed
2018-04-06 06:24:33,844 INFO Initial blacklisted packages:
2018-04-06 06:24:33,845 INFO Initial whitelisted packages:
2018-04-06 06:24:33,845 INFO Starting unattended upgrades script
2018-04-06 06:24:33,845 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-06 06:24:35,929 INFO No packages found that can be upgraded unattended and no pending auto-removals
2018-04-07 06:59:55,695 INFO Initial blacklisted packages:
2018-04-07 06:59:55,696 INFO Initial whitelisted packages:
2018-04-07 06:59:55,696 INFO Starting unattended upgrades script
2018-04-07 06:59:55,696 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-07 06:59:57,847 INFO No packages found that can be upgraded unattended and no pending auto-removals
2018-04-08 06:48:22,831 INFO Initial blacklisted packages:
2018-04-08 06:48:22,832 INFO Initial whitelisted packages:
2018-04-08 06:48:22,832 INFO Starting unattended upgrades script
2018-04-08 06:48:22,832 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-08 06:48:24,965 INFO No packages found that can be upgraded unattended and no pending auto-removals
2018-04-09 06:50:03,930 INFO Initial blacklisted packages:
2018-04-09 06:50:03,931 INFO Initial whitelisted packages:
2018-04-09 06:50:03,931 INFO Starting unattended upgrades script
2018-04-09 06:50:03,931 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-09 06:50:06,181 INFO No packages found that can be upgraded unattended and no pending auto-removals
2018-04-10 06:43:53,036 INFO Initial blacklisted packages:
2018-04-10 06:43:53,036 INFO Initial whitelisted packages:
2018-04-10 06:43:53,036 INFO Starting unattended upgrades script
2018-04-10 06:43:53,037 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-10 06:43:55,247 INFO No packages found that can be upgraded unattended and no pending auto-removals
2018-04-11 06:04:42,079 INFO Initial blacklisted packages:
2018-04-11 06:04:42,080 INFO Initial whitelisted packages:
2018-04-11 06:04:42,080 INFO Starting unattended upgrades script
2018-04-11 06:04:42,080 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-11 06:04:45,699 INFO Packages that will be upgraded: python3-distupgrade ubuntu-release-upgrader-core
2018-04-11 06:04:45,699 INFO Writing dpkg log to '/var/log/unattended-upgrades/unattended-upgrades-dpkg.log'
2018-04-11 06:04:48,092 INFO All upgrades installed
2018-04-12 06:13:11,242 INFO Initial blacklisted packages:
2018-04-12 06:13:11,243 INFO Initial whitelisted packages:
2018-04-12 06:13:11,243 INFO Starting unattended upgrades script
2018-04-12 06:13:11,243 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-12 06:13:14,170 INFO Packages that will be upgraded: patch
2018-04-12 06:13:14,171 INFO Writing dpkg log to '/var/log/unattended-upgrades/unattended-upgrades-dpkg.log'
2018-04-12 06:13:16,316 INFO All upgrades installed
2018-04-13 06:46:13,288 INFO Initial blacklisted packages:
2018-04-13 06:46:13,289 INFO Initial whitelisted packages:
2018-04-13 06:46:13,289 INFO Starting unattended upgrades script
2018-04-13 06:46:13,290 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-13 06:46:15,552 INFO No packages found that can be upgraded unattended and no pending auto-removals
2018-04-14 06:51:19,763 INFO Initial blacklisted packages:
2018-04-14 06:51:19,764 INFO Initial whitelisted packages:
2018-04-14 06:51:19,764 INFO Starting unattended upgrades script
2018-04-14 06:51:19,764 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-14 06:51:22,092 INFO No packages found that can be upgraded unattended and no pending auto-removals
2018-04-15 06:08:58,930 INFO Initial blacklisted packages:
2018-04-15 06:08:58,931 INFO Initial whitelisted packages:
2018-04-15 06:08:58,931 INFO Starting unattended upgrades script
2018-04-15 06:08:58,931 INFO Allowed origins are: ['o=Ubuntu,a=xenial-security']
2018-04-15 06:09:01,232 INFO No packages found that can be upgraded unattended and no pending auto-removals

Any other logs I can try to inspect for clues? I didn't see anything on the forge dashboard either...

thomthom started a new conversation Forge Auto-updating Pip Packages?

I just experienced that my Ottomatik backup started failing today.

After working with their support it turned out that their script failed to detect the pip dependencies they needed because they expected pip list to show the version in brackets.

After some digging I found that version 10.0 of pip was released yesterday on 14th of april. It changed the default format for pip list to a new column format without the brackets. (https://blog.python.org/2018/04/pip-10-has-been-released.html)

This prompted me to wonder what automatic updates are running on forge servers. Do anyone know?

I had not expected pip packages to auto-update. (Critical apt packages, yes.)

-T

04 Mar
1 year ago

thomthom started a new conversation Migrating From Non-strict 5.4 Mysql Database To Strict 5.7 Database

I have a website that was originally created with Laravel 5.0. It has since been migrated to Laravel 5.2. It's hosted on DigitalOcean via Forge currently using MySQL 5.4.

I'm currently working on migrating the site to a new server droplet. As I was testing database transfer I ran into errors.

It appear to relate to MySQL 5.7 have strict mode on by default. (Which is what the new droplet have, as well as Homestead.)

One of the databases which produce errors was created using:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDiscountCodeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('discount_codes', function(Blueprint $table)
        {
            $table->increments('id');
            $table->integer('product_id')->unsigned();
            $table->integer('external_id')->unsigned();
            $table->string('code', 64);
            $table->timestamps();

            $table->foreign('product_id')
                ->references('id')->on('products')
                ->onUpdate('cascade')
                ->onDelete('restrict');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('discount_codes');
    }
}

On the deployed server that created a table like this:

CREATE TABLE `discount_codes` (
`id`  int(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`product_id`  int(10) UNSIGNED NOT NULL ,
`external_id`  int(10) UNSIGNED NOT NULL ,
`code`  varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`created_at`  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
`updated_at`  timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ,
PRIMARY KEY (`id`),
FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
INDEX `discount_codes_product_id_foreign` (`product_id`) USING BTREE 
)

On new instances of the app, such as the new droplet or Homestead the SQL is:

CREATE TABLE `discount_codes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` int(10) unsigned NOT NULL,
  `external_id` int(10) unsigned NOT NULL,
  `code` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `discount_codes_product_id_foreign` (`product_id`),
  CONSTRAINT `discount_codes_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET FOREIGN_KEY_CHECKS=1;

The difference is that $table->timestamps(); in pre-5.2 created date fields which are NOT NULL and default to '0000-00-00 00:00:00'. Additionally it declareON UPDATE` which the later version does not.

This change in MySQL 5.7 is mentioned in the Laravel 5.2 migration docs: https://laravel.com/docs/5.2/upgrade#upgrade-5.2.0

But that doesn't explain how to migrate existing deployed sites with existing data.

What is the best approach here?

  1. Presumably it's best to get the deployed database to match the structure of what a new instance will look like? Then I can do a simple data transfer.

But going about to adjust the deployed database... Laravel's migration feature doesn't sound right in this case. Because a new instance will not produce the same SQL the existing instance.

  1. Would adjusting the database directly in something like Navicat be appropriate?

  2. How can I test this on Homestead? (Downgrade MySQL to 5.4 and then try to execute the SQL structure of the deployed instance? Would that work?)

(Side question, since ON UPDATE doesn't appear to be set on new instances, does that mean the logic for updating dates on edits/creations is moved from MySQL to Laravel?)

22 Feb
1 year ago

thomthom left a reply on Forge Support?

Got response from BeSnappy. They said it was a third party service they used that affected a subset of their users. Should be restored now.

thomthom left a reply on Forge Support?

Whoo! I got a response from [email protected] (Though it didn't sound like they had gotten my original query made the 11th from the widget on the dashboard.)

Now, if only I can get in contact with BeSnappy and fix my own helpdesk....

thomthom left a reply on Forge Support?

Does anyone know who runs BeSnappy? Because I'm dead in the water there as well.

thomthom left a reply on Forge Support?

Looks like I need to switch helpdesk provider as well. I emailed some of my responses separately from my secondary email address and confirmed that no one have been receiving my messages for the past few days.

Messaged BeSnappy via their own support form, as well as message them on Twitter - no response there so far. (Am I cursed?)

I'll try [email protected] - hopefully that will work. (Btw, @Gorby, when you used that lifebuoy beacon, did you get a confirmation email about the message being received?)

@tptompkins - during these 21 days, have you tried pinging for an update?

21 Feb
1 year ago

thomthom left a reply on Forge Support?

Thanks for taking an interest anyway @bobbybouwmann. I think I know how I can configure the SSH changes I need. It's just that it looks like I need to touch files Forge auto-generated. Hence my need to obtain more details from Forge.

thomthom left a reply on Forge Support?

I see that my resent BeSnappy responses all contain 3 copies of my replies. And in my tests to myself I never receive the emails.

Great - now I cant reach Forge support. And my own support seem to fail due to BeSnappy.

thomthom left a reply on Forge Support?

I'm starting to wonder if this related to BeSnappy. I use BeSnappy myself - and I just to test I sent an email to my own support email. It was received, but my reply was not received by the email (gmail) I tested from. (I checked the Spam folder as well.)

Trouble is - I cannot find any alternate method of contact for Forge to confirm this.

thomthom left a reply on Forge Support?

Thanks. I just tried to file a message via that form. Will see if that yield any response.

thomthom started a new conversation Forge Support?

Since 11th of February I've been trying to open a support ticket with Forge Support.

Originally I submitted my request via the Support Widget found in the Forge dashboard. However, there has been no response - not even a confirmation about received message.

Before when I submitted a ticket I would get an automatic response from BeSnappy which apparently was their support backend back then. After a week of waiting I dug up the old emails I had from earlier support and tried to send email to that. That also yielded no response.

Lastly I tried to email the email address for the last Forge email I got - the one about IP whitelist changes. That is also mute.

Getting rather desperate I have tried Twitter, mentioning @laravelphp but nothing but crickets. Most recently I even tried to message Tyler - but not response.

Does anyone have a suggestion for a reliable support contact for Forge? I'm dead stuck and it's getting close to two weeks soon. :(

19 Feb
1 year ago

thomthom left a reply on Migrating Forge Server To Use HTTPS

It's been over a week now - no response. Does anyone know of another way to contact Forge support other than that widget on their site?

While I've been waiting for response to figure out what would trigger forge to update the forge-config files I noticed this:

Notice the item dated 14th; "Fixing LetsEncrypt Renewal Scripts". I wonder if that's the kind of scenario that might clash if I were to try to adjust the forge-conf files.

15 Feb
1 year ago

thomthom left a reply on Migrating Forge Server To Use HTTPS

I've yet to hear back from Forge support, it's been four working days. Is that normal wait time? I also didn't receive an email confirmation to my support request - I imagined I used to get that.

12 Feb
1 year ago

thomthom left a reply on Migrating Forge Server To Use HTTPS

@Gorby - sure thing. I'll post back when I hear about from support.

It seems that it's not too uncommon for HTTP libraries from various languages to be rather bare metal - doesn't automatically follow 301 responses.

thomthom left a reply on Migrating Forge Server To Use HTTPS

So there is no scheduled maintenance jobs that runs on a forge managed server?

I opened a ticket with Forge support in order to try to clarify what might overwrite the settings - so I can document it in my server's techincal docs.

thomthom left a reply on Migrating Forge Server To Use HTTPS

I've been looking closer at the Forge+LetsEncrypt configuration. When you enable SSL on forge it uses some includes to configure the HTTP to HTTPS redirection:

Extract from the main nginx site config.

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/dev.example.com/before/*;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name dev.example.com;
    root /home/forge/dev.example.com/public;

    # ...
}

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/dev.example.com/after/*;

Within forge-conf/dev.example.com/before/ssl_redirect.conf the 80 => 443 redirection is done:

# Redirect every request to HTTPS...
server {
    listen 80;
    listen [::]:80;

    server_name .dev.example.com;
    return 301 https://$host$request_uri;
}

# Redirect SSL to primary domain SSL...
server {
        listen 443 ssl http2;
    listen [::]:443 ssl http2;

    # FORGE SSL (DO NOT REMOVE!)
    # ...

    server_name www.dev.example.com;
    return 301 https://dev.example.com$request_uri;
}

Question is, can I modify the files under forge-config? Or do I run the risk of them being updated by forge at some point?

10 Feb
1 year ago

thomthom left a reply on How To Migrate To A New Droplet?

Thanks for the feedback.

I just remembered that I also have BugSnag set up. I realize I should have documented my site better as I was developing it.

I guess my strategy will be to set up a new droplet, with a temporary subdomain where I test the required transfer steps.

As for doing the actual switch, when I have a working verified workflow, would something like this work:

  1. Change TTL for my domains to something very low.
  2. Wait for that to propagate throughout the interweb.
  3. Take down the production sites in maintenance state (artisan down)
  4. Copy files
  5. Migrate DB via Navicat
  6. artisan up

Missing anything there?

This of course assumes that I provisioned the new site with all the necessary config.

One thing I encountered on a previous non-Laravel site migration was that some DB date fields where not valid at the target DB. So I had to dump the DB as .sql files and manually tweak them. (I think it was an issue with NULL vs zero-dates). That's something I could test out and setup an automated script, so when I take the production site down and dump the DB I have everything ready for as speedy conversion as possible.)

Talking out loud for a bit here - just to see if it sounds sane of whether I missed some key steps.

09 Feb
1 year ago

thomthom started a new conversation How To Migrate To A New Droplet?

I got a server on Forge, with three sites running on a DigitalOcean droplet. I have three MySQL databases, one for each site. Ottomatik backs up database and a few files which have been uploaded via the apps. It's also running an older Ubuntu version.

It's an older PHP 5.6 config which doesn't offer and automatic upgrade via Forge.

I was thinking I might as well create a new droplet and migrate the sites.

However, I've not done this before, so I'd like to seek some advice on what to do and in what order in order to ensure a smooth transfer.

Is Ottomatik possible to use as a method of transfering data? Databases and files? Of will I have to manually migrate database and files?

(I'm somewhat concerned that different MySQL versions might cause database migration issues.)

Any ideas, suggestions, tips? (I'm a linux noob.)

31 Jan
1 year ago

thomthom left a reply on Migrating Forge Server To Use HTTPS

Well your website is either https or not in my opinion.

The site got two sets of clients; the main part is web-browsers. This is what I want to set up HTTPS for. The second part are some API end points which is used by a desktop application. The snag is that this application uses a HTTP library that doesn't follow redirects - and I'm not in position to control this. Because of that the HTTPS cannot be an all-opt-in.

Anyway, it's possible but you need to manually adjust your nginx file: https://www.digitalocean.com/community/questions/nginx-how-to-force-redirect-some-urls-to-https

I'm not very familiar with nginx. I've mainly used it via Forge. The configuration file they describe in that article, is the global for the entire server? Or a per-site configuration? (Can I test this out on my staging site before deploying to my production site? I have both on the same droplet.)

30 Jan
1 year ago

thomthom started a new conversation Migrating Forge Server To Use HTTPS

I'm planning on moving a website I got hosted on Forge + DigitalOcean to use HTTPS.

The catch is that I have some API end points which should not redirect HTTP traffic to HTTPS due to compatibility issues with some clients. But for everything else I want it to redirect.

Any suggestions on how I can configure my server for this? (Was planning on using Let's Encrypt).

29 Nov
1 year ago

thomthom left a reply on Composer.lock For PHP 5.6?

Ok - just to conclude my monologue of documenting my ramblings:

I ssh'd into forge and removed bootstrap/cache/compiled.php. Back in forge I hit Deploy again and this time it ran fine.

Production deployment then went fine. :D

thomthom left a reply on Composer.lock For PHP 5.6?

Update: I tried adding config/platform/php to composer.json - and that seemed to work. Running composer update appeared to downgrade dependencies.

    "config": {
        "platform": {
            "php": "5.6.5"
        },
        "preferred-install": "dist"
    }

But I still get error when I push to forge:

PHP Fatal error:  Declaration of Illuminate\Auth\SessionGuard::basic() must be compatible with Illuminate\Contracts\Auth\SupportsBasicAuth::basic($field = 'email', $extraConditions = Array) in /home/forge/staging.*****.com/bootstrap/cache/compiled.php on line 462

I see it originates from bootstrap/cache - so this this from some stale cache? Any way to clear it?

thomthom left a reply on Composer.lock For PHP 5.6?

I just realised that composer.json have an entry for required PHP version, and I tried to update that to stay on 5.6:

    "require": {
        "php": "~5.6.0",
        "laravel/framework": "5.2.*",
        "laravelcollective/html": "5.2.*",
        "bugsnag/bugsnag-laravel": "1.*"
    },

I had hoped that would lock dependencies to PHP 5.6, but I got an error while running composer update:

Your requirements could not be resolved to an installable set of packages.

So it appear to relate to the PHP version of my local environment and not the project's target environment.

Does that mean I have to have PHP 5.6 locally to be able to get this working? Or is there some other configuration to target the dependencies to PHP 5.6?

thomthom started a new conversation Composer.lock For PHP 5.6?

I got a site that's still running PHP 5.6. I need to push a small update.

As part of the update I was working on I updated the composer.lock file because I had also updated from an old Homestead installation to a newer one.

My Homestead.yml got something like this to make Homestead operate with PHP 5.6:

sites:
    - map: mysite.local
      to:  /home/vagrant/mysite-local/public
      php: "5.6"

However, when I pushed to forge (staging for testing) I got a failure email:

Loading composer repositories with package information
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for doctrine/inflector v1.2.0 -> satisfiable by doctrine/inflector[v1.2.0].
    - doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement.
  Problem 2
    - doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement.
    - laravel/framework v5.2.45 requires doctrine/inflector ~1.0 -> satisfiable by doctrine/inflector[v1.2.0].
    - Installation request for laravel/framework v5.2.45 -> satisfiable by laravel/framework[v5.2.45].

So I appear to have updated composer.lock with packages that required PHP 7.

(I recently got a new computer, so I set up everything fresh - this time with PHP7 on my local system and a newer Homestead that supported multiple PHP versions.)

So my question now is, how can I regenerate composer.lock with a dependency set that's compatible with PHP 5.6?

(Also, how does it work with Homestead and sites you have set to PHP 5.6? When I SSH into the vagrant box, and cd into the project folder php -v yields PHP 7.1. Is it only when serving the website that PHP5.6 is used?)

-Thom

04 May
2 years ago

thomthom left a reply on DatabaseMigrations Vs DatabaseTransactions

Ah nice - I had not seen that video. That described things perfectly.

thomthom started a new conversation DatabaseMigrations Vs DatabaseTransactions

I have been using DatabaseMigrations with a in memory sqlite db for my tests on this project of mine. However, I need to switch to MySQL as I need some SQL features that sqlite doesn't support.

With MySQL, is it better to use DatabaseTransaction? (Get the impression of migrations with MySQL is heavier than sqlite...)

01 May
2 years ago

thomthom left a reply on Redirect And Preserve Anchor?

That's what I had used, though I was focused only on my test:

$this->get("subd/manual/1.0/subdivision#errors")
        ->assertRedirectedTo("subd/manual/subdividing#errors");

And that didn't work. But I see in the browser that the anchor is preserved. So I guess I just need to capture the anchor differently in my test.

30 Apr
2 years ago

thomthom started a new conversation Redirect And Preserve Anchor?

I want to set up a permanent redirect route that preserves the anchor. Any suggestions on how to do that?

30 Mar
2 years ago

thomthom left a reply on Being Notified With Key Of Sub-property Changed?

Got a solution from StackOverflow: http://stackoverflow.com/questions/43111015/being-notified-with-key-of-sub-property-changed/43120313#43120313

var vm = new Vue({
  el: '#app',
  data: {
    options: {
      a: 1,
      b: 2,
      c: 3
    }
  },
  created() {
    for (const k of Object.keys(this.options)) {
      this.$watch(`options.${k}`, (newVal, oldVal) => this.optionWatcher(k, newVal, oldVal));
    }
  },
  methods: {
    optionWatcher(key, newVal, oldVal) {
      console.log(`Updated ${key} from ${oldVal} to ${newVal}`);
    }
  }
});