Turning the RaspberryPi 3 into a local App-Development Server

In this tutorial I will show you how to turn your RaspberryPi 3 into a local App-Development Server. You will need no more than a RPi3 , a microSD card (32GB) and some basic knowledge.

After this tutorial you should be all set to start developing your own Apps using a git environment and a Parse server to host all of your cloud content.The workflow

  1. Setting up the RPi3
  2. Installing GitLab
  3. Installing NodeJS && MongoDB
  4. Setting up the Parse Server
  5. Installing the Parse Dashboard

1. Setting Up the RPi3

Download the latest Raspbian Jessie image (full) and burn it to your SD card.

Start your Pi (using display and keyboard) and open up terminal [using alt (or windows-key) navigate to run and type lxterminal].

sudo raspi-config

navigate to advanced-settings and enable SSH&VNC on boot then click finish. To enable an internet connection either plug-in an ethernet cable or enable wi-fi via terminal using

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

add your Network to the end of the file

network={
    ssid="Your Network Name"
    psk="Your Network Key"
}

Press CTRL+X and then Y to save&exit. Run

sudo apt-get update && apt-get upgrade && apt-get dist-upgrade

to update the Pi. Now restart your Pi and connect via SSH/VNC to it.

2. Installing GitLab

You can alternatively use Gitea

I. Install and configure the necessary dependencies

If you install Postfix to send email please select ‘Internet Site’ during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server and configure it as an SMTP server.

On Centos 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.

sudo apt-get install curl openssh-server ca-certificates postfix apt-transport-https
curl https://packages.gitlab.com/gpg.key | sudo apt-key add -

II. Now add the GitLab package server and install it

sudo curl -sS https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce

If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using

curl -LJO https://packages.gitlab.com/gitlab/raspberry-pi2/packages/debian/(wheezy|jessie)/gitlab-ce-XXX.deb/download
dpkg -i gitlab-ce-XXX.deb

III. Configure and start GitLab

sudo gitlab-ctl reconfigure

IV. Browse to the hostname and login

Browse to the Pi’s IP-Adress. On your first visit, you’ll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you’ll be redirected back to the login screen.

The default account’s username is root. Provide the password you created earlier and login. After login you can change the username if you wish.

 For configuration and troubleshooting options please see the Omnibus GitLab documentation 
 If you are located in China, try using https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/

3. Installing NodeJS && MongoDB

To run Parse, we will need NodeJS, to install run

 wget https://nodejs.org/dist/v6.9.5/node-v6.9.5.tar.gz
tar -xzf node-v6.9.5.tar.gz
./configure
sudo make && make install

next up install npm using:

sudo curl -L https://www.npmjs.com/install.sh | sh

(it should be included in NodeJS, however I didn’t get it to run with NodeJS so I just installed it manually)

to install MongoDB we need some more work

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update && sudo apt-get install -y mongodb

You can start mongoDB with

sudo service mongod start

and stop it with

sudo service mongod stop

4. Setting up the Parse Server

Clone the Parse-Server-Example repo and cd into it

git clone https://github.com/ParsePlatform/parse-server-example
cd parse-server-example && sudo npm install

run the server with

npm start

By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run

export PARSE_MOUNT=/1

before launching the serve, now you have a database named “dev” that contains your Parse data. To test with devices you can install ngrok.

5. Installing the Parse Dashboard

Almost done!

To complete this tutorial we will setup the Parse Dashboard (just to make working with parse easier and prettier). To do so run

sudo npm install -g parse-dashboard

to connect your parse server with mongoDB simply run

mongo

Done! -Really? -Yes.

To run the server with a single command use

parse-dashboard --appId yourAppId --masterKey yourMasterKey --serverURL "https://example.com/parse" --appName optionalName

(mind that all values are yet to be set by you)

 


Congratulations! You now have set up your local App-Development Server. You can now start developing Apps using the Parse framework and a localised git environment.

-https://blog.daylight.media/2017/02/09/turning-raspberrypi-3-local-app-development-server/

Advertisements