Engineering and technology notes

Deploying to App Stores – Expo Documentation

This guide offers best practices around submitting your Expo app to the Apple iTunes Store and Google Play Store. To learn how to generate native binaries for submission, see Building Standalone Apps.
Although you can share your published project through the Expo client and on your expo.io profile, submitting a standalone app to the Apple and Google stores is necessary to have a dedicated piece of real estate on your users’ devices. Submitting to these stores carries stronger requirements and quality standards than sharing a toy project with a few friends, because it makes your app available through a much wider distribution platform.
Disclaimer: Especially in the case of Apple, review guidelines and rules change all the time, and Apple’s enforcement of various rules tends to be finicky and inconsistent. We can’t guarantee that your particular project will be accepted by either platform, and you are ultimately responsible for your app’s behavior. However, Expo apps are native apps and behave just like any other apps, so if you’ve created something awesome, you should have nothing to worry about!
It’s a good idea to test your app on a device or simulator with a small screen (e.g. an iPhone SE) as well as a large screen (e.g. an iPhone X). Ensure your components render the way you expect, no buttons are blocked, and all text fields are accessible.
Try your app on tablets in addition to handsets. Even if you have ios.supportsTablet: false configured, your app will still render at phone resolution on iPads and must be usable.
  • Add a great icon. Icon requirements between iOS and Android differ and are fairly strict, so be sure and familiarize yourself with that guide.
  • Customize your primaryColor.
  • Make sure your app has a valid iOS Bundle Identifier and Android Package. Take care in choosing these, as you will not be able to change them later.
You’ll use the app.json file to specify the version of your app, but there are a few different fields each with specific functionality.
  • version will apply both to iOS and Android. For iOS, this corresponds to CFBundleShortVersionString, and for Android this corresponds to versionName. This is your user-facing version string for both platforms.
  • android.versionCode functions as your internal Android version number. This will be used to distinguish different binaries of your app.
  • ios.buildNumber functions as your internal iOS version number, and corresponds to CFBundleVersion. This will be used to distinguish different binaries of your app.
To access these values at runtime, you can use the Expo Constants API:
  • Starting October 3, 2018, all new iOS apps and app updates will be required to have a privacy policy in order to pass the App Store Review Guidelines.
  • Additionally, a number of developers have reported warnings from Google if their app does not have a privacy policy, since by default all Expo apps contain code for requesting the Android Advertising ID. Though this code may not be executed depending on which Expo APIs you use, we still recommend that all apps on the Google Play Store include a privacy policy as well.
  • All apps in the iTunes Store must abide by the App Store Review Guidelines.
  • Apple will ask you whether your app uses the IDFA, the answer is “yes.” This is because Expo contains the Facebook and Branch SDKs, which contain code for collecting the IDFA, and you’ll need to check a couple boxes on the Apple submission form. See Branch’s Guide for which specific boxes to fill in.
Note: No data is sent to Branch, Facebook, Segment, or Amplitude from your app unless you explicitly do so using the APIs. For more information on how Expo handles your data, and your end users’ data, take a look at our Privacy Explained page.
  • Permissions are configured via the android.permissions key in your app.json file
  • By default, your app will include all permissions supported by Expo. This is so that your standalone app will match its behavior in the Expo client and simply “work out of the box” no matter what permissions you ask for, with hardly any configuration needed on your part.
  • There are some drawbacks to this. For example, let’s say your To-do list app requests CAMERA permission upon installation. Your users may be wary of installing since nothing in the app seems to use the camera, so why would it need that permission?
  • To remedy this, simply add the android.permissions key in your app.json file, and specify which permissions your app will use. A list of all Android permissions and configuration options can be found here.
  • To use only the minimum necessary permissions that Expo requires to run, set "permissions" : []. To use those in addition to CAMERA permission, for example, you’d set "permissions" : ["CAMERA"].
  • It’s helpful to glance over Common App Rejections.
  • Binaries can get rejected for having poorly formatted icons, so double check the App Icon guide.
  • Apple can reject your app if elements don’t render properly on an iPad, even if your app doesn’t target the iPad form factor. Be sure and test your app on an iPad (or iPad simulator).
  • Occasionally people get a message from Apple which mentions an IPv6 network. Typically this is just Apple’s way of informing you what kind of network they tested on, and the actual “IPv6” detail is a red herring. All of Expo’s iOS code uses NSURLSession, which is IPv6-compatible. More info.
