Announcing meteor-desktop


#62

hey @omega or anyone else who’s used this project, I’ve got a quick question

I’ve got basic IPC interactions working with the Desktop and Module classes, but it seems like desktop-specific code is required to live within .desktop/.

Is it possible to place desktop-specific code that uses the Module api in files outside .desktop, for example in /src/imports/foobar.js but then import it from within .desktop/? Or does the file have to actually existing within .desktop/?


#63

Hi, does the update package work with this?


#64

Does it have React?
I mean this is so good but react is the way to go for many of us


#65

It just runs your Meteor client code inside an Electron renderer process, you’re free to use any UI framework you wish. I’ve been using Vue in it but React would work too


#66

very cool but the thing with a project is if it’s already have ready to use components in react :wink:


#67

I recently tried the package - I had a bit of difficulty mapping how Electron works to how this is configured, but it only took me a few hours to figure it out and otherwise, I found the package to be excellent. It would be really great if it were extended to run the Meteor server and database with-in itself.

I was able to get everything working the way I would like, but I am stuck with one thing: does anyone know how to disable pinch to zoom, and how to override the Command + R for refresh


#68

mate without seeming like am imposing, you should totally make a blog post about doing this with a demo meteor react app. would be very much appreciated.


#69

Does anyone have experience distributing on the Mac App Store with this package?


#70

We’re working on that right now and it seems like it’s gonna work. Will post back results.


#71

Sweet, please keep us posted on how it’s going. I have been delayed several months now by this issue.

There is a new branch with a commit that might fix an issue around the build tool, however, I’m not sure if its complete or runnable.


#72

@adammoisa hey man have you had any luck?


#73

Hey @msavin, it took a while, a lot of luck, and more importantly, a lot of persistence from my relentless teammate @oleksiitrukhanov (who gets 100% of the credit and is the expert on the matter). Happy to say that Travis is successfully building a macOS app with meteor-desktop and uploading it to Appstoreconnect!


Our project goals were for Travis to perform the following actions on a push to master (*B&D = build and deploy):

  • iOS: B&D an iOS app to App Store (Appstoreconnect) :white_check_mark:
    • And automatically push the new build out to internal testflight users
  • Android: B&D an Android app to Google Play :white_check_mark:
    • And auto publish to alpha or beta testing channels
  • Windows: B&D a Windows Electron app (using meteor-desktop):
    • And deploy it to the Windows Store :hourglass_flowing_sand:
      • @oleksiitrukhanov is still going strong and I’m confident he’ll get this one too :slight_smile:!
    • As a .exe to an S3 bucket :white_check_mark:
      • We save the previous version to a versions folder and write the new .exe to the same location the old version was. This way, we never have to update download links (it always points to the same spot which always has the latest version)
  • Mac: B&D a macOS Electron app (using meteor-desktop):
    • And deploy it to the Mac App store (Appstoreconnect) :white_check_mark:
    • As a .app to an S3 bucket :white_check_mark:
      • Storage logic same as Windows app
  • Web: B&D the web app to 2 servers behind a load balancer :white_check_mark:
    • Without wasting build time of course, which was a challenge: when PM2 is configured to deploy to multiple servers, it builds & deploys for each server listed, which means you are waiting for a full build for each server! @oleksiitrukhanov successfully configured the process to build once and reuse the same bundle to deploy to multiple servers. The implications are fantastic - scaling and deploying to multiple servers is now only limited by the actual upload-bundle-to-server time, and not also limited by the build time
      • Fast: totalTime = buildTime + (servers.length * uploadTime), vs.
      • Slow: totalTime = servers.length * (buildTime + uploadTime)

We also have a separate ‘server-only’ meteor app that services many client requests (especially reqs to other external services, and another that runs lengthy cron jobs) to which a client (or method) connects over DDP (2 servers behind a LB), but this is a separate repo so it is a totally separate process. We reuse the build once -> deploy to multiple logic in Travis which makes deploying super efficient.

We’d like to eventually create an AMI on deploy and then spawn up instances from the AMI and add any spawned instances to the LB, which would then allow us to both decide on the # of servers at deploy and to scale up post-deploy in realtime, without first configing new servers then redeploying, etc. Ready for another challenge, @oleksiitrukhanov? :smiley:


One important feature we wanted is for each of these main processes to be created and run as separate jobs on Travis instead of one long process on a push to master. Concurrent jobs are great (although more than 1 concurrent build on Travis += $$$ [$69/mo for 1 concurrent, $129/mo for 2, $249/mo for 5]).

