WARNING: this tutorial is out of date, please check memri.io for the most up-to-date instructions.

This article is meant to set you up for being an early user of memri. We are actively building memri in the open, so setting up your own system still requires some manual work, but everything should be relatively straightforward. If you get stuck somewhere during setup, feel free to reach out on our forum, we won’t rest until you have a working installation.

Requirements


Currently, memri only works on iPhones, Iphone simulators and MacOS, and it requires macOS >= v10.13.6 and Xcode to be installed on your device. You can also apply for alpha access here, and run the app on your Iphone via testflight, which omits the requirement for macOS. However, for debugging the app, macOS will still be necessary. If you don’t have an iPhone, but you do have a Mac, you can still run the app, but only in a simulator.

Installing the pod


As a memri user, you will store your personal data in a pod. This is your personal server that only you control and access. In this tutorial we are installing the pod on our local machine, but we will offer both a hosted solution and tutorials on how to set up the pod on your own server in the near future.

First clone the repo:

git clone https://gitlab.memri.io/memri/pod.git
cd pod

You can check all available build options in the repo or as a quick start, build and start the Pod by running:

docker-compose build

to build a container with all the necessary requirements, followed by

docker-compose up

Warning: it is currently insecure for the Memri app to connect to the pod over the internet or any other public network. Both app and pod should connect to the same private network, e.g. your local area network, and it is assumed that all users of that network can be trusted. A firewall might be set up to further limit connections to the pod, but this is left to the user.

Installing the iOS application

The next step is to set up a client for your pod. Currently we only have an iOS and macOS client. If you don't have Xcode yet, make sure to install that first, and make sure you have opened Xcode once before proceeding. If you have Xcode, you can start by cloning the code from the iOS application repo, navigate into the folder and run:

git clone https://gitlab.memri.io/memri/ios-application.git
cd ios-application

Now you can open Xcode and select the project. Alternatively you can use the "Open in Xcode" button in the top of the GitLab repo. In Xcode, you can select a device to run the code on by selecting your device in the run destination overview as shown below.

In this case, you can either choose a simulator, or connect your iPhone to you Mac via USB. If you have an Apple developer id, you can login via preferences -> accounts, and you are able to run the app as is. If you don't, you need to change the app bundle ID. You can for instance use polis.memri.dev, but almost anything other than polis.memri will do (because it has been reserved for this app). If you want to learn more about bundle ids, check this source.

Setting the bundle ID

Now, you can select your device (iPhone, iPhone simulator or Mac) from the device list and press the play button to run the application. You can make a cup of coffee now, because the first build probably will take some time (luckily, it is cached). When you finished your coffee, check out your simulator/phone. If you are lucky, you might already see your notes. If not, you should see something like this:

Connecting to the pod

If you did not see your notes in the previous step, you will need to do one extra step. To set up your connection with the pod, the only thing you need to do is set the right IP address. Make sure that the IP is localhost:3030 when you are running in a simulator, and <local-laptop-IP>:3030 when your device is connected over USB or over WiFi,  in your settings. You can find your local laptop IP (under WiFi -> open network preferences) and access settings as follows:

Verifying your installation

After this step, you are basically done. You can verify your installation by running the iOS application, which should now show the notes that we added in the previous step.

Successful installation

Congratulations, you successfully installed memri! From here, there are many next steps to consider. For instance, you could import some data, enrich your personal data by running an indexer, or define the interface in which you are using your data by writing a view. If you like our project, feel free to reach out or ask questions on our forum. If you want to contribute to our mission, this is a great place to start.

Download data

First, clone the downloaders repo:

git clone https://gitlab.memri.io/memri/downloaders.git

We can now run the downloaders container and start a download:

cd downloaders
./build-and-run-downloaders.sh

This builds and runs a Docker container for the downloaders, and creates a new Docker volume. Docker volumes are used to persist data generated by Docker containers. This same volume will be mounted by the importers to send the data to the Pod, which will store it in the database. The default name of this volume is download-volume, and it will store your downloaded data until you remove it: docker volume rm download-volume.

I am choosing the iCloud downloader here, which asks me for my credentials and a two factor authentication code that I got from my mobile phone. Right now we are not storing any credentials, only a cookie is kept in the container until it's removed. If the application would store credentials, we would always inform you, and safely store it on a device that only you control.

Once this is finished, we have downloaded the notes on your machine, but we still need to import them to the pod as described in the next session. If you first want to inspect the downloaded data, you can access the Docker volume contents as root:

sudo su
cd /var/lib/docker/volumes/download-volume/_data/iCloud/notes/

Import data

After the data is downloaded to disk, it still has to be inserted into the Pod's database. First, clone the importers repo:

git clone https://gitlab.memri.io/memri/importers.git

We can now build the importers container:

cd importers
docker build -t memri-importers .

In the future, the importers will be invoked by the Pod when requested by the iOS app. For now, this step has to be done manually (make sure the Pod is still running):

curl -v -X POST -H "Content-Type: application/json" "localhost:3030/v1/run_service/importers/note"

The terminal output of the Pod shows the import of the data you downloaded in the previous step. Now you are able to browse and use your data within the Memri app.

Troubleshooting

The memri data browser tracks state, this means that when you close the app you will always return to the exact same place in the app. This has one downside, when you break the app (which is not uncommon in early development), the app crashes. But when you now return to the app, the app might crash again. Another common error when developing the app is a “migration error”, these are related to realm, our local database. You can solve both issues by removing your local version of the database. Do note that this will remove all your personal data, so only use this for debugging. You can do so by running:

rm -rf ~/memriDevData

which removes the data from your local (iOS) database. Note that this only removes the local database on your Mac (not from your phone), which is used when running the app in a simulator. When you have a similar problem on your phone, you can delete the app and reinstall as a temporary solution. From the pod repository you can run:

rm -rf data

to remove the data in the pod. Now you can start from a blank slate.

Another known problem is that during debugging, you accidentally try to run a container that is already running. If you get a message like this:

docker: Error response from daemon: Conflict.
The container name "/downloaders" is already in use by container
"ff16fc2a1717702aee404643e5d62005d88e324d7e1ec2c8bfaa6c2fa7c87474".
You have to remove (or rename) that container to be able to reuse that name.

You can try to first remove the container by running:

docker rm ff16fc2a1717702aee404643e5d62005d88e324d7e1ec2c8bfaa6c2fa7c87474