/appAnalyticsServer

appAnalyticsServer

Primary LanguageSwift

appAnalyticsServer

Currently a WIP not ready for consumption

Getting Started

  1. Install Vapor CLI https://docs.vapor.codes/3.0/install/macos/
  2. git clone git@github.com:mschmulen/appAnalyticsServer.git
  3. cd appAnalyticsServer
  4. vapor build
  5. vapor run
  6. or with xcode user vapor xcode to generate the xcodeproj, open and run
  7. open http://localhost:8080/devices

Local endpoints:

API endpoints:

Web endpoints:

Companion SDK

Companion framework can be found at: https://github.com/mschmulen/appAnalytics-iOS

git clone git@github.com:mschmulen/appAnalytics-iOS.git

Huroku deployment

  1. Install heoku cli: brew tap heroku/brew && brew install heroku
  2. vapor heroku init + n, n, n ?? maybe a y on customExecutable name ???
  3. optional: may need to define a Procfile
  4. optional: heroku git:remote -a llit-oasis-57526
  5. git push heroku master or vapor heroku push

examples:

https://git.heroku.com/llit-oasis-57526.git

Misc heroku commands:

  • heroku logs -n 200
  • heroku logs --tail
  • heroku apps:info

reference doc: https://dev.to/leogdion/a-vapor-guide-setup-and-deployment-with-heroku-and-ubuntu-49jn

https://forums.raywenderlich.com/t/server-side-swift-with-vapor-deploying-to-heroku-ray-wenderlich/22692/3

Misc Curl Commands

curl http://localhost:8080/devices

get events:

curl http://localhost:8080/events

Post to events:

curl -X POST -H "Content-Type: application/json" -d '{"title": "example"}' http://localhost:8080/events

Address already in use

sudo lsof -i :8080 kill 50111

Misc notes

Upgrading vapor Toolbox : brew upgrade vapor or possibly vapor self update

vapor update

==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> libressl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/libressl/certs

and run
  /usr/local/opt/libressl/bin/openssl certhash /usr/local/etc/libressl/certs

libressl is keg-only, which means it was not symlinked into /usr/local,
because LibreSSL is not linked to prevent conflict with the system OpenSSL.

If you need to have libressl first in your PATH run:
  echo 'export PATH="/usr/local/opt/libressl/bin:$PATH"' >> ~/.bash_profile

For compilers to find libressl you may need to set:
  export LDFLAGS="-L/usr/local/opt/libressl/lib"
  export CPPFLAGS="-I/usr/local/opt/libressl/include"

For pkg-config to find libressl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libressl/lib/pkgconfig"