Nevertheless, even if you have to wait for each to run one after the other, it’s much easier to debug if (when) one fails (and it takes ~the same amount of time as one long thread would have in any case).


It was beyond a lot of work and persistence and again, I’d like to thank and praise @oleksiitrukhanov for not giving up for weeks and for getting this done. He’ll be publishing an in-depth post on Medium shortly, specifically describing the macOS process to which I’ll provide a link here when complete. It will cover all the provisioning/configs and external services used to successfully deploy the app to Appstoreconnect.

He’ll also be writing an in-depth article covering all of the above (iOS, Android, Windows (.exe and Store), Mac (.app and Store), and Web (multiple servers/load balancing)) for anyone who’s looking for similar functionality but want’s to keep (most of) their hair on their head :slight_smile:. Will post it here as well when complete.

We’d like to help anyone who’s struggling with this so if you or others have questions, don’t hesitate to post! Probably best to wait on the article for initial guidance, but nevertheless we’re here to help if we can.


Side note, we are also using the https://github.com/cult-of-coders/redis-oplog package which kicks butt, especially considering the extreme targeting available using channel: 'threads::' + threadId + '::messages' for publications. On our db of 6M+ docs that are constantly churning, performance is :ok_hand:. And we love the ability to publish updates to redis with total control or from external services via vent and the handy documentation on outside mutations. Big thanks to @diaconutheodor on the fantastic package!


#74

Haha! Niceee! Maybe you could publish some performance specs? I would like to see how it performs on large-scale! The community and I built it exactly for needs like this!

Love the fact you put Vent to good use. Thanks for the appreciation!


#75

We definitely will, as soon as we find time between building new features + fixing bugs :upside_down_face:. But in all seriousness, we will do some tests and post some specs and I’ll share the details in the redis-oplog thread. Needless to say, it’s made the difference between the app not working and being lightning fast. :clap::clap:


#76

Amazing news! If it helps, I am happy to jump on a screenshare call to try your method, and I can help document the steps along the way. Otherwise, looking forward to seeing the write-up!


#77

@adammoisa @oleksiitrukhanov hey folks, any news on how you got the mas build to work? perhaps you can share the configuration file? I’m like half a year behind on getting this launched, so I’m counting on ya :smiley:


#78

