PBE_3

Mobile Applications using React Native

Make sure to have a decent code editor for writing Javascript available. I recommend installing VSCodium via your operating system's package manager.

To get started, clone into the rn-starter repository.

git clone git@github.com:senarclens/rn-starter.git
# if you don't have an ssh key in your github profile, use the https url instead
git clone https://github.com/senarclens/rn-starter.git

Follow the instructions in the repository's README.md. If you have installed Android studio and the Android SDK, you can use the Android emulator on your computer. Otherwise, use the expo app on your mobile phone.

To get started with react native, follow the interactive react native documentation.

Docker

To pull it all together, we want to

The easiest way to set up the top part of our stack is to use Docker to locally deploy both PostgreSQL and Grafana. The first step is, hence, to download, install and configure Docker for your platform.
When this is complete and you user can run docker commands (on Linux systems, the user must be in the docker group which is achieved by sudo adduser gerald docker and logging in again), perform the following actions.

  1. Run Grafana in a new container. The grafana container is automatically downloaded. The new container will be available by the name (--name grafana), will expose its port 3000 on the host computer (-p 3000:3000) and run in background (--detach).
    docker run --name=grafana -p 3000:3000 --detach grafana/grafana
  2. Run PostgreSQL in a new container. The container will receive the PostgresSQL password via an environment variable (--env POSTGRES_PASSWORD=super-secret)
    docker run --name docker-postgres --env POSTGRES_PASSWORD=super-secret -p 5432:5432 -d postgres
  3. Create a new network so that the containers can communicate with each other. Add both containers to the same network.
    docker network create grafana-net
    docker network connect grafana-net docker-postgres
    docker network connect grafana-net grafana
  4. Read the ip address of the PostgreSQL container and use this IP for setting up the PostgreSQL data source in grafana.
    docker network inspect grafana-net
  5. Connect to localhost:3000, log in via user admin and password admin (or the values you picked) and set up Grafana to your needs. When adding PostgreSQL as data source, disable SSL for this setup.
  6. If you want to start your containers after rebooting the host, do so by referencing their names in the docker container start command.
    docker container start docker-postgres
    docker container start grafana

Links

Lehrstoff