GardenJournal.App

GardenJournal.App

  • A Flutter (Android) app for private entries, works without internet, and syncs to CouchDb when connected

  • Phoenix app to share entrie(s) as a public gallery post

  • Galleries sorted by proximity to your Android lat / lon

When you share entrie(s) as a gallery post, the entries are appended to create a single markdown document, such as a tutorial resulting from sequential journal entries.

app in hand

5 Likes

Nice! However I am getting this when visiting your website:

503 Service Unavailable
No server is available to handle this request.

1 Like

Can you try again? I’m looking at it at 6:24 EST, and seems fine…?

Just tried it again (on mobile this time) and I got the same thing…

1 Like

Thanks for trying. I can’t explain it.

I just moved it from Google Compute Engine to DigitalOcean. It works fine for me in Windows Chrome, IE, and Android.

I wonder if it has something to do with DNS, or the fact that it’s a “dot app” domain (for which google enforces httpS)?

Any ideas?

Anyway, Thanks.

Just realized: 503 means you’re getting a response from the load balancer but can’t get through to the phoenix backend. Weird.

It occurs to me: My load balancer is grabbing the IP and retaining it for 10 minutes, to make sure that the same IP is not rapid firing requests. To block hacking.

Are you browsing in some incognito-like way that might break that? (I tested with chrome incognito and it works here).

Nope, just standard Safari :smiley:

Tried FireFox and it works :023:

1 Like

Thanks! I’m booting my Mac now to test it.

Never occurred to me that moving it from GCE to DigitalOcean would break it but only on Safari. I’ll let you know when I figure it out.

Thanks so much!

1 Like

It will work on Safari if you type in httpS://gardenjournal.app

Chrome and Firefox automatically redirect to https.

I tried to add a redirect to HAProxy but it wouldn’t work. I’ll figure it out tomorrow.

Anyway, once you visit it in Safari the browser will remember that it’s SSL and you won’t have to type https.

Thanks for discovering this. Only family have used it so far.

1 Like

Fixed.

2 Likes

Hi, it’s very interesting!
I’m going to start my first pet project with the same stack (phoenix + flutter).
Can you share a little more about your project?

Do you use flutter both for web app and for android native app or only for android app?

What libraries do you use for authentication, authorization on both sides (Phoenix and Flutter) if any?

Do you use Phoenix channels with websocket in your app and if yes then what websocket library do you use in Dart?
Thanks!

Hello Igor,

I use Flutter only for native mobile. I might use Flutter for Web when it is ready; however, I am leaning towards simply rewriting that part in LiveView. Frankly, I will do neither until there are enough people interested and using the app to make it worth pursuing. My advice: Do as much with Phoenix and LiveView as you can – rely on Flutter only for what must be native. (The only reason I used Flutter is because the app requires access to a large offline data store. If you can avoid this – do.)

I use Pow for authentication and state values in the User struct for authorization. For the Flutter app, only personal data is stored locally, and all shared data is only accessible via Webview (Phoenix); i.e., shared data access requires connection.

I do not use channels but looked into it. There is a flutter lib for it, I forget what it’s called.

1 Like

This is a good idea! I will test this out once the season starts up again and the greenhouse gets going in February. And it’s funny, I’m right in the middle of reading the resilient gardener, too. Now I’ll have to check out the holy earth and the soul of soil.

Are you mainly growing veggies, or do you have an orchard as well? I’ve got both, and have been learning more about the “no-dig” method of growing, along with the importance of getting minerals into the soil. Those two things made a big difference this year.

Back to the tech side, did you enjoy working with Flutter, was it a good experience?

Thanks! I mostly grow annual vegetables, but have decided to migrate to permaculture. I’ll still grow annuals, just in the gaps and pots. I’m breeding some peppers, too.

I very much enjoyed working with Flutter. Dart is a nice language and it is very easy to fork Java plugins and work back and forth in Java and Dart.

I would say that the level of (ease + power + performance) is similar in Flutter and Phoenix.

can you explain how you integrate CouchDB with Phoenix?

do you use the CouchDB backend for Phoenix?

or do you somehow sync CouchDB with Ecto (Postgres) or some other strategy?

1 Like

@niccolox , only the Android app syncs with CouchDb. I used CouchBase Lite 1.4, which syncs with CouchDb server. (I have a flutter wrapper around CouchBase lite; it’s still rough but working for my needs. I can provide more info if you need.)

The Phoenix app does not sync with CouchDb; rather, it only reads directly from it (HTTP get). Eventually, if there is demand for the app I might add Phoenix controllers that also write to CouchDb. But there is no need to sync from Phoenix to CouchDb, as both are backends and always online.

1 Like

so, the Phoenix Postgres Ecto DB is a kind of warehouse for web gallery publishing?

all data is input by the mobile apps?

I guess you could say it that way; as long as by “warehouse” you’re not referring to a “data warehouse” schema.

Essentially: 1) The user’s private journal data is captured on Android and syncs to CouchDb as a backup; if the user uninstalls and reinstalls the app, the data re-syncs and they are where they left off. 2) If the user decides to share any entries to the web galleries (no longer private), then the data is read from couchdb, converted to markdown and written into postgress text field; i.e., copy-on-write. Thus, CouchDb is private, and postgres is where shared data resides.

Each user has their own CouchDb database. CouchDb has a setting and handles this automatically.

1 Like

so you use PouchDB in the mobile app and CouchDB on the server?

did you use the https://github.com/amuino/ecto_couchdb or https://github.com/mkrogemann/couchdb_connector ?

did you follow this blog or a new approach? https://blog.codecentric.de/en/2016/01/elixir-phoenix-couchdb-introduction/

1 Like

@niccolox, No, I did not use PouchDb, which is JavaScript and is for web applications (or JS hybrid mobile apps). I used something similar that works for native Android: Couchbase Lite 1.4. (Note: Only the older 1.4 version will sync with CouchDb. The newer version 2 Couchbase Lite will not sync with CouchDb.)

I forked fluttercouch, which works with Couchbase lite version 2, to create my fork, which works with version 1.4; hence, my fork will sync with CouchDb. Note, to use my fork you have to write your queries and views in Java.

No, I did not follow those tutorials. There is nothing in my phoenix app that is specific to CouchDb. My phoenix app simply sees CouchDb as another Http JSON APi.

1 Like