Hey, @msavin. Sorry for the late answer. I will write a small manual about how to build the installer with the meteor-desktop.

  1. Create an Apple developer account on developer.apple.com. The Apple Developer Program annual fee is 99 USD and the Apple Developer Enterprise Program annual fee is 299 USD.

  2. Create a desktop project in the apple store connect appstoreconnect.apple.com

  3. Create certificates and provisioning profiles. You could do this on xcode or on your apple developer account.

  1. Mac App Distribution
  2. Mac Installer Distribution
  3. Developer ID Application
  4. Developer ID Installer
  5. Mac Development
    Export them into a single p12 file and export the path to this p12 file in the "CSC_LINK" env var.
  1. Create a distribution embedded.provisionprofile for macOS on your apple developer account. And put in the root of your project.
  • you can easy find the info about certifications and provisioning profiles in the internet.
  1. Generate app-specific password. This is how to do it https://www.imore.com/how-generate-app-specific-passwords-iphone-ipad-mac

  2. Create a special icns icon for your app. This is how to do it https://www.youtube.com/watch?v=3TPtHX9O3IU

  3. Create an entitlements.mas.plist file in the root of the project or somewhere else inside of it.

  • YOUR_APPLE_TEAM_ID - it could be yours apple id if you doesn’t work in a team.
  • YOUR.BUNDLE.ID - you can get it from the created app in the apple store connect in an ‘App information’ tab
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<string>YOUR_APPLE_TEAM_ID.YOUR.BUNDLE.ID</string>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
</dict>
</plist>
  1. Meteor-Desktop settings:
{
  "name": "TYPE_HERE_YOUR_PROJECT'S_NAME",
  "version": "0.0.1",
  "projectName": "TYPE_HERE_YOUR_PROJECT'S_NAME_BETTER_WITHOUT_SPACES",
  "devTools": true,
  "devtron": true,
  "desktopHCP": true,
  "desktopHCPIgnoreCompatibilityVersion": false,
  "autoUpdateFeedUrl": "http://127.0.0.1/update/:platform/:version",
  "autoUpdateFeedHeaders": {},
  "autoUpdateCheckOnStart": true,
  "webAppStartupTimeout": 60000,
  "exposeLocalFilesystem": false,
  "window": {
      "icon": "@assets/meteor.png",
      "_windows": {
          "icon": "@assets/meteor.ico"
      }
  },
  "windowDev": {
  },
  "uglify": true,
  "plugins": {
      "meteor-desktop-splash-screen": {
          "version": "0.4.3",
          "windowSettings": {
              "width": 800,
              "height": 600
          },
          "updateScreen": true,
          "updateScreenSettings": {
              "imagePath": "updating.gif",
              "windowSettings": {
                  "width": 400,
                  "height": 300
              },
              "clickThrough": false,
              "style": {
                  "background-size": "auto"
              }
          }
      }
  },
  "dependencies": {},
  "packageJsonFields": {
      "description": "YOUR_PROJECT_DESCRIPTION",
      "author": "AUTHOR",
      "private": true
  },
  "builderOptions": {
      "icon": ".desktop/assets/meteor.ico",
      "appId": "YOUR.BUNDLE.ID",
      "productName": "PROJECT'S_NAME",
      "artifactName": "${productName}.${ext}",
      "compression": "maximum",
      "win": {
          "target": ["nsis"]
      },
      "squirrelWindows": {
          "iconUrl": "https://github.com/wojtkowiak/meteor-desktop/blob/beta/scaffold/assets/meteor.ico?raw=true",
          "loadingGif": ".desktop/assets/loading.gif"
      },
      "publish": [
          {
              "provider": "generic",
              "url": "http://127.0.0.1:8080/"
          }
      ],
      "mac": {
          "type": "distribution",
          "icon": "PATH_TO_YOUR icns ICON_FILE",
          "extendInfo": {
             "ElectronTeamID": "APPLE_TEAM_ID",
             "com.apple.developer.team-identifier": "APPLE_TEAM_ID",
             "com.apple.application-identifier": "APPLE_TEAM_ID.YOUR.BUNDLE.ID"
           },
           "entitlements": "PATH_TO entitlements.mas.plist",
           "provisioningProfile": "embedded.provisionprofile",
           "target": ["mas"],
           "bundleVersion": "1"
      },
      "dmg": {
          "icon": "PATH_TO_YOUR icns ICON_FILE",
          "iconSize": 54,
          "contents": [
              { "x": 377, "y": 190, "type": "link", "path": "/Applications" },
              { "x": 63, "y": 190, "type": "file" }
          ],
          "window": {
              "width": 480,
              "height": 300
          }
      }
  },
  "packagerOptions": {
      "icon": ".desktop/assets/meteor.ico",
      "_osx": {
          "icon": "PATH_TO_YOUR icns ICON_FILE"
      },
      "appVersion": "@version",
      "buildVersion": "1",
      "appCopyright": "COPYRIGHT_TEXT",
      "win32metadata": {
         "CompanyName": "COMPANY_NAME",
             "FileDescription": "FILE_DESCRIPTION",
             "OriginalFilename": "PRODUCT_NAME.exe",
             "ProductName": "PRODUCT_NAME",
             "InternalName": "PRODUCT_NAME.exe"
      }
  }
 }
  1. Install mobile platforms for meteor (iOS or Android)
  • if you didn’t run the mobile platform before run the ‘meteor rebuild’ - it would install the necessary cordova and meteor packages.
  1. Then run command:
npm run desktop -- build-installer https://YOUR_SERVER_ADRESS --mac  --build-meteor --meteor-settings settings.json

if you don’t use meteor settings - just remove it from the command.

  1. If all is OK. You will have a folder with the desktop installer archive file. If you use the xcode 10 or higher upload the app package file with the command:
xcrun altool --upload-app -f "PATH_TO_YOUR pkg FILE" -u YOUR_APPLE_ID -p APPLE_APPLICATION_SPECIFIC_PASSWORD

if the xcode is lower than 10 version it might not found the altool with xcrun so run at once:

ln -s "/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool" /usr/local/bin/altool
ln -s "/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms" /usr/local/bin/itms #itms is needed, otherwise altool will not work correctly

then run the same without xcrun

altool --upload-app -f "PATH_TO_YOUR pkg FILE" -u YOUR_APPLE_ID -p APPLE_APPLICATION_SPECIFIC_PASSWORD

It should upload it to the apple store connect.

One main thing is to secure your p12 certificate file, provisioning profile, apple_app_specific_password, plist file. Add it to gitignore file if you use github.

That’s it!
The most of the settings for macOS build I took form electron-build docs

https://www.electron.build/configuration/configuration