Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build instructions #18

Closed
kinow opened this issue Jul 23, 2020 · 68 comments
Closed

Build instructions #18

kinow opened this issue Jul 23, 2020 · 68 comments

Comments

@kinow
Copy link
Contributor

kinow commented Jul 23, 2020

Hi @pmkruyen

Could you point to the building instructions, please? There are two folders with package.json, and running yarn install should probably download the dependencies. But given these are cordova/phonegap projects, I believe I would need some dependencies installed (node, npm/yarn, cordova, etc).

Would you have it available anywhere, please?

Related to JOSS paper review: openjournals/joss-reviews#2506

Thanks
Bruno

@pmkruyen
Copy link
Owner

Hi Bruno,

So far, I have used the PhoneGap Desktop App to build the app locally (so downloading DearScholar, and opening this project using in the PhoneGap Desktop App should work). [Also see, "Guide for potential contributors and academic researchers" in the readme file].

When this doesn't work or you want more specific building instructions, please let me know.

An option is to write a small program that installs the Desktop App, php, MySQL, and myPhPadmin locally?

Best, Peter

@kinow
Copy link
Contributor Author

kinow commented Jul 23, 2020

Hi Peter,

I will have to check how to use phonegap, to remind me how to install and run it. But it would be simpler if there were build instructions.

Here's an example of Annif, a Python backend that includes a small JS frontend. There is also a Dockerfile that can be used for both building instructions, or to run the application locally.

Or this other project that contains both detailed installation instructions (points to another page) and how to run the application with docker.

Perhaps you could just say something like:

  • Download phonegap (does it work with any version?)
  • Run the following commands for the Android folder
  • Run the following commands for the App folder (not sure if there's any order)
  • To run locally, then run the Android emulator pointing to a certain file/apk
  • Access the application in the URL http://..., etc

Having a Docker container is convenient, but I think the installation instructions are more important. Especially if there are any limitations (OS version, system library, etc).

For example, there is at least one PHP script using mysql_error function. I think it was removed in PHP 7? I am planning to confirm that later, but perhaps if you could take a look at the version of the software required, that'd be easier.

Cheers
Bruno

@pmkruyen
Copy link
Owner

Hi Bruno,

Thanks for these detailed suggestions. Very much appreciated. I will give priority to this issue--that is, provide more detailed installation instructions and check docker, which I have never used--and solve issue #20 next.

Best,
Peter

PS. Thanks for point out this inconsistency with the PHP script, will check all this. For your information I use PHP 7.2.24 and mysql Ver 14.14 on Ubuntu. I will include this in the instructions too.

@kinow
Copy link
Contributor Author

kinow commented Jul 23, 2020

Perfect Peter! I could be wrong on the PHP/MySQL issue.

Very interested to see what DearScholar looks like running it locally while reading the code to understand how it works :-)

Cheers
Bruno

@pmkruyen
Copy link
Owner

Thanks :) ... All feedback is very welcome.

@pmkruyen
Copy link
Owner

Hi Bruno,

To give you an update on the installation instructions.

I am able to build a Docker image of the server (using this repro: https://github.com/jcavat/docker-lamp) and storing it on Docker Hub. However, when I download the image and try to restart it, it does not work (the admin panel does not show up at any port on my Mac and neither can I reach the php file). Once I have solved this issue, I will write clear installation instructions.

Best,
Peter

@kinow
Copy link
Contributor Author

kinow commented Jul 24, 2020

Hi Peter!

Really impressed! You mentioned your daily job was not writing code. I was going to comment here saying that preparing an image for Docker could be difficult. But looks like you are already doing great progress!

If you'd like to get a small container size, take a look at the Docker best practices doc. It's probably a ~20-40 minutes article, but may be helpful in case you ever need to use other images that appear to be too large.

Cheers
Bruno

@pmkruyen
Copy link
Owner

pmkruyen commented Jul 28, 2020

Hi Bruno,

Thanks for your help.

Over the weekend I wrote the installation instructions in the README.md file. I learned a lot about Docker, really helpful. Putting everything in the Docker seems ideal to me, but I thought it is best to start with writing out manual installation instructions (but using a Docker image for the server makes things a lot easier already).

Could you please have a look at these instructions, and tell me if the instructions are clear and work to launch DearScholar locally?

Thanks,
Peter

(Note. I also corrected some minor errors and updated some procedures in the sample-study set up files.)

@kinow
Copy link
Contributor Author

kinow commented Jul 28, 2020

Hi Peter!

Reading the new documentation, really helpful! Thanks!

Prepared a PR #23 with some suggestions, feel free to discard/suggest any edits.

I've got phonegap installed now with yarn global add phonegap, and can run it with npx phonegap build, or npx cordova build. So I tried:

  • cd App
  • npx cordova platform add android
  • npx cordova build android --verbose

Next, I would run npx cordova run android, but the build command failed:

Wrote out android application name "DearScholar" to /home/kinow/Development/javascript/workspace/dearscholar/App/platforms/android/app/src/main/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.4832): 14832
Wrote out Android package name "net.peterkruyen.diary" to /home/kinow/Development/javascript/workspace/dearscholar/App/platforms/android/app/src/main/java/net/peterkruyen/diary/MainActivity.java
Updating icons at platforms/android/app/src/main/res
Updating splash screens at platforms/android/app/src/main/res
Updating resource files at platforms/android
Source path does not exist: google-services.json
Error: Source path does not exist: google-services.json
    at updatePathInternal (/home/kinow/Development/javascript/workspace/dearscholar/App/node_modules/cordova-common/src/FileUpdater.js:132:19)
    at /home/kinow/Development/javascript/workspace/dearscholar/App/node_modules/cordova-common/src/FileUpdater.js:210:19
    at Array.forEach (<anonymous>)
    at Object.updatePaths (/home/kinow/Development/javascript/workspace/dearscholar/App/node_modules/cordova-common/src/FileUpdater.js:208:33)
    at updateFileResources (/home/kinow/Development/javascript/workspace/dearscholar/App/platforms/android/cordova/lib/prepare.js:654:17)
    at /home/kinow/Development/javascript/workspace/dearscholar/App/platforms/android/cordova/lib/prepare.js:66:9
    at _fulfilled (/home/kinow/Development/javascript/workspace/dearscholar/App/node_modules/q/q.js:854:54)
    at /home/kinow/Development/javascript/workspace/dearscholar/App/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/home/kinow/Development/javascript/workspace/dearscholar/App/node_modules/q/q.js:816:13)
    at /home/kinow/Development/javascript/workspace/dearscholar/App/node_modules/q/q.js:624:44

