Swiftpack.co - Package - gerardogrisolini/Webretail
Webretail - RMS

Webretail - RMS

Retail Management System and e-Commerce developed with Swift 4.1, Angular 6.0 and PostgreSQL 10.0.

Under active development. Please do not use.

Try Demo Webretail usr: admin pwd: admin

Try WebApp for eCommerce e-Commerce

Build Notes

Ensure you have installed Xcode 9.0 or later.

macOS

To install and link libxml2 with homebrew, use the following two commands

brew install libxml2
brew link --force libxml2

To install postgres:

brew install postgres

To install nodejs. libgd and phantomjs:

brew install node gd phantomjs

Linux

Ensure that you have installed libxml2-dev and pkg-config.

sudo apt-get install libxml2-dev pkg-config

To install libpq-dev libgd-dev

sudo apt-get install libpq-dev libgd-dev

To install nodejs and phantomjs:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

sudo apt-get install build-essential chrpath libssl-dev libxft-dev libfreetype6-dev libfreetype6 libfontconfig1-dev libfontconfig1 -y
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
sudo tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
sudo ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/

Setup - Xcode 9

  • If you want to regenerate the xcode project
  • In terminal, navigate to the directory and execute
swift package generate-xcodeproj
  • Open Webretail.xcodeproj

To run this project from Xcode, edit the Scheme, Under "Options" for "run", check "Use custom working directory" and choose the project's working directory. After doing this, the project can be run from within Xcode.

Setup - Terminal

  • Check out or download the project;
  • In terminal, navigate to the directory
  • Execute swift build -c release
  • Once the project has compiled, execute sudo ../.build/x86_64-unknown-linux/release/Webretail
[INFO] Starting HTTP server on 0.0.0.0:8080 with document root ./webroot

Angular 5 - Terminal

Steps for the development UI:

in the subfolders:

  • AdminUI
  • WebUI
npm install
npm start

Steps for build UI:

npm run build

Docker - Terminal

  • Postgresql
docker pull postgres
docker run -p 5432:5432 --name db -e POSTGRES_DB=webretail -e POSTGRES_PASSWORD=zBnwEe8QDR -d postgres
  • Webretail
docker build -t webretail .
docker run -d -p 80:8080 --link db -t webretail

Heroku

Config Vars:

LANG = C.UTF-8
LC_ALL = C.UTF-8
HOST = webretail.herokuapp.com

Buildpack:

https://github.com/heroku/heroku-buildpack-apt.git
https://github.com/stomita/heroku-buildpack-phantomjs.git
https://github.com/kylef/heroku-buildpack-swift.git

Install on linux as service

nano /etc/systemd/system/webretail.service

[Unit]
Description=Swift Application running on Ubuntu 16.04
[Service]
WorkingDirectory=/root/Webretail
ExecStart=/root/webretail/.build/x86_64-unknown-linux/release/Webretail
Restart=always
RestartSec=10
SyslogIdentifier=webretail
User=root
Environment=SWIFT_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
  • Commands
systemctl enable webretail.service
systemctl start webretail.service
systemctl status webretail.service
systemctl stop webretail.service