Open byronigoe opened 3 years ago
AWESOME!!!! Thank you SO MUCH for doing this - I will try it out right now. My company was about to launch two Apps that depend on CodePush - and we were crushed to find it going way. Hope this works!! Will help however I can!
Wow, good job @byronigoe . A lot of commit to fix things and translate..! I will be following your fork closely!
Hey @byronigoe thanks for posting this and spending the time to share with us all.. its great news and what I was hoping for... i'm not a developer myself and all of my team have been heavily tied up on Covid-19 responses, so we haven't been able to spend the time like you have so far... but its great news and just what I thought/hoped might be possible. I think the most work for the future will actually be on making sure that the clients for iOS and Android are kept up to date, as they will be the most likely to break in the future I think.
Legally I think everything is MIT, so I think we are all good there to be able to keep using everything.
hey and @josiahbryan have you been able to setup your own server and try things out ? I'm very keen to document things well to help other people easily adopt things, so it would be good to hear your experience. And @byronigoe will you be open for PRs to your forks if I were to submit some changes to readme files, wikis etc ? I'm also wondering if others like @dylanvdmerwe have seen this post ?
Yes, I welcome PRs. I'm still setting up my production deployment, and have continued improving the documentation as I go.
@byronigoe I've tried installing it, it's running and listening on port 3000 (fine). Although, I haven't found any way to access a dashboard/admin panel. I've tried login-in with "admin / 123456", it works fine but it only leads me to a page to generate a Token. Token gets generated and I can copy it and then it says that we must use it in the command window?
Is the administration CLI-only or there is a web dashboard to manage the app and releases? (can't find how to access it)
Thanks
For now it's CLI-only, but the web services are simple enough that you could make web pages if you prefer. However, the services are RESTful, and the authentication token needs to be included in the header of all requests. Therefore, for administration web pages it might be better to either create a Single-Page Application (e.g. Angular or React), or to use cookies.
Okay, thanks for the answer @byronigoe ! I'm currently playing with the CLI, not very user-friendly but it works..!
I thought there was an admin UI like Appcenter.. maybe it was a dream 😅
I was looking for a UI, this might be worth checking: https://adtmag.com/articles/2016/11/01/react-native-ota.aspx
@byronigoe , I'm experimenting with integrating this with VoltBuilder. It would help if there was a npm entry for cordova-plugin-code-push. Is that on your list, or can we help with a PR?
@gwhenne Thus far I have not needed to modify the Cordova plugin, so for now you can use the existing NPM listing: https://www.npmjs.com/package/cordova-plugin-code-push
I am also trying this out. Can you please make a video of setting this whole up. If data is being exposed via. cli. I could help build the UI panel just like appcenter using angular
@VaibhavFuke I have improved the documentation in my forks, and that should be sufficient.
Hi guys,have you managed to deploy the code push server and implement hot updates ? I have deployed the code push server, but it doesn't work on my android device, it says An error has occurred while installing the package.
Yes, I have it working. Use Chrome debugging to see what URL it is using, and any further console messages.
Would be awesome if someone who's managed to get a self-hosted Codepush server fully up and running would write a tutorial on how to do it from scratch and post it on Medium or anywhere.
Getting - [CodePush] Could not get binary hash.Error: Could not get binary hash. while calling sync() method , after CHECKING_FOR_UPDATE and before UP_TO_DATE events.
Would be awesome if someone who's managed to get a self-hosted Codepush server fully up and running would write a tutorial on how to do it from scratch and post it on Medium or anywhere.
Hey @vesper8 that was actually the exact reason for this repo... I have been a bit tied up with covid but I need to spend some time to write up all of the pieces of how people can now self host, which of course will point to some of the excellent work that @byronigoe has done... and then yes, a full readme/tutorial written for people non-familiar with all of the components needs to be part of it as well. Of course PRs will be welcome. I havn't run @byronigoe's work yet but hope to in the next few weeks. If anyone gets it setup and working before then and can start the readme then we can share with the wider community
@byronigoe how do you use cli?
npm i -g https://github.com/byronigoe/code-push-cli After install i don't see cli.js , so can't use code-push commands.
But npm install -g @shm-open/code-push-cli - installed correctly.
By the way, after switching to @shm-open/code-push-cli On android: The system sees the update but fails during download.
[CodePush] Could not get binary hash.Error: Could not get binary hash.
(anonymous) @
[CodePush] Checking for update.
[CodePush] Reported status: {"status":0,"appVersion":"feat-live-pipeline","deploymentKey":"FFhcMmkzWcPICeU9nr2rSXFx0QKy4ksvOXqog"}
[CodePush] An update is available. {"isDownloading":false,"appVersion":"feat-live-pipeline","deploymentKey":"FFhcMmkzWcPICeU9nr2rSXFx0QKy4ksvOXqog","description":"","downloadUrl":"myurl.../download/lq/lqRDQtNZ2YW7mJyQLwxl4E2RXwOK","isMandatory":true,"label":"v8","packageHash":"608fcbc7fe00be2836ca03b78e9e20662b3922123158869d96203adc84337efc","packageSize":14600658,"failedInstall":false}
[CodePush] Downloading update
[CodePush] Could not access local package. Stage:undefinedError code: undefined. StackTrace: Error: Could not access local package. Stage:undefinedError code: undefined
at n (http://localhost:8020/plugins/cordova-plugin-code-push/bin/www/remotePackage.js:1:906)
at http://localhost:8020/plugins/cordova-plugin-advanced-http/www/helpers.js:1:3633
at Object.callbackFromNative (http://localhost:8020/cordova.js:1:3511)
at <anonymous>:1:9
(anonymous) @
[CodePush] An error occurred during sync. Could not access local package. Stage:undefinedError code: undefined. StackTrace: Error: Could not access local package. Stage:undefinedError code: undefined
at n (http://localhost:8020/plugins/cordova-plugin-code-push/bin/www/remotePackage.js:1:906)
at http://localhost:8020/plugins/cordova-plugin-advanced-http/www/helpers.js:1:3633
at Object.callbackFromNative (http://localhost:8020/cordova.js:1:3511)
at <anonymous>:1:9
(anonymous) @
[CodePush] undefined:[object Object]
on iPhone - it downloads and installs the update, but fails on app reload, and finally rollbacks
[Log] [CodePush] Checking for update.
[Log] [CodePush] An update is available. {"isDownloading":false,"appVersion":"feat-live-pipeline","deploymentKey":"udNBbaWCysGlbYUiXfdm8tkfZyya4ksvOXqog","description":"","downloadUrl":"https://my.url/download/lm/lm1d0X68KX3H5NP1ar2S4mXtM03X","isMandatory":true,"label":"v8","packageHash":"dfbe92a4845c95939e34a9b36c5540eb2fa6f741216a9e121d793063c3323322","packageSize":14615872,"failedInstall":false}
[Log] [CodePush] Downloading update
[Log] [CodePush] Package download success: {"deploymentKey":"udNBbaWCysGlbYUiXfdm8tkfZyya4ksvOXqog","description":"","label":"v8","appVersion":"feat-live-pipeline","isMandatory":true,"packageHash":"dfbe92a4845c95939e34a9b36c5540eb2fa6f741216a9e121d793063c3323322","isFirstRun":false,"failedInstall":false,"localPath":"cdvfile://localhost/library-nosync/codepush/download/update.zip"}
[Log] [CodePush] Installing update
[Log] [CodePush] Applying full update
[Log] [CodePush] Install succeeded.
After reload white screen and the error:
ReferenceError: Can't find variable: cordova
After one more reload.
[Log] [CodePush] Checking for update.
[Log] [CodePush] Reported status: {"status":2,"label":"v8","appVersion":"feat-live-pipeline","deploymentKey":"udNBbaWCysGlbYUiXfdm8tkfZyya4ksvOXqog","previousLabelOrAppVersion":"feat-live-pipeline","previousDeploymentKey":"udNBbaWCysGlbYUiXfdm8tkfZyya4ksvOXqog"}
[Log] [CodePush] An update is available. {"isDownloading":false,"appVersion":"feat-live-pipeline","deploymentKey":"udNBbaWCysGlbYUiXfdm8tkfZyya4ksvOXqog","description":"","downloadUrl":"https://my-url/download/lm/lm1d0X68KX3H5NP1ar2S4mXtM03X","isMandatory":true,"label":"v8","packageHash":"dfbe92a4845c95939e34a9b36c5540eb2fa6f741216a9e121d793063c3323322","packageSize":14615872,"failedInstall":true}
[Log] [CodePush] An update is available, but it is being ignored due to have been previously rolled back.
@Serg-Mois i'm having same problem in Android, did you find any solution?  😔
@Serg-Mois i'm having same problem in Android, did you find any solution?  😔
no, I stopped the investigation, since all these solutions are an unstable mix of crutches and duct tapes/
I have everything fully working in production. I never encountered that error (@Serg-Mois @taufpate), but I can tell you my config.
<?xml version='1.0' encoding='utf-8'?>
<widget id="..." version="..." android-versionCode="..." xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name short="...">...</name>
<description>
...
</description>
<author email="..." href="...">
...
</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<icon src="icon.png" />
<preference name="scheme" value="..." />
<preference name="hostname" value="localhost" />
<preference name="DisallowOverscroll" value="true" />
<preference name="CodePushServerUrl" value="...instance of @byronigoe/code-push-server..." />
<platform name="ios">
<preference name="iosPersistentFileLocation" value="Library" />
<preference name="iosExtraFilesystems" value="library,library-nosync,documents,documents-nosync,cache,bundle,root" />
<preference name="BackupWebStorage" value="none" />
<preference name="CodePushDeploymentKey" value="..." />
</platform>
<platform name="android">
<preference name="android-build-tool" value="gradle" />
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="CodePushDeploymentKey" value="..." />
<preference name="android-targetSdkVersion" value="30" />
<preference name="AndroidInsecureFileModeEnabled" value="true" />
</platform>
</widget>
I'm using cordova-android@10.1.1 and cordova-plugin-code-push@2.0.0, and I'm still using @shm-open/code-push-cli to deploy, since I haven't had to modify it yet.
I had to add these lines to get around various issues on Android:
<preference name="scheme" value="..." />
<preference name="hostname" value="localhost" />
<preference name="AndroidInsecureFileModeEnabled" value="true" />
After reload white screen and the error:
ReferenceError: Can't find variable: cordova
@Serg-Mois You need to copy your cordova files into your www directory before you deploy the code-push package. This was true with AppCenter too.
Specifically, include:
These can be found in the build's platform_www folder.
@Serg-Mois Eureka I was able to get it work! The error was my fault! in server configuration specifically in the DOWNLOAD_URL variable it had http and should be https (I use cloudflare as ssl because i dont know how to configure ssl in codepush server), in the config.xml it was making the call to https correctly.
The origin of issue its because cordova-plugin-code-push use cordova-plugin-advanced-http to connect to your defined CodePushServerUrl, an then the codePush server send a response with the url of latest update available, but the codePush server take DOWNLOAD_URL to construct the url for update package and send it back to the app and cordova-plugin-advanced-http begins download of that url ... and in android fails if the url its not using (SSL)
i took a few hours to figure it out, debugging line by line the codepush plugin but it wat worth it!
@byronigoe was right! the plugin works like a charm, tks!
Hey guys just in case you didn't see my issue here : https://github.com/IllusionVK/ReplaceAppCenter/issues/7#issue-1175870240 i made an alternative plugin fully open source in December. i love the solution of @byronigoe, but for me keeping the old solution in cordova and open source version of code push was too many unknow future.
What i have made so far :
In the future, i plan to release:
And many more, hope this message is not seen as spammy, i saw many persons a bit lost about this Microsoft announcement i and try to help
FYI, I also have Code Push working in a Capacitor project on Android using: https://github.com/byronigoe/capacitor-codepush and the same self-hosted back-end.
And now I have the Capacitor plugin working on iOS too! The Capacitor plugin is a wrapper around the Cordova plugin, so I will have to maintain very little.
Hey everyone, I spent most of today setting up a CodePush server for Cordova on EC2 and documented my experience here: https://medium.com/@wongpeiyi_75194/running-your-own-codepush-server-836f3aa92922
Thanks @byronigoe for your work.
While I've gotten it working, there's still a lot I'm unsure about, so appreciate any feedback.
Hey everyone, I spent most of today setting up a CodePush server for Cordova on EC2 and documented my experience here: https://medium.com/@wongpeiyi_75194/running-your-own-codepush-server-836f3aa92922
Thanks @byronigoe for your work.
While I've gotten it working, there's still a lot I'm unsure about, so appreciate any feedback.
@wongpeiyi That's a great writeup and is super useful! Thanks a lot for putting the solution to the test and sharing your experience!!
Thanks for the writeup @wongpeiyi. We also have the solution running and we also have a PR that we need to commit soon that allows for the solution to use MS SQL as the only database that is needed (so that redis and mysql are not needed) (we did this 1 month ago and need to push this incase it helps anyone else). We needed this so that we could use our normal database to help reduce the stack that is used.
@byronigoe @IllusionVK there is one thing I can't figure out. It appears using ranges for the targetBinaryVersion doesn't work like AppCenter's code push did. For example:
Label | Target
---------------------
v2 | 1.0.0-1.0.2
v1 | 1.0.0-1.0.1
It will update to v1, but will not apply v2. Even if I disable v1, no update is done. The only thing I can do is update v1 to some other target, like 1.0.00
It appears this was an open issue in the original repo. How are you all handling this?
How are you all handling this?
@wongpeiyi I use semantic versioning (e.g. ~1.0.0), which is the "right" way.
If you make changes to your app such that future code-push deployments must be different, then you should bump the minor or major version.
@wongpeiyi I looked into this some more, and now I understand the problem. There is code to find all applicable deployments, then to choose the one with the narrowest scope. So, if the client has 1.0.0 or 1.0.1, then both v1 and v2 are applicable, and v1 will be chosen because it has a smaller scope. I think this is wrong, and I'm working to address it.
Hey @byronigoe thanks for looking into this. You will see that I commented on the other repo, and i agree with you that it needs to be fixed. We haven't seen this problem ourselves due to our versions numbers I guess, but thanks for highlighting it @wongpeiyi
@byronigoe actually I already solved it last week. I'm using my own fork instead of your repo. Sorry I didn't update here, I'll submit a PR now
I also submitted another PR last week to fix isDisabled
not showing properly. Not sure if you saw that
If you think the PRs should be merged further upstream, I can possibly submit them to shm-open
, but I think lisong
is not actively maintained. Let me know if you only intend your fork to be a translation and nothing more
Thanks! I merged it, and submitted a PR to shm-open
Hi @byronigoe
thank you for your awesome work.
We successfully set up our own code push server with your fork. I have only one problem with the code push update in my cordova app, the download/sync fails with An error has occurred while installing the package. Could not get the package start page
I now downgraded from cordova-android 10.1.1 to 9.1.0. With the downgrade the sync works fine.
Do you have any idea why it won't work with cordova-android 10.x? At the moment it's no problem for us to keep your app on version 9.1.0, but it would be nice if we could upgrade it again in the future.
@pilz97 I'm using cordova-android 10.1.1. You may just need to upgrade to the latest code-push:
Here's an excerpt from my package.json devDependencies:
"code-push": "^3.0.1",
"cordova-android": "^10.1.1",
"cordova-plugin-advanced-http": "^3.2.2",
"cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-code-push": "^2.0.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-zip": "github:SunPower/cordova-plugin-zip",
For anyone interested, there are also some fixes to the code push plugin in our branch: https://github.com/cloudscapelabs/cordova-plugin-code-push/commits/master
We recently updated to the latest cordova-android & cordova-ios (including WkWebView) and everything seems to be working well.
For me Capgo looks like a good solution, you can use Capgo server (cost is more reasonable than appflow), or you can host your own server https://docs.capgo.app/self-hosted/manual
<?xml version='1.0' encoding='utf-8'?>
... ... ... I'm using cordova-android@10.1.1 and cordova-plugin-code-push@2.0.0, and I'm still using @shm-open/code-push-cli to deploy, since I haven't had to modify it yet. I had to add these lines to get around various issues on Android:
Thanks for the info. I am also experiencing this error.
What is the value you used for "scheme"?
What is the value you used for "scheme"?
Whatever you want the deep-links to be. For example, "foo" would mean deep-link URLs are of the form "foo://...".
Hi byronigoe. I need some assistance to set this up. Can you please contact me directly on cyphers-squeak-0a@icloud.com and let me know your hourly rate? Thanks.
Hi byronigoe. I need some assistance to set this up. Can you please contact me directly on cyphers-squeak-0a@icloud.com and let me know your hourly rate? Thanks.
@Pigsnuck I emailed you over 3 weeks ago, but haven't heard back.
Hi byronigoe. I need some assistance to set this up. Can you please contact me directly on cyphers-squeak-0a@icloud.com and let me know your hourly rate? Thanks.
@Pigsnuck I emailed you over 3 weeks ago, but haven't heard back.
That's weird, I wrote back immediately. I am still looking for help.
I just tried replying to your email again and it was rejected. Can you try writing me using a different return email address, please?
Thanks!
Hi, everyone. The official standalone repository is ready: https://github.com/microsoft/code-push-server But CodePush Server is designed to run as Azure App Service
I made it work (at least the server side)
Hi jcgz100,
That's great news!
What do you mean by "I make it work (at least the server side)"? Will you fork the microsoft repo to work without Azure?
Hi jcgz100,
That's great news!
What do you mean by "I make it work (at least the server side)"? Will you fork the microsoft repo to work without Azure?
Hi Pigsnuck, i mean that i deployed the code-push-server as Azure App Service, i just follow the instructions here: https://github.com/microsoft/code-push-server/blob/main/api/README.md
I am still stuck with the code-push-plugin, because there is an error when the file is unzipped, because the file is not found, even the file is there.. http://localhost/__cdvfile_files__/codepush/download/update.zip doesnt work cdvfile://localhost/__cdvfile_files__/codepush/download/update.zip works It only works when i replace http to cdvfile.. but i am still testing..
Thanks for your reply.
If you could please post the results of your testing here, we would all appreciate it. Thanks!
Great news! I've got an alternative working!
Cordova Plugin
The official cordova-plugin-code-push supports pointing to a different server:
<preference name="CodePushServerUrl" value="http://your-server.com/" />
Just in case I will need to fix bugs, I will maintain my own fork: https://github.com/byronigoe/cordova-plugin-code-pushCodePush Server
@shm-open created https://github.com/shm-open/code-push-server With the help of Google Translate and the documentation for Pug and Redis, I was able to get it working. I will continue to maintain this English version, and submit PRs to upstream when possible: https://github.com/byronigoe/code-push-server
CodePush CLI
I have not needed to modify the CLI yet, but in order to guarantee interoperability with future backend changes, I'm using my fork: https://github.com/byronigoe/code-push-cli