Do you know what I am missing, @pmkruyen, please? Tried that on the other Android directory, but had a similar issue.

Thanks!

@pmkruyen
Copy link
Owner

Thanks for testing.

O... I understand, the google-services.json file is missing. I did not upload it because it contains sensitive data (needed for sending push notifications to Android devices).

I have uploaded a sample google-services.json file in the App and Android26 file. This fixed the error on my machine. Can you let me know if this works for you too?

Thanks,
Peter

PS. Also thanks for showing me how you build the app on the command line :)

@kinow
Copy link
Contributor Author

kinow commented Jul 28, 2020

Thanks for the google-services.json file. It appears to have fixed my error. We are doing good progress I think!

Next error:

Updating resource files at platforms/android
  copy  google-services.json platforms/android/app/google-services.json (new file)
Prepared android project successfully
Executing script found in plugin cordova-plugin-add-swift-support for hook "after_prepare": plugins/cordova-plugin-add-swift-support/src/add-swift-support.js
Cannot find module 'xcode'
Require stack:
- /home/kinow/Development/javascript/workspace/dearscholar/Android26/plugins/cordova-plugin-add-swift-support/src/add-swift-support.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/plugman.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/node_modules/cordova-lib/cordova-lib.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/src/help.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/src/cli.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/bin/cordova
Error: Cannot find module 'xcode'
Require stack:
- /home/kinow/Development/javascript/workspace/dearscholar/Android26/plugins/cordova-plugin-add-swift-support/src/add-swift-support.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/plugman.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/node_modules/cordova-lib/cordova-lib.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/src/help.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/src/cli.js
- /home/kinow/.npm/_npx/16912/lib/node_modules/cordova/bin/cordova
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:713:15)
    at Function.Module._load (internal/modules/cjs/loader.js:618:27)
    at Module.require (internal/modules/cjs/loader.js:771:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (/home/kinow/Development/javascript/workspace/dearscholar/Android26/plugins/cordova-plugin-add-swift-support/src/add-swift-support.js:20:15)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Module.require (internal/modules/cjs/loader.js:771:19)

Would that xcode refer to Xcode as in the Apple Xcode? 😕

@pmkruyen
Copy link
Owner

pmkruyen commented Jul 28, 2020

Hi Bruno,

Thanks for super fast testing!

Euhm.. I have not seen this error before (likely because I used the phonegap compiler online?). Yes, it has to do with Apple Xcode and cordova-plugin-add-swift-support.

I found some resources online. I will try to replicate your error tonight, and find out whether the solution proposed in Discussion 1 does the trick.

Discussion 1 --> npm install --save xcode

Discussion 2

Discussion 3

Discussion 4

Thanks for your patience and effort.

Best,
Peter

PS. For Android, I realise, it should be possible to drop this Cordova swift plugin from config.xlm without running into troubles.

@kinow
Copy link
Contributor Author

kinow commented Jul 28, 2020

Thanks @pmkruyen , calling it a day now. But can test it again tomorrow. I forgot to say what's my environment, sorry.

I am on Ubuntu 18.04.4 LTS 👍 just in case that's helpful. Cheers

@pmkruyen
Copy link
Owner

Hi Bruno, good morning ... :), I received the error too. To solve this, I did:

npm install --save xcode

sudo cordova platform rm android

cordova platform add android

(Note, I used cordova-android@^8.0.0)

@pmkruyen
Copy link
Owner

Can you then test the app now with cordova run android? I cannot install Android SDK at the moment due to limited space on my MacBook, but if you receive further errors, I will make some room and go for it.

Best,
Peter

@kinow
Copy link
Contributor Author

kinow commented Jul 29, 2020

I think I will look for alternative documentation for the Android SDK on Ubuntu. Here's what I followed: https://medium.com/michael-wallace/how-to-install-android-sdk-and-setup-avd-emulator-without-android-studio-aeb55c014264

With these instructions:

mkdir -p ~/Android/Sdk
export ANDROID_HOME=~/Android/Sdk
export ANDROID_SDK_ROOT=~/Android/Sdk
export ANDROID_AVD_HOME=~/.android/avd
mkdir ~/Android/Sdk/cmdline-tools
mv tools/ ~/Android/Sdk/cmdline-tools/
cd ~/Android/Sdk/cmdline-tools/tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/tools:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/platform-tools
sdkmanager --licenses
sdkmanager --update
[=======================================] 100% Computing updates...
sdkmanager --list
sdkmanager emulator "system-images;android-28;default;x86" "platform-tools" "platforms;android-28" "build-tools;28.0.3"
avdmanager create avd --name android28 --package "system-images;android-28;default;x86"
cd ~/Development/javascript/workspace/dearscholar/App/
yarn add xcode
npx cordova platform rm android
npx cordova platform add android
npx cordova run android

But got the following:

npx: installed 432 in 13.892s
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/kinow/Android/Sdk (recommended setting)
ANDROID_HOME=/home/kinow/Android/Sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :CordovaLib:checkDebugManifest UP-TO-DATE
> Task :CordovaLib:processDebugManifest UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :CordovaLib:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :CordovaLib:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript UP-TO-DATE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :CordovaLib:compileDebugRenderscript UP-TO-DATE
> Task :CordovaLib:generateDebugBuildConfig UP-TO-DATE
> Task :CordovaLib:generateDebugResValues UP-TO-DATE
> Task :CordovaLib:generateDebugResources UP-TO-DATE
> Task :CordovaLib:packageDebugResources UP-TO-DATE
> Task :CordovaLib:generateDebugRFile UP-TO-DATE
> Task :CordovaLib:prepareLintJar UP-TO-DATE
> Task :CordovaLib:generateDebugSources UP-TO-DATE
> Task :CordovaLib:javaPreCompileDebug UP-TO-DATE
> Task :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
> Task :CordovaLib:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:writeDebugApplicationId UP-TO-DATE

