This has been an ongoing problem for a long time now. If I was to ever quit Teamviewer, it would cease to reopen, and instead, just give me a prompt saying “TeamViewer is trying to install a new helper tool”.
Today, I finally discovered the answer to my troubles, and hopefully a solution that will work.
Following on from my recent MYSQL DB, it’s one thing to back up the data, but you have to get the data off the server.
So, with my trusty Raspberry pi, that is going to use considerable less power than my NAS (which has been used for VMs to do this), it’s now time to get some scripts working on the pi to do the offline/off server backups.
The biggest problem is finding a solution to download the data securely. It’s easy to use plain FTP, which is not secure, but I need to have SFTP.
So, as it turns out, there is a program called sftp built in to the pi.
I went down the path of using sshpass. My FTP password has to be saved somewhere, and as it’s only for SQL backups, I’m not too concerned.
You have a few options other than using public key authentication. I have take this example from here.
Use sshpass (less secured but probably that meets your requirement)
If you decide to give sshpass a chance here is a working script snippet to do so:
You should copy all of this in to a script.sh file.
sshpass -e sftp -P PORTNUMBER -oBatchMode=no -b - sftp-user@remote-host <<!
Please note the PORTNUMBER there. It has also be a capital for it to work.
Create a backup user in mysql/mariadb like the following:
# /usr/bin/mysql -uroot -p
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 253404
Server version: 5.1.54-1ubuntu4 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> GRANT LOCK TABLES, SHOW VIEW, SELECT ON *.* TO 'backupsonly'@'%' IDENTIFIED BY 'P@$$w0RD';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Then, create a script “my_backup.conf” that has the following in it:
Then, run the following script to export the data.
Secondly, if you are trying to install it on a Windows 7 computer, like I was, your first hurdle will be having the correct version of Powershell. Mine came with version 2, so, I needed to find version 3 – as a minimum.
There’s 4 files to download (plus a readme). You’ll need either the x86, or the x64 files. Only one of them installed for me, because my system said that I didn’t need or was applicable for my computer.
After a restart, and checking I had the correct version by running in powershell:
It gave me a basic centos install. You can try this if you like, but there’s a big downside, because you’ll still have to install everything else that goes with it, such as php, mysql, apache/nginx as well. So, follow a little further below, and I’ll show you a setup out of the box.
vagrant init bento/centos-7.3
After about 10 minutes or so, it’ll download everything. eg:
Volume in drive C is WINDOWS
Volume Serial Number is 4XXX-XXXX
Directory of C:\vagrant
15/10/2018 03:35 PM <DIR> .
15/10/2018 03:35 PM <DIR> ..
15/10/2018 03:38 PM <DIR> centos
0 File(s) 0 bytes
3 Dir(s) 347,443,544,064 bytes free
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/centos-7.3' could not be found. Attempting to find and i
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'bento/centos-7.3'
default: URL: https://vagrantcloud.com/bento/centos-7.3
==> default: Adding box 'bento/centos-7.3' (v201708.22.0) for provider: virtualb
default: Downloading: https://vagrantcloud.com/bento/boxes/centos-7.3/versio
default: Progress: 43% (Rate: 614k/s, Estimated time remaining: 0:05:35)
After working on a web app for many years, of which has been functioning well in various production and dev environments with no changes to the mysql config, I came across a problem yesterday where I couldn’t perform a query because I had the “Group By” statement in the query. See here for more details.
I solved the problem by editing /etc/mysql/mysql.conf.d/mysqld.cnf
I added the following line to the bottom of the config file.
After many hours of using Ionic to create “the perfect app” that compiled and functioned as expected, I was nearly ready to launch.
However that all changed almost overnight.
I had started out using Ionic 3, as what the original install had put on my system. Everything worked fine. As I progressed and installed more and more NPM modules, it still seemed to function ok, even with the various dependencies.
Until, I decided to upgrade my laptop to Ionic version 4. I’d read about how simple it was to upgrade and so I thought, “why not”. Sadly, what followed was a series of problems, which made the app un-usable, to the point where it wouldn’t compile and builds were failing.
In this process, I had also updated to XCode 10. This proved to also be another problem in it self, because not all of the modules I’m using are compatible with it.
Cordova is currently incompatible with Xcode 10’s new build system. For a workaround, please see this post
Because of changes to Xcode’s build process, this results in the embedded.mobileprovision file not being attached to your app bundle. This breaks push notifications – it will cause Mismatched User errors.
I’ve had strange error messages such as
“Ionic 3: Build in “prod” mode: Cannot find module “.” Yep, a module called ‘.’… This was only discovered after building my code for xcode, and then observing a white empty background (and like here) in my newly built app for my iphone. What was the cause? I have no idea – still… but, I was getting some interesting errors (and others like it) from OneSignal in the XCode build notes:
OneSignal has detected that your application delegate implements a deprecated method (application:didReceiveLocalNotification:). Please note that this method has been officially deprecated and the OneSignal SDK will no longer call it. You should use UNUserNotificationCenter instead…
Other errors such as this were also common:
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
CordovaError: Promise rejected with non-error: 'ios-deploy was not found. Please download, build and install version 1.9.2 or greater from https://github.com/phonegap/ios-deploy into your path, or do \'npm install -g ios-deploy\''
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)
at process._tickCallback (internal/process/next_tick.js:188:7)
[ERROR] An error occurred while running cordova build ios (exit code 1).
So, after a lot of message, It was time to downgrade the app back to Ionic version 3.20.0. Josh Morony does an excellent job at saying how to upgrade your app, but, I’ve got to be honest, this is a really crazy thing the Ionic team have proposed to do. You basically have to recreate your entire project and copy and paste and make it work again. a whole days work (and probably some more) just to have the same functionality… I can’t see it being worth it just yet.
I have no plans on touching version 4 yet – for a long time, as doing so, will break the entire build environment. In upgrading this, I also experienced NPM dependency hell as they call it. It was not fun.
I’m going back to running c4i App. V3 for the time being.
You may need this command at some stage too:
npm cache clean --force
This list is compatible with each other:
Since the “upgrade”, and then “downgrade”, this list allows for the build to go ahead, but still isn’t enough to solve the white screen of death in my app on iOS under “prod”.
I have an iOS build script for production and XCODE testing:
# BUILDING FOR IOS
ionic cordova platform remove ios
ionic cordova platform add ios
#ionic cordova platform update email@example.com
#ionic cordova platform update firstname.lastname@example.org
ionic cordova build ios --prod
#ionic cordova build ios --prod --buildFlag="-UseModernBuildSystem=0"
#Open XCode for building and creating
My Android script is a little more complicated, but also works:
ionic cordova platform rm android
#ionic cordova platform add android
#cordova platform add android --save
ionic cordova platform add email@example.com
ionic cordova build android --prod --release --debug
#keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.jks platforms/android/build/outputs/apk/release/android-release-unsigned.apk my-alias
cp ~/Library/Android/sdk/build-tools/27.0.3/zipalign platforms/android/build/outputs/apk/release/
./zipalign -v 4 android-release-unsigned.apk app_name.apk
#copy to dropbox
# cp app_name.apk /Volumes/Creative2HD/DropBox/Dropbox/
So, as you read this, I’m still content to battle through and make this work, it’s just the observations I’ve had. I’ll continue to use Ionic, but will be lightly treading. If there is a way to sandbox each install or ionic version, I’d be very happy to know how. Does Vagrant, or Droplet type thing allow for this kind of Ionic development? I have no idea… but to spin up a VM would be crazy. Surely there’s another way…
I’m currently redownloading XCode version 9 from the Apple Developer site in an effort to downgrade the program. Hopefully this will solved all problems and I’ll be back again to normal and it will build correctly.
If it ain’t broke, don’t fix it.
This is my current build environment. It’ll probably change though:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
cordova (Cordova CLI) : 8.1.1 (firstname.lastname@example.org)
@ionic/app-scripts : 3.2.0
Cordova Platforms : android 6.4.0 ios 4.5.5
Ionic Framework : ionic-angular 3.9.2
Node : v8.11.1
npm : 6.4.1
OS : macOS High Sierra
ANDROID_HOME : not set
backend : pro
Now, it’s time to install Xcode 9 and see if she will compile and deploy.
So, now that I’ve spent half the day sorting this out, I’ve managed to get the app to compile – eventually, and remove the white screen of death.
Strangely enough, this was only happening on the –prod builds.
To actually diagnose this a little better, I added the browser platform and then tried to run it there. Well, the browser –prod –release platform actually shows more error messages, than Safari. This proved to be very helpful, as it it turned out that typescript or more specific @angular/cli was missing or had the wrong version.
Now, it’s time to get the Android platform to build successfully again for deployment.
Make sure you have the correct Android SDKs installed. I’m using version 27.0.3
brew install gradle
There is also a problem with brew and using gradle on High Sierra.
After you have done this and it’s working for you, the first time it runs, it’ll download a lot of necessities. Wait, and it’ll eventually load/compile.
I guess that in doing this, you really only ever set up a dev environment once, and then from there, you move on. This is a crazy ride, but I’m getting there.
As a side note, always, always, always, have your source code in a source control repository of some sort. I like Git, and use it with SourceTree and their remote git platform. It’s free for closed source and small projects.