arboleya / electrify

Package your Meteor apps with Electron, and butter
MIT License
247 stars 52 forks source link

Windows: Packaged .exe does not Render #16

Closed msolters closed 9 years ago

msolters commented 9 years ago

Thanks again for all your help in cleaning up the packaging process. The new version with Electrify.app.package() is far more stable.

But the problem is, while the build and packaging process now works for me on Windows (10), the final .exe doesn't actually render anything. Although the packaging process throws no errors, the .exe doesn't render any application!

arboleya commented 9 years ago

No problem @msolters, thanks for reporting.

I'll take a look at it later.

prasadnpawar commented 9 years ago

I am also having the same issue. Error I can see when I enable developer tool Uncaught TypeError: Cannot read property 'Electrify' of undefined template.todos.js:2 Uncaught ReferenceError: Template is not defined todos.js:1 Uncaught ReferenceError: Mongo is not defined accounts-ui-unstyled.js:634 Uncaught ReferenceError: Spacebars is not defined

arboleya commented 9 years ago

Hello, I've confirmed the problem, looking for the cause tough.

arboleya commented 9 years ago

@prasadnpawar @msolters

Closing, fixed in 1.3.5. Please update, and let me know if it works.

In case the problem persists, please reopen.

prasadnpawar commented 9 years ago

Errors are gone. Now it is working. Thanks Arboleya. Now, I am curious to know about other stuff like how can I installed this on some other computer? where the Mongodb will be installed ? How can I see database collections? How can I update app without resetting mongodb database? Please point me to the correct direction if possible.

arboleya commented 9 years ago

Good questions, lets see one by one in detail.

Let me know if it's clear.

How can I install this on some other computer?

You should have in mind that the final app is an Electron App.

It will be a .app for OSX, and a folder with files for Windows/Linux.

You can then build installers, like .msi (win) .dmg (osx) .deb (linux) and so on, by using tools that create these installers, i.e.:

https://github.com/LinusU/node-appdmg

Where the Mongodb will be installed?

MongoDB isn't installed, instead it's distributed in a standalone way, Electrify starts/stops MongoDB during the app initialization / exits process. The same happens with the local Meteor server.

The binaries of mongo and mongod lives inside the .electrify/bin folder.

However after packaging the app, everything inside .electrify folder is moved to the internals folder of the Electron app, which is:

OSX: .dist/your-app-name/your-app-name.app/Contents/Resources/app WIN: .dist\your-app-name\resources\app (linux is similar to this)

So you'll find the binaries inside Resources/app/bin folder inside the packaged app.

The actual DBDIR used by Mongo to write its databases to disk will exist only inside the packaged app - it'll created the first it runs and will exist inside the Resources/app/db dir.

How can I see database collections?

Having the packaged app up'n'running means that MongoDB is up and accessible, however you need to know in which port it's running to connect to.

Electrify assures MongoDB will use a currently free/unused port on the user's machine, therefore the port in which it runs is not predefined. It'll potentially change everytime the app is started.

To get this port, you can simply run the app from the Terminal and see its output -- it is, you cannot just double-click the generated .app or .exe files, because this way you won't see any output.

Osx terminal:

# just type the full path to the ELECTRON binary and press ENTER
.electrify/.dist/your-app-name/your-appname.app/Contents/MacOS/Electron

Windows CMD/Powershell etc:

# just type the full path to the .EXE file binary and press ENTER
.electrify/.dist/your-app-name/your-appname.exe

Watch out the logs, and you'll get the current MongoDB port. Mongo's output will be something like

[initandlisten] waiting for connections on port 11235

With this, you can use tools such as RoboMongo to access your database with a Graphical User Interface, or connect via Terminal as well.

How can I update app without resetting mongodb database?

This leads to two differente cases:

1. Shipping new versions to users

Right now there's no way to preserve the database upon newer installs.

Surely it's not ideal and preserving database between app updates makes total sense for next/future release.

2. Packaging app multiple times

It's important to know that your Meteor's mongo database is not copied to your packaged app. The packaged app always starts with a blank database, that is created during it's first initialization.

So you have to build a kind of seeding approach, that seeds the needed data on the database in case it doens't exist yet.

if(!Posts.find().count()) {
  Posts.create({/* ... */});
}

But then if you package your app again, the .electrify\.dist folder is completely removed and rebuilt, making your previous database go away. Much in the same way it'll happen with newer version shipped to users.

prasadnpawar commented 9 years ago

Thanks for the prompt reply. But I have a one more question that if it is not possible to update the app without resetting mongon database then is it possible to take backup of db and after updating app (installing new version) restore it again? If yes the how?

arboleya commented 9 years ago

Yes, potentially. Just backup/restore the dbdir, it should work.

OSX: .dist/your-app-name/your-app-name.app/Contents/Resources/app/db WIN: .dist\your-app-name\resources\app\db

msolters commented 9 years ago

Yes, I too can confirm that the Windows builds are now functioning properly.

arboleya commented 9 years ago

tks :+1:

yjose commented 8 years ago

@arboleya i have the same problem that the final .exe doesn't actually render anything. -note that i update electrify to electrify-update-test

thank you to help me to resolve this problem

ghost commented 7 years ago

thanks in advance.. i am using v2.1.4 @arboleya i have same problem as @msolters. .exe dosn't render anything.