> Task :app:processDebugGoogleServices
Parsing json file: /home/kinow/Development/javascript/workspace/dearscholar/Android26/platforms/android/app/google-services.json

> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugResources UP-TO-DATE
> Task :app:compileDebugJavaWithJavac UP-TO-DATE
> Task :app:compileDebugNdk NO-SOURCE
> Task :app:compileDebugSources UP-TO-DATE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders UP-TO-DATE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :CordovaLib:mergeDebugShaders UP-TO-DATE
> Task :CordovaLib:compileDebugShaders UP-TO-DATE
> Task :CordovaLib:generateDebugAssets UP-TO-DATE
> Task :CordovaLib:packageDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:signingConfigWriterDebug UP-TO-DATE
> Task :app:transformClassesWithDexBuilderForDebug UP-TO-DATE
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug UP-TO-DATE
> Task :app:transformDexArchiveWithDexMergerForDebug UP-TO-DATE
> Task :app:mergeDebugJniLibFolders UP-TO-DATE
> Task :CordovaLib:compileDebugNdk NO-SOURCE
> Task :CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
> Task :CordovaLib:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
> Task :CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug UP-TO-DATE
> Task :app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
> Task :app:packageDebug UP-TO-DATE
> Task :app:assembleDebug UP-TO-DATE
> Task :app:cdvBuildDebug UP-TO-DATE

BUILD SUCCESSFUL in 1s
44 actionable tasks: 1 executed, 43 up-to-date
Built the following apk(s): 
	/home/kinow/Development/javascript/workspace/dearscholar/Android26/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/kinow/Android/Sdk (recommended setting)
ANDROID_HOME=/home/kinow/Android/Sdk (DEPRECATED)
No target specified and no devices found, deploying to emulator
No emulator specified, defaulting to android26
Waiting for emulator to start...
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/home/kinow/Android/Sdk]!

Tried unsetting the env-var as recommended by some StackOverflow messages, changing to parent directory, but no luck so far.

Will keep trying until the weekend, when I should have more time to troubleshoot it.

Bruno

@pmkruyen
Copy link
Owner

Hi Bruno,

Thanks for trying and the docs. I am going to give it try as well tonight to fix the Broken AVD system path error. Almost there!

Peter

What I note is that you are in the Android26 folder (for Android 8.0 and 8.5), not in the App folder (for higher Android versions). I do not think this causes the issue, but is something to take into consideration when testing.

@kinow
Copy link
Contributor Author

kinow commented Jul 29, 2020

What I note is that you are in the Android26 folder (for Android 8.0 and 8.5), not in the App folder (for higher Android versions). I do not think this causes the issue, but is something to take into consideration when testing.

Same issue. Logged in again to try that as I thought that was a really good guess! But the problem must be somewhere else. Almost!

Thanks Peter!

@kinow
Copy link
Contributor Author

kinow commented Jul 29, 2020

@pmkruyen found a post after I sent this message, saying for the SDK I needed now to have a different directory structure.

image

So moving the tools under a newly created cmdline-tools directory, and re-doing the steps, everything appears to work.

image

The UI is blank, but I assume that's because I don't have the backend running.

Next step will be to create a container with PHP + Apache to run these scripts, start them mapping a port like 8000 or 8080, and then finally find out how to tell the UI to point to the local backend.

🤞

I hope you didn't start downloading the SDK (or freeing up space for that).

Thanks
Bruno

@pmkruyen
Copy link
Owner

Hi Bruno,

👍 super cool! Will try to replicate your steps.

I have downloaded the command line tools too; but cannot see the other files. I assume that you generated those other files using the steps in the tutorial you posted above?

I am glad the logo is there, but the empty screen worries me somewhat, seems that the app does not pass the splash screen?
Even without the backend running, the login screen should appear:

Screenshot 2020-07-29 at 15 15 58

We will find out :)

@kinow
Copy link
Contributor Author

kinow commented Jul 30, 2020

Tried npx cordova platform add browser. Then after re-building the project, it looks like it now launches the browser for me. I see a blank page on the browser too, but at least I have access to the browser console logs.

Failed to load resource: the server responded with a status of 404 (Not Found)
index.html:1 Refused to load the font 'data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAA0sABAAAAAAGRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAANEAAAABoAAAAci1jrz0dERUYAAAsIAAAAIwAAACQAfQBXR1BPUwAADOAAAAAuAAAANuAY7+xHU1VCAAALLAAAAbMAAAQuAxQJ5U9TLzIAAAHcAAAASgAAAGBRKF+WY21hcAAAAowAAACIAAABYt6F0cBjdnQgAAADFAAAAAQAAAAEABEBRGdhc3AAAAsAAAAACAAAAAj//wADZ2x5ZgAAA6wAAASlAAAKBIq7ZiloZWFkAAABbAAAADAAAAA2FnYC32hoZWEAAAGcAAAAIAAAACQHgQM9aG10eAAAAigAAABhAAABJC+cAAFsb2NhAAADGAAAAJQAAACURlRI+G1heHAAAAG8AAAAHwAAACAAjwBMbmFtZQAACFQAAAFTAAAC2WC6Sihwb3...Waf2kkqBh38XlYmEKKCptdwpiLnWGOyT4XxSyu8Yg3fOJHmaqsGupWPat39aG+1B+uqE7xndPnM77oMZQ0nufulNG8SieTW7cV0CW0s4xPV+c9vboScj7NQkDjdmcRK2CFukG+bMV5QOGv4CLXQTGE3+3ycUzr7lR8PlfZgUEZzjAaOGv7WusywawHAaZXw2WMBKKJwz3OZLCaMl9V9v+CHpM6epFvVGtKVCX6Xg65G6SQ+McY8vCCyXSv85YyrRZ9W3QV03vbQZx6iZ3sZ5ETJ6xVkfGlgs7UOvwmM8UYXZAeHiZSYx9vOMkveMU+YyT1+Thv7e3FEStU5rkcFZIlx6/UZceHZ7hW6KTKyrlj2Rlr+r4OKve9ZDUlhzNZ23TWQ+yKiNM4dxmdt/APtJZExAB42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPpmTaIhjAYAPREFnQAA' because it violates the following Content Security Policy directive: "default-src * gap://ready file:". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