If your app asks for system permissions from the user, e.g. to use the device’s camera, or access photos, Apple requires an explanation for how your app makes use of that data. Expo will automatically provide a boilerplate reason for you, such as “Allow cool-app to access the camera”, however these must be customized and tailored to your specific use case in order for your app to be accepted by the App Store. To do this, override these values using the ios.infoPlist key in app.json, for example:
"infoPlist": {
  "NSCameraUsageDescription": "This app uses the camera to scan barcodes on event tickets."
},
The full list of keys Expo provides by default can be seen here. Unlike with Android, on iOS it is not possible to filter the list of permissions an app may request at a native level. This means that by default, your app will ship with all of these default boilerplate strings embedded in the binary. You can provide any overrides you want in the infoPlist configuration. Because these strings are configured at the native level, they will only be published when you build a new binary with expo build.
If you plan on shipping your app to different countries, regions, or just want it to support various languages, you can provide localized strings for things like the display name and system dialogs. All of this is easily set up in your app.json. First, set ios.infoPlist.CFBundleAllowMixedLocalizations: true, then provide a list of file paths to locales.
  "expo" : {
    ...
    "ios" : {
      "infoPlist": {
        "CFBundleAllowMixedLocalizations": true
      }
    },
    "locales": {
      "ru": "./languages/russian.json"
    }
  }
The keys provided to locales should be the 2-letter language code of your desired language, and the value should point to a JSON file that looks something like this:
// russian.json
{
  "CFBundleDisplayName": "Привет",
  "NSContactsUsageDescription": "Эти слова по русски"
}
Now, iOS knows to set the display name of your app to Привет whenever it’s installed on a device with the language set to Russian.

Source: Deploying to App Stores – Expo Documentation

Deploying to App Stores – Expo Documentation was last modified: October 24th, 2020 by Jovan Stosic

node.js – how to achieve an apache Alias with a proxy pass on the same domain – Stack Overflow

<VirtualHost *:80>
    ServerName domain.org
    ServerAlias www.domain.org

    ProxyPass /blog !
    Alias /blog /var/apache-vhosts/www.domain.org-blog

    <Directory /var/apache-vhosts/www.domain.org-blog/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined


    ProxyPass / http://localhost:8884/
    ProxyPassReverse / http://localhost:8884/
    ProxyPreserveHost on
    LogLevel debug
</VirtualHost>

Source: node.js – how to achieve an apache Alias with a proxy pass on the same domain – Stack Overflow

node.js – how to achieve an apache Alias with a proxy pass on the same domain – Stack Overflow was last modified: October 17th, 2020 by Jovan Stosic

Deploying a react app using pm2 and serve · LoginRadius Engineering

Yes, you have learned React and now you can develop a full-fledged front end application. The create-react-app helps you to set up and run a React project, including it code transpiling, basic linting, testing, and build systems. In short, you can start writing React code with minimal preparation. But once your application is done, it is time to deploy the same on the server, you are stuck and you will seek help from your backend or DevOps mates.

Wait!! Being a front end guy it seems to be difficult, but depolying your application on server is relatively easier than writing state management in redux.

In this post, we will learn how to deploy a React application on an Ubuntu 18.04 server using Node.jsserve, and pm2

pm2 is a process manager for the JavaScript runtime Node.js. This is an open-source daemon process manager that helps to manage and keep application 24/7

Prerequisites