index.html:1 Refused to load the font 'data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAYQAA0AAAAAEcQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAF9AAAABkAAAAciVvoDU9TLzIAAAGcAAAASwAAAGBRtV1jY21hcAAAAfwAAAC8AAABamglddJjdnQgAAACuAAAAAQAAAAEABEBRGdhc3AAAAXsAAAACAAAAAj //wADZ2x5ZgAAA2wAAACUAAAJjHCzhiRoZWFkAAABMAAAAC4AAAA2ERr/HWhoZWEAAAFgAAAAGgAAACQC8ADFaG10eAAAAegAAAATAAAAtAMAABFsb2NhAAACvAAAAK4AAACuaNBmhG1heHAAAAF8AAAAHwAAACAAmgA5bmFtZQAABAAAAAFQAAACuLf6wytwb3N0AAAFUAAAAJkAAADOCKMIc3jaY2BkYGAA4lUx8ibx/DZfGbiZGEDgRu39AAT9/wAjA+MBIJeDASwNA...ucYGGwxgYFJGdeos8cQWGICQbkGCkSrOjKGJbKgu6EVOoZ7zCuilm+P1mz3hSyt+zLSA0nAxmnycpkxsrFJrFpku3Nis57NpetGkcOYbHFGAEOzJqXao6SY0ebTTJ9zO12HBy2OtVFTvGX66c0d0LhsuVO2m0ScheJKeN/z1beESuRi+pPYJ7vinlu11pGoZJT+cdwVEdBFJSbn7djzLql1/iBlBsidLlcBrG2B8MHlRqGSil51nPfEi6AO3jaXc5ZM4IBAEbhp9RF1FhCRbmyVNYskSXG0CaEQvaf2j/LN112bt6Zc/HOETZiOJAJJmSc15ENmxARFTNpSlzCtBmz5iTNW7AoJR08LFmWlbNi1Zp1G/IKijZt2bZj156SfQcOHSk7dqLi1JlzF6ouXbl241ZNXUNTy522ew8edTx59qKrF3S9edf34dOXbz9+/f0DgycTFgAAAAAAAAH//wACeNpjYGBgZACCGwmaOWC69n4AjAYARC0G1wAAAA==' because it violates the following Content Security Policy directive: "default-src * gap://ready file:". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

index.html:1 Refused to load the font 'data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3...OnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA' because it violates the following Content Security Policy directive: "default-src * gap://ready file:". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

push.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
index.html:191 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-CUPKKN3LYwY1ckaKpLcmswfJvloqI4w9m9bQBB+pn28='), or a nonce ('nonce-...') is required to enable inline execution.

Fingerprint.js:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
cordova.js:1182 Uncaught Error: Module cordova-plugin-fingerprint-aio.Fingerprint does not exist.
    at addEntry (cordova.js:1182)
    at Object.exports.clobbers (cordova.js:1192)
    at onScriptLoadingComplete (cordova.js:1335)
    at scriptLoadedCallback (cordova.js:1368)
    at HTMLScriptElement.<anonymous> (cordova.js:1322)
index.html:1 Refused to load the font 'data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAA0sABAAAAAAGRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAANEAAAABoAAAAci1jrz0dERUYAAAsIAAAAIwAAACQAfQBXR1BPUwAADOAAAAAuAAAANuAY7+xHU1VCAAALLAAAAbMAAAQuAxQJ5U9TLzIAAAHcAAAASgAAAGBRKF+WY21hcAAAAowAAACIAAABYt6F0cBjdnQgAAADFAAAAAQAAAAEABEBRGdhc3AAAAsAAAAACAAAAAj//wADZ2x5ZgAAA6wAAASlAAAKBIq7ZiloZWFkAAABbAAAADAAAAA2FnYC32hoZWEAAAGcAAAAIAAAACQHgQM9aG10eAAAAigAAABhAAABJC+cAAFsb2NhAAADGAAAAJQAAACURlRI+G1heHAAAAG8AAAAHwAAACAAjwBMbmFtZQAACFQAAAFTAAAC2WC6Sihwb3...Waf2kkqBh38XlYmEKKCptdwpiLnWGOyT4XxSyu8Yg3fOJHmaqsGupWPat39aG+1B+uqE7xndPnM77oMZQ0nufulNG8SieTW7cV0CW0s4xPV+c9vboScj7NQkDjdmcRK2CFukG+bMV5QOGv4CLXQTGE3+3ycUzr7lR8PlfZgUEZzjAaOGv7WusywawHAaZXw2WMBKKJwz3OZLCaMl9V9v+CHpM6epFvVGtKVCX6Xg65G6SQ+McY8vCCyXSv85YyrRZ9W3QV03vbQZx6iZ3sZ5ETJ6xVkfGlgs7UOvwmM8UYXZAeHiZSYx9vOMkveMU+YyT1+Thv7e3FEStU5rkcFZIlx6/UZceHZ7hW6KTKyrlj2Rlr+r4OKve9ZDUlhzNZ23TWQ+yKiNM4dxmdt/APtJZExAB42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPpmTaIhjAYAPREFnQAA' because it violates the following Content Security Policy directive: "default-src * gap://ready file:". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