To follow this tutorial, you’ll need the following:

  • Latest Node.js version installed on your computer or the Linux server where are you going to deploy the application.
    sudo apt-get update
    sudo apt-get install nodejs
    node -v or node –version
    npm -v or npm –version
  • create-react-app tool
    npm install -g create-react-app

    Deploying the app

    1.First of all, create the app using npx create-react-app

      npx create-react-app my-app

    2.Now you can run the app by running following command in the project directory root

      npm start

    3.The default react app will run in http://localhost:3000

    4.Now install serve and pm2 packages globally on the system/server

    npm install -g serve
    npm install -g pm2

    5.Since you are in the root directory of your project, run the following command to create a production build of your app. This will create a directory named build in the project root directory

    npm run build 

    6.Now we can run the following command to deploy the app

      pm2 serve <path> <port> --spa

    In our case, we can run the following command

    pm2 serve build 8082 --spa 

    PM2 can serve static files very easily with the pm2 serve feature. It supports serving raw files from a specified folder or you can serve a SPA (Single Page Application) with it.

Now you can see that your application is running on 8081 port while you have logged out from your ssh terminal of the browser.

  • Check the status of the application following command in the shell.
    pm2 list

Bonus: Below are some utility commands to manage the pm2 process

  • Specify the app name pm2 --name <app-name>
  • Delete all pm2 process pm2 delete all
  • Delete specific process pm2 delete <app-name>
  • Check the CPU and memory usage pm2 monit

Reference links :-

  1. Quick start pm2
  2. Process management with pm2

Source: Deploying a react app using pm2 and serve · LoginRadius Engineering

Deploying a react app using pm2 and serve · LoginRadius Engineering was last modified: October 16th, 2020 by Jovan Stosic

Set Up a Node.js App for a Website With Apache on Ubuntu 16.04

Introduction

Node.js is a JavaScript runtime environment which lets you easily build server-side applications. This tutorial will explain how to set up a Cloud Server running Ubuntu 16.04 so that Node.js scripts run as a service, and configure the Apache server to make the script accessible from the web.

Although Node.js scripts can be run from the command line using screen, running the scripts as a service using the process manager PM2 gives the scripts a more robust set of behaviors. When run as a service this way, the scripts will automatically restart if the server is rebooted or the script crashes.

PM2 is a process manager for Node.js, with a wide range of features you can use to control and manage your Node.js scripts. Visit the official PM2 website for more information on using PM2.

Requirements

  • A Cloud Server running Linux (Ubuntu 16.04).
  • A working domain name which points to the server.
  • Apache web server installed and running.

Install Node.js

Update your server’s packages and install curl with the following commands:

sudo apt-get update
sudo apt-get install curl
mixed

Download the Node.js PPA:

curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
mixed

Run the nodesource_setup.sh command to add the PPA to your server’s package cache:

sudo bash nodesource_setup.sh
mixed

Note: This script will update the server automatically. There is no need to run apt-get update a second time.

Install Node.js:

sudo apt-get install nodejs
mixed

This will automatically install npm as well.

Finally, install the build-essential package for npm:

sudo apt-get install build-essential
mixed

Create a Sample Node.js Application

For this example we will begin by creating a separate directory in your website’s document root for housing Node.js applications:

sudo mkdir /var/www/html/nodejs
mixed

Create the file hello.js in this directory:

sudo nano /var/www/html/nodejs/hello.js
mixed

Put the following content into the file:

#!/usr/bin/env nodejs
var http = require('http');
http.createServer(function (request, response) {
   response.writeHead(200, {'Content-Type': 'text/plain'});
   response.end('Hello World! Node.js is working correctly.\n');
}).listen(8080);
console.log('Server running at http://127.0.0.1:8080/');
mixed

Save and exit the file.

Make the file executable:

sudo chmod 755 hello.js
mixed

Install PM2

Use npm to install PM2 with the command:

sudo npm install -g pm2
mixed

Start the hello.js example script with the command:

sudo pm2 start hello.js
mixed

As root add PM2 to the startup scripts, so that it will automatically restart if the server is rebooted:

sudo pm2 startup systemd
mixed

Configure Apache

To access the Node.js script from the web, install the Apache modules proxy and proxy_http with the commands:

sudo a2enmod proxy
sudo a2enmod proxy_http
mixed

Once the installation is complete, restart Apache for the changes to take effect:

sudo service apache2 restart
mixed

Next, you will need to add the Apache proxy configurations. These directives need to be inserted into the VirtualHost command block in the site’s main Apache configuration file.

By common convention, this Apache configuration file is usually /etc/apache2/sites-available/example.com.conf on Ubuntu.

Note: The location and filename of a site’s Apache configuration file can vary.

Edit this file with your editor of choice, for example with the command:

sudo nano /etc/apache2/sites-available/example.com.conf
mixed

Scroll through the file until you find the VirtualHost command block, which will look like:

<VirtualHost *:80>
ServerName example.com
    <Directory "/var/www/example.com/html">
    AllowOverride All
    </Directory>
</VirtualHost>
mixed

Add the following to VirtualHost command block:

ProxyRequests Off
   ProxyPreserveHost On
   ProxyVia Full
   <Proxy *>
      Require all granted
   </Proxy>

   <Location /nodejs>
      ProxyPass http://127.0.0.1:8080
      ProxyPassReverse http://127.0.0.1:8080
   </Location>
mixed

Be sure to put these lines outside any Directory command blocks. For example:

<VirtualHost *:80>
ServerName example.com

   ProxyRequests Off
   ProxyPreserveHost On
   ProxyVia Full
   <Proxy *>
      Require all granted
   </Proxy>

   <Location /nodejs>
      ProxyPass http://127.0.0.1:8080
      ProxyPassReverse http://127.0.0.1:8080
   </Location>

    <Directory "/var/www/example.com/html">
    AllowOverride All
    </Directory>
</VirtualHost>
mixed

Save and exit the file, then restart Apache for the changes to take effect:

sudo services apache2 restart`
mixed

After Apache restarts, you can test the application by viewing it in a browser. You should see the message, “Hello World! Node.js is working correctly.”

 

Source: Set Up a Node.js App for a Website With Apache on Ubuntu 16.04 – IONOS

Set Up a Node.js App for a Website With Apache on Ubuntu 16.04 was last modified: October 15th, 2020 by Jovan Stosic

Raina Kabaivanska

Raina Kabaivanska (Bulgarian: Райна Кабаиванска; née Yakimova (Bulgarian: Якимова); born 15 December 1934) is a Bulgarian opera singer, one of the leading lirico-spinto sopranos of her generation, particularly associated with Verdi and Puccini, although she sang a wide range of roles.

https://en.wikipedia.org/wiki/Raina_Kabaivanska

Raina Kabaivanska was last modified: October 1st, 2020 by Jovan Stosic

AT-Commands for NB-IoT – SARA

AT+URAT=8

OK
AT+URAT?

+URAT: 8

OK
AT+CMEE=2

OK
AT+CGDCONT=1,“IP”,“dev.sodaq.com

OK
AT+CGDCONT?

+CGDCONT: 1,“IP”,“dev.sodaq.com”,“0.0.0.0”,0,0,0,0

OK
AT+CFUN=1

OK
AT+COPS=1,2,“23201”

OK
AT+CSQ

+CSQ: 99,99

OK
AT+CREG=2

OK
AT+CREG?

+CREG: 2,2

OK
AT+CGPADDR

+CGPADDR: 1,0.0.0.0

OK
AT+USOCR=17

+CME ERROR: No connection to phone

AT+USOCR=17

+CME ERROR: No connection to phone

AT+USOST=0,“37.97.216.22”,3000,4,“Data”

+CME ERROR: Operation not allowed

AT+USOCL=0

+CME ERROR: Operation not allowed

at AT+USOCR=17 the errors begin.

 

Source: AT-Commands for NB-IoT – SARA – SODAQ Forum

AT-Commands for NB-IoT – SARA was last modified: September 27th, 2020 by Jovan Stosic