index.html:1 Refused to load the font 'data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAYQAA0AAAAAEcQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAF9AAAABkAAAAciVvoDU9TLzIAAAGcAAAASwAAAGBRtV1jY21hcAAAAfwAAAC8AAABamglddJjdnQgAAACuAAAAAQAAAAEABEBRGdhc3AAAAXsAAAACAAAAAj //wADZ2x5ZgAAA2wAAACUAAAJjHCzhiRoZWFkAAABMAAAAC4AAAA2ERr/HWhoZWEAAAFgAAAAGgAAACQC8ADFaG10eAAAAegAAAATAAAAtAMAABFsb2NhAAACvAAAAK4AAACuaNBmhG1heHAAAAF8AAAAHwAAACAAmgA5bmFtZQAABAAAAAFQAAACuLf6wytwb3N0AAAFUAAAAJkAAADOCKMIc3jaY2BkYGAA4lUx8ibx/DZfGbiZGEDgRu39AAT9/wAjA+MBIJeDASwNA...ucYGGwxgYFJGdeos8cQWGICQbkGCkSrOjKGJbKgu6EVOoZ7zCuilm+P1mz3hSyt+zLSA0nAxmnycpkxsrFJrFpku3Nis57NpetGkcOYbHFGAEOzJqXao6SY0ebTTJ9zO12HBy2OtVFTvGX66c0d0LhsuVO2m0ScheJKeN/z1beESuRi+pPYJ7vinlu11pGoZJT+cdwVEdBFJSbn7djzLql1/iBlBsidLlcBrG2B8MHlRqGSil51nPfEi6AO3jaXc5ZM4IBAEbhp9RF1FhCRbmyVNYskSXG0CaEQvaf2j/LN112bt6Zc/HOETZiOJAJJmSc15ENmxARFTNpSlzCtBmz5iTNW7AoJR08LFmWlbNi1Zp1G/IKijZt2bZj156SfQcOHSk7dqLi1JlzF6ouXbl241ZNXUNTy522ew8edTx59qKrF3S9edf34dOXbz9+/f0DgycTFgAAAAAAAAH//wACeNpjYGBgZACCGwmaOWC69n4AjAYARC0G1wAAAA==' because it violates the following Content Security Policy directive: "default-src * gap://ready file:". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

index.html:1 Refused to load the font 'data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3...OnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA' because it violates the following Content Security Policy directive: "default-src * gap://ready file:". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

cordova.js:1063 deviceready has not fired after 5 seconds.
cordova.js:1056 Channel not fired: onPluginsReady
cordova.js:1056 Channel not fired: onCordovaReady

Maybe this is the error?

index.html:191 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-CUPKKN3LYwY1ckaKpLcmswfJvloqI4w9m9bQBB+pn28='), or a nonce ('nonce-...') is required to enable inline execution.

@pmkruyen
Copy link
Owner

Hi Bruno,

Android emulator
Sorry, it did not succeed in getting the Android version running on a the emulator. I am halfway the tutorial.

Browser
Yes, I have noticed this behavior too (see the readme file) caused by cordova-plugin-fingerprint-aio. Can you check if this module has been added to the plugins folder (browser --> platform_www --> plugins).

Have you installed / use the PhoneGap desk emulator as specified in the installation instructions? When I pull the project from Github, and (re)open the app folder in this emulator, I did the following:

Note. In your browser, the login screen should show the login button with the label 'Log in met PIN'. When the login button has the label 'Log in', the cordova-plugin-fingerprint-aio has not loaded correctly. Also, in this case, the browser console displays the error "Fingerprint is not defined". In this case, you cannot login to DearScholar. To solve this issue, grab a cup of coffee, wait a few minutes, and 'Force Reload' the browser window.

Does this work for you too?

@kinow
Copy link
Contributor Author

kinow commented Jul 30, 2020

I'm having problems now to start the Android emulator. Removed the browser platform, but no luck. But I did find some posts, that suggest this could be the problem??

<access origin="https://peterkruyen.net/*" />

It appears to define security permissions only for that domain @pmkruyen ? Could that be the problem?

Bruno

@pmkruyen
Copy link
Owner

Hi Bruno,

Android

I set the restrictions because of iOS restrictions, but I don't think that should be the problem because you would still see the login screen. For testing, you can remove it.

Browser
Let me know whether my suggestions above solved the loading issues.

Thanks for your help.
Peter

@kinow
Copy link
Contributor Author

kinow commented Jul 30, 2020

Removed the domain restriction, using https://*/* and another entry for http://*/*. No difference.

Used the meta entry for CSP:

<meta http-equiv="Content-Security-Policy" content="default-src data: *; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">

And it loaded most resources. The fingerprint plug-in wouldn't load, but that's not a huge issue. The push plug-in also was giving 404, so used <script type="text/javascript" src="plugins/phonegap-plugin-push/www/push.js"></script> and it appears to have been loaded fine.

Alas the browser still display a blank page. Also could't load in the emulator, same blank page 😞

@pmkruyen
Copy link
Owner

pmkruyen commented Jul 30, 2020

Sorry, we are going to solve this.

What I did:

  1. I cloned the project to my MacBook.

  2. I opened the app with PhoneGap desktop --> I see the login page with 'Log in' on port:
    http://192.168.2.15:3000/

  3. I navigated to the App directory and ran:
    cordova platform add browser

  4. The terminal shows

Using cordova-fetch for cordova-browser@^6.0.0
Adding browser project...
Creating Cordova project for cordova-browser:
	Path: /Users/peterkruyen/surfdrive/Sandra/app/git/dearscholarx/App/platforms/browser
	Name: DearScholar
Installing "cordova-plugin-add-swift-support" for browser
Installing "cordova-plugin-device" for browser
Installing "cordova-plugin-dialogs" for browser
Installing "cordova-plugin-fingerprint-aio" for browser
Installing "cordova-plugin-ionic-keyboard" for browser
Installing "cordova-plugin-ionic-webview" for browser
Installing "cordova-plugin-splashscreen" for browser
Installing "cordova-plugin-statusbar" for browser
Installing "cordova-sqlite-evcore-extbuild-free" for browser
Installing "cordova-support-google-services" for browser
Installing "phonegap-plugin-multidex" for browser
Installing "phonegap-plugin-push" for browser
Cannot find module 'xcode'
  1. I went back to http://192.168.2.15:3000/ and I see: "log in met PIN", and using the earlier created Docker, I can log in. (So even without the 'xcode' module.)

===

Did you try to open the app at the PhoneGap port http://192.168.2.15:3000/ (when you open the index page directly-- at .../git/dearscholar/App/platforms/browser/www/index.html--I see only the 'log in' button, and an error that the fingerprint is not defined)?

===

When this does not work either, I will install a docker ubuntu container and run above steps too, to find out how to solve this issue.

PS. Thanks for adding the push.js file. I excluded it because it includes information about the push notification settings (see readme), better indeed to include an empty mock file.

@pmkruyen
Copy link
Owner

My version of the PhoneGap emulator is v0.4.5 :)

@pmkruyen
Copy link
Owner

pmkruyen commented Jul 30, 2020

Optionally, when there is still the blank screen, you can remove all plugins and check what happens? Also, what happens when you try to run the hello world app?

By the way, I realise, sometimes a blank screen occurs when the javascript is broken. But that should not be the case now, because when the javascript was broken neither I would be able to start the app.

Peter

@kinow
Copy link
Contributor Author

kinow commented Jul 31, 2020

Running the instructions from readme, the MySQL container appears to get stuck and fail to start?

kinow@ranma:~/Development/javascript/workspace/dearscholar$ docker run --rm --name dearscholar -it -p "9000:9000" -v ${PWD}/App:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804
Updating for PHP 7.4
Replacing CLI php.ini values
Editing APACHE_RUN_GROUP environment variable
Editing phpmyadmin config
Setting up MySQL directories
Allowing Apache/PHP to write to the app
Allowing Apache/PHP to write to MySQL
Editing MySQL config
=> An empty or uninitialized MySQL volume is detected in /var/lib/mysql
=> Installing MySQL ...
mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)
2020-07-31T22:14:57.043288Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-07-31T22:14:57.045058Z 0 [ERROR] Aborting

=> Done!
=> Waiting for confirmation of MySQL service startup
=> Waiting for confirmation of MySQL service startup

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 1, 2020

Hi Bruno,

Thanks. We are going in the right direction. 👍 A quick reply:

Backend
I have not encountered that mysql error before. Could it be caused by specifying the username and password in the command line? I did not specify one of them, the docker created a password for the admin (or root) user. I will replicate your steps tonight.

Browser
Will look at your posts later today, will edit / clarify the instructions where needed. I will to add some instructions for Linux users based on your feedback, which I hope you can verify.

Android
I made progress yesterday evening. I will add the iOS instructions later. I can then also add some Linux instructions based on your comments and feedback.

I am now at the point to install and load an emulator. I see that I have to specify the API level of the emulator. Question: when selecting the emulator, which api level have you specified? It should be >= 28. If you choose a lower API level, the app fails.

(note. the Android26 folder includes the settings that work for api 26 and 27 [it is a small adjustment in de config.xlm file).

Best,
Peter

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 1, 2020

By the way, what happens when you delete the folder mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists) and rerun the docker?

I now see that the other issue has been solved?

EDIT: re-reading readme.md, will follow the Docker instructions that you wrote, that should fix this issue, please ignore last message @pmkruyen :) and thanks for the detailed instructions!

Peter

@kinow
Copy link
Contributor Author

kinow commented Aug 1, 2020

Thanks. We are going in the right direction. +1 A quick reply:

Agree! Good progress, we might close this issue very soon 🤞

I am now at the point to install and load an emulator. I see that I have to specify the API level of the emulator. Question: when selecting the emulator, which api level have you specified? It should be >= 28. If you choose a lower API level, the app fails.

I used 28. Initially I was trying 26, in the Android26 folder. Then after you mentioned that was only for <=26, I switched to App folder with the 28 version.

I also chose 28, because the first time I ran the npx cordova build command in the App folder, it found that I had the Android 26 installed, but instead said it needed 28, and downloaded it.

By the way, what happens when you delete the folder mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists) and rerun the docker?

My understanding is that that is not a folder on my computer,

kinow@ranma:~/Development/java/apache/commons-imaging$ file /var/lib/mysql
/var/lib/mysql: cannot open `/var/lib/mysql' (No such file or directory)

, but instead a folder in the container. And after reading the container README file, I think that we are mapping the file mysql from this repository onto /var/lib/mysql... which I think was supposed to be a folder?

I now see that the other issue has been solved?

Yup! I was trying to run a separate MySQL container. I didn't remember you had written new instructions with Docker :-)

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 1, 2020

Hi Bruno

Android
While I cannot log in yet (need to set the correct path to the local Dearscholar.php file), ... I managed to run the Android emulator... --> pass the splash screen.

I manually deleted all build files, including those in the node folder. Next, I ran cordova platform add android . Got a warning about several missing modules and had to run npm i cordova-common. And on cordova run android...

Screenshot 2020-08-01 at 17 51 42

When I the app works as expected on Android, I will update the installation instructions. Hope you can verify these instructions (for Linux).

PS. I got this warning now npm install [email protected] to resolve 1 vulnerability... will do so, hope that does not have an impact on the performance of the app. I will check whether it is also wise to upgrade ios to this version. Will let you know.

Browser
Great that it works! Will update the installation instructions. Hope you can verify these instructions these written (for Linux).

Backend
With regard to the folder, that is interesting, mine is not on the container but at /users/peterkruyen/mysql/ (so not at /var/lib/mysql?

Best,
Peter

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 1, 2020

Hi Bruno,

Browser

Can you verify the new installation instructions for the Browser [Step 6] (https://github.com/pmkruyen/dearscholar#step-6-run-dearscholar-in-a-browser)?

I deleted the old Guide for contributors section from the Readme because of the overlap with the new (and better) installation instructions.

I cannot verify / do not completely understand how you used the command google-chrome --test-type --disable-web-security --user-data-dir=/tmp/dearscholar and if/how it should be added. Suggestions are welcome :)

Best,
Peter

PS. The Android instructions will follow.

@kinow
Copy link
Contributor Author

kinow commented Aug 2, 2020

Can you verify the new installation instructions for the Browser [Step 6] (https://github.com/pmkruyen/dearscholar#step-6-run-dearscholar-in-a-browser)?

Looks good!

I deleted the old Guide for contributors section from the Readme because of the overlap with the new (and better) installation instructions.

Good idea. I wonder if the installation instructions would deserve its own page (wiki, INSTALL.md, site page, etc) someday. Just because it seems to be getting quite lengthy (not that it bothers me, on the contrary :)

I cannot verify / do not completely understand how you used the command google-chrome --test-type --disable-web-security --user-data-dir=/tmp/dearscholar and if/how it should be added. Suggestions are welcome :)

👍 for now I think the application should work with any browser. If I run into problems using the current version I will try it again and raise a PR.

@kinow kinow mentioned this issue Aug 2, 2020
@kinow
Copy link
Contributor Author

kinow commented Aug 2, 2020

@pmkruyen

The readme.md file has this line for running Docker docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804. I think it can be broken down into:

  • docker, command
  • run, subcommand
  • i, interactive
  • t, simulate tty/terminal
  • p "80:80", to map the container port 80 to the host computer's port 80
  • -v ${PWD}/app:/app, to create a volume at /app in the container that mounts the contents of the current directory $PWD /app (the App in this project); i.e. /app in the container will have the content of ./App
  • -v ${PWD}/mysql:/var/lib/mysql, to create a volume at /var/lib/mysql with the contents of the file mysql from this repository (! this is the problem I'm having, /var/lib/mysql is normally a directory)
  • mattrayner/lamp:latest-1804 container identifier, with the maintainer's ID, name of container, and the tag

The ! marks where I think we have a problem right now. If we navigate to the container's documentation at https://github.com/mattrayner/docker-lamp/blob/c3f1244fec229deaed61e94d1229ba831b1da465/README.md, it says:

The below command will run the docker image mattrayner/lamp:latest, creating a mysql/ folder within your project. This folder will be linked to /var/lib/mysql where all of the MySQL files from container lives. You will now be able to stop/start the container and keep your database changes.

See the part creating a mysql/ folder within your project, which is not what we have here.

I think this is the root cause of my current issue. We probably need to find out how we can load the contents of the file mysql into a MySQL database in that container. Then I think my browser-platform app will be able to communicate with the backend 🤞

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 2, 2020

Hi Bruno,

Good idea. I wonder if the installation instructions would deserve its own page (wiki, INSTALL.md, site page, etc) someday. Just because it seems to be getting quite lengthy (not that it bothers me, on the contrary :)

Had the same thought last night. Will do after the whole installation manual does deliver :)

Browser

Backend
Thanks for your notes and suggestions about the docker. After I am done with the instructions for the Android emulator, will start working on solving the issues with setting up the docker.

Best,
Peter

PS. Thank you for your PR!

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 3, 2020

Hi Bruno,

Great that Browser works! Thanks for your help! That is the most convenient way of testing the app.

Android
Almost there... but I cannot connect to the backend (receiving 404 errors), drives me crazy. I will give it another try tonight; or else will upload it to the installation instructions as 'work in progress'.

Backend
Meanwhile, let's get the backend running :)

There are three issues--as in, points of departure for getting the backend running 😄 )--I noticed in your comments.

Issue 1

I ran

docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804

... and the terminal shows....

Updating for PHP 7.4 Replacing CLI php.ini values Editing APACHE_RUN_GROUP environment variable Editing phpmyadmin config Setting up MySQL directories Allowing Apache/PHP to write to the app Allowing Apache/PHP to write to MySQL Editing MySQL config

.... and all works.

Inspecting your code, I see that you changed the ports and you use a capital letter "A" in app. Does that cause the problem?

What do you see when you navigate to localhost/myphpadmin in your browser? What happens when you wipe the image completely and re-install / re-initialize it?

Issue 2
To be sure: The app folder in docker run does not refer to the app folder in the repo, but to the persistent location of the created webserver by mattrayner/lamp. Here is where you need to put the dearscholar.php file (see the instructions, step 5, this is a bit confusing I now see). It would be great indeed to include DearScholar in the docker too, but that is something on my bucket list.

Issue 3
To be sure: Along similar lines, you cannot directly load the content of my mysql file into the MySQL database, but (at the moment) should use the mysql command line in the docker image (see step 1 and 2 of the manual). Can you open the mysql docker in your terminal (see step 1 of the manual).

In short, can you let me know what happens when you re-install the Docker image, preferably also delete the app folder and mysql folder created the image (both folders are at located at Users/peterkruyen/) and run docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804.

Thanks,
Peter

@kinow
Copy link
Contributor Author

kinow commented Aug 3, 2020

Almost there... but I cannot connect to the backend (receiving 404 errors), drives me crazy. I will give it another try tonight; or else will upload it to the installation instructions as 'work in progress'.

Sounds like a good plan, if we have at least the browser platform working, that should be enough to run the app locally. Later we can work on the Android or iOS platforms, or tell users that they can download the apk or use the store version for the time being.

Inspecting your code, I see that you changed the ports and you use a capital letter "A" in app. Does that cause the problem?

I don't think so. I tried both ways yesterday. But will try again today to confirm.

Just synced the repo. Then executed:

docker system prune -a -f
docker network prune
docker volume prune

Then running docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804:

image

What do you see when you navigate to localhost/myphpadmin in your browser? What happens when you wipe the image completely and re-install / re-initialize it?

With the container in that state:

image

and

image

(slight change in address)

To be sure: The app folder in docker run does not refer to the app folder in the repo, but to the persistent location of the created webserver by mattrayner/lamp. Here is where you need to put the dearscholar.php file (see the instructions, step 5, this is a bit confusing I now see). It would be great indeed to include DearScholar in the docker too, but that is something on my bucket list.

Ah, I see. I thought we were mapping the App folder within the container. I am stuck at step 1 at the moment, trying to get pass "Step 1: Server setup". I can skip it, but looks like mysql is not running.

I believe my container has no services listening on any ports at the moment. Its initialization seems to have failed.

image

To be sure: Along similar lines, you cannot directly load the content of my mysql file into the MySQL database, but (at the moment) should use the mysql command line in the docker image (see step 1 and 2 of the manual). Can you open the mysql docker in your terminal (see step 1 of the manual).

👍 looks like I was thinking too much ahead. Your instructions would have showed me how to use the app and mysql folders. Once we manage to fix the initial set up, everything should work 🤞

In short, can you let me know what happens when you re-install the Docker image, preferably also delete the app folder and mysql folder created the image (both folders are at located at Users/peterkruyen/) and run docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804.

Sure. Removed the app directory (looks like it had been created), and re-executed the exact command docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804.

image

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 3, 2020 via email

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 3, 2020

Wait a sec... I also see that you are trying to run docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804 from the project folder.

When trying this too, I got the same error because of the presence of mysql in that folder (and also anApp folder in this directory). Could you try to run the command in another directory or renaming the mysql file? (I also see that the Docker makes the mysql executable when ran in that directory).

🤞

Best,
Peter

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 3, 2020

And if your run the docker command, I think you should also rename the App folder. 😄

When this work, will find other names for the file and folder ...

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 3, 2020

Hi Bruno,

Android
I can register the device with some adjustments in the index.html file and config.xml (that is I can access the php-file to communicate with the server), but cannot load the tables in the emulator yet. That should be the final step!

Backend
Hope my suggestion above does the trick 🤞

Peter

@kinow
Copy link
Contributor Author

kinow commented Aug 3, 2020

Problem solved @pmkruyen !

Wait a sec... I also see that you are trying to run docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1804 from the project folder.

When trying this too, I got the same error because of the presence of mysql in that folder (and also anApp folder in this directory). Could you try to run the command in another directory or renaming the mysql file? (I also see that the Docker makes the mysql executable when ran in that directory).

Sorry! You were correct here. Just cd /tmp/ && docker.... fixed the issue 😬

Will continue with the other instructions today 👍

Thanks Peter!
Bruno

@kinow
Copy link
Contributor Author

kinow commented Aug 3, 2020

Further progress today @pmkruyen

Right now I think I have the backend working. I can see the POST request in the browser going to the Docker container, and being returned as success.

However, the log in still fails with

Er is iets mis gegaan met het opslaan van uw PIN code. Controleer uw gebruikersnaam en wachtwoord en probeer vervolgens opnieuw of neem contact op met Peter Kruyen.

image

I logged in with user test1, password test1. Then typed 1234 twice as my PIN. It looks like the PIN was actually stored in the database (that pintable table was empty before I tried).

image

Any idea what I could be doing wrong?

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 4, 2020 via email

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 4, 2020

Hi Bruno,

Can you also check what happens when you try to access the other tables in phpmyadmin. I got a #1146 error now e.g., #1146 - Table 'project.questiontable' doesn't exist This is also causing me not being able to start the app properly in the Android emulator :)

Maybe caused by moving around with the Docker image?

I see online several solutions, such as stopping and restarting mysql. When I found the solution tonight, I let you know.

Peter

PS. Do you also receive this error when trying to click on the tables in the left panel of phpmyadmin?

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 4, 2020

Hi Bruno,

I removed the mysql folder, restarted the Docker image, and populated the database following the first steps of the instructions.

All works, indeed the Android emulator works too :) (albeit the rendering is not 100% correct). Will start updating the instructions tonight.

Hope we get it working on your computer very soon too 😄 .

Peter

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 5, 2020

Hi Bruno,

Following your comments, I have moved all the technical details on the Wiki page (and restructured them a bit).

Backend
I will update / finalize these installation instructions (Step II and III) when DearScholar is working on your laptop.

Android
I will have to upload some additional testing files tonight. I drop a small note when I have done so, and you can then verify the installation instructions for the Android emulator when you have time. 😄

Thanks for all your patience and help.

Peter

@kinow
Copy link
Contributor Author

kinow commented Aug 5, 2020

Thanks @pmkruyen !

I had an evening meeting with the rest of my team ($work) yesterday, and today was organizing everything to start a 2 days leave (thu/fri NZ).

Planning to use some of this spare time to have another go at reviewing the build instructions from scratch, after cleaning the whole environment.

I also believe we should be able to run some command like docker-compose up, or docker build . -t dearscholar, or even make docker, etc., and get 1 or more containers with everything necessary for running DearScholar.

Without having to perform any extra steps, such as running SQL or PHP commands, or editing files. Just would need some time to try - this is not necessary for the JOSS review, IMO. We can use the build instructions in the Wiki if they work. But I want to practice some Docker fu, so will try to automate the steps later :)

Will try to reproduce the build tomorrow I think 👍

Thanks a lot!!!
Bruno

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 5, 2020

Hi Bruno,

I just uploaded the files (in the newly created installation folder). Good luck with testing, hope that it works🤞

I also believe we should be able to run some command like docker-compose up, or docker build . -t dearscholar, or even make docker, etc., and get 1 or more containers with everything necessary for running DearScholar.

Without having to perform any extra steps, such as running SQL or PHP commands, or editing files. Just would need some time to try - this is not necessary for the JOSS review, IMO. We can use the build instructions in the Wiki if they work. But I want to practice some Docker fu, so will try to automate the steps later :)

Yes, this would be really welcome when the JOSS review is over and the paper has been accepted for publication (especially because all the testing on emulated Android devices requires quite some steps, from which I learned a lot by the way). Thank you Bruno.

Have a nice leave / long weekend and thanks for the effort. Hope that a fresh restart solves the login issues and you get the Android emulator working.

Best,
Peter

PS. I will be on vacation next week (my responses will somewhat be delayed).

PPS. When you loaded the tables in DearScholar and you change settings (e.g., put in different questions), it is important to push the reset button in the app otherwise the changes will not be shown (see the 'settings and options' sections too) 😄

@kinow
Copy link
Contributor Author

kinow commented Aug 7, 2020

Probably restarting the review tomorrow @pmkruyen 👍 if not the whole process, at least i) cleaning local environment (remove platforms, and the docker containers), and ii) sync repo, and iii) re-read the instructions.

Will try to follow the instructions again with care either tomorrow or Sunday.

@pmkruyen
Copy link
Owner

pmkruyen commented Aug 7, 2020

Hi Bruno,

Thank you so much! Hope we got everything working 😄 .

Have a good weekend,
Peter

This was referenced Aug 7, 2020
@kinow
Copy link
Contributor Author

kinow commented Aug 8, 2020

Followed new installation instructions from the beginning to end, line by line. Successfully built and ran DearScholar locally 👍

image

Closing now! 🎉

Thanks @pmkruyen !

@kinow kinow closed this as completed Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants