Develop Peek Platform¶
Warning
This document extends, Setup OS Requirements Windows or the Setup OS Requirements Linux depending on your OS.
Most development will be for the plugins, not platform, so these instructions are not high priority.
Synerty uses PyCharm as its choice of IDE and Git management tool.
GitLab to manage and share your Git repositories: https://gitlab.synerty.com
Note
The reader needs be familiar with, or will become familiar with the following:
- GIT
- Python 3.6+
- Python Twisted
- HTML
- SCSS
- Ant Design
- TypeScript
- Angular (Angular2+, not AngularJS aka Angular1)
- CapacitorJS
Note
This a cross platform development guide, all commands are writen for bash.
Bash is installed by default on Linux.
Windows users should use bash from msys, which comes with git for windows, Setup Msys Git.
Development Setup Objective¶
This guide lists the synerty-peek repositories that can be cloned and how to clone. The document contains instructions for obtaining the dependencies, building the front end packages and Building synerty-peek for development or production.
There is assumed understanding of git, forking and committing.
Hardware Recommendation¶
- 32gb of ram (minimum 16gb)
Software Installation and Configuration¶
On a Windows machine the follow commands will be run using the bash shell, see Setup Msys Git.
Synerty Peek Repositories¶
- synerty-peek
- peek-plugin-base
- peek-plugin-base-js
- peek-agent
- peek-client
- peek-mobile
- peek-platform
- peek-server
- peek-admin
- peek-worker
Fork Peek Repositories¶
Create a GitLab group using your hyphenated full name as the namespace, i.e.
https://gitlab.synerty.com/john-smith
Create a GitLab subgroup under your namespace named peek, i.e.
https://gitlab.synerty.com/john-smith/peek
Create a GitLab subgroup under your namespace named peek-util, i.e.
https://gitlab.synerty.com/john-smith/peek-util
Create a GitLab access token with a 24 hour expiry :
https://gitlab.synerty.com/profile/personal_access_tokens
Fork all repositories from https://gitlab.synerty.com/peek to your namespace/peek subgroup:
export ACCESS_TOKEN="" # https://gitlab.synerty.com/profile/personal_access_tokens
export GROUP_ID="2" # https://gitlab.synerty.com/peek
export YOUR_SUBGROUP_ID="" # Your namespace/peek subgroup id to fork to
function loadProjectIds() {
curl --location --request GET "https://gitlab.synerty.com/api/v4/groups/${GROUP_ID}/projects?per_page=100" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header 'Content-Type: application/json' \
--data-raw '' | jq '.[] .id'
}
for REPO_ID in `loadProjectIds`
do
curl --location --request POST "https://gitlab.synerty.com/api/v4/projects/${REPO_ID}/fork" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--data-raw '{"id":"${ID}","namespace":${YOUR_SUBGROUP_ID}}'
done
Fork all repositories from https://gitlab.synerty.com/peek-util to your namespace/peek-util subgroup:
export ACCESS_TOKEN="" # https://gitlab.synerty.com/profile/personal_access_tokens
export GROUP_ID="26" # https://gitlab.synerty.com/peek-util
export YOUR_SUBGROUP_ID="" # Your namespace/peek-util subgroup id to fork to
function loadProjectIds() {
curl --location --request GET "https://gitlab.synerty.com/api/v4/groups/${GROUP_ID}/projects?per_page=100" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header 'Content-Type: application/json' \
--data-raw '' | jq '.[] .id'
}
for REPO_ID in `loadProjectIds`
do
curl --location --request POST "https://gitlab.synerty.com/api/v4/projects/${REPO_ID}/fork" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--data-raw '{"id":"${ID}","namespace":${YOUR_SUBGROUP_ID}}'
done
Clone all of the projects in your namespace/peek subgroup to ~/peek/dev-peek/:
export ACCESS_TOKEN="" # https://gitlab.synerty.com/profile/personal_access_tokens
export YOUR_NAMESPACE="" # Your GitLab namespace group, i.e. "john-smith"
export YOUR_SUBGROUP_ID="" # Your GitLab namespace/peek subgroup id
export DIR="~/peek/dev-peek"
function loadProjectIds() {
curl --location --request GET "https://gitlab.synerty.com/api/v4/groups/${YOUR_SUBGROUP_ID}/projects?per_page=100" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header 'Content-Type: application/json' \
--data-raw '' | jq '.[] .name'
}
if [ ! -d ${DIR} ]; then
mkdir ${DIR}
cd $DIR
for REPO_NAME in `loadProjectIds`
do
NAME="${REPO_NAME%\"}"
NAME="${NAME#\"}"
URL=https://gitlab.synerty.com/$YOUR_NAMESPACE/$NAME.git
echo $URL
git clone $URL
done
fi
Clone all of the projects in your namespace/peek-util subgroup to ~/peek/dev-peek-util/:
export ACCESS_TOKEN="" # https://gitlab.synerty.com/profile/personal_access_tokens
export YOUR_NAMESPACE="" # Your GitLab namespace group, i.e. "john-smith"
export YOUR_SUBGROUP_ID="" # Your GitLab namespace/peek subgroup id
export DIR="~/peek/dev-peek-util"
function loadProjectIds() {
curl --location --request GET "https://gitlab.synerty.com/api/v4/groups/${YOUR_SUBGROUP_ID}/projects?per_page=100" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header 'Content-Type: application/json' \
--data-raw '' | jq '.[] .name'
}
if [ ! -d ${DIR} ]; then
mkdir ${DIR}
cd $DIR
for REPO_NAME in `loadProjectIds`
do
NAME="${REPO_NAME%\"}"
NAME="${NAME#\"}"
URL=https://gitlab.synerty.com/$YOUR_NAMESPACE/$NAME.git
echo $URL
git clone $URL
done
fi
Note
core.symlink: If false, symbolic links are checked out as small plain files that contain the link text. The default is true, except git-clone or git-init will probe and set core.symlinks false if appropriate when the repository is created.
Setup Cloned Repositories For Development¶
Run setup.py in all of the repositories located in ~/peek/dev-peek/:
set -e
cd ~/peek/dev-peek
for DIR in */; do
cd "$DIR"
NAME=${PWD##*/}
echo "$NAME"
pip uninstall -y "$NAME"
python setup.py develop
cd ..
done
Run setup.py in all of the repositories located in ~/peek/dev-peek-util/:
set -e
cd ~/peek/dev-peek-util
for DIR in */; do
cd "$DIR"
NAME=${PWD##*/}
echo "$NAME"
pip uninstall -y "$NAME"
python setup.py develop
cd ..
done
Install Front End Modules¶
Remove the old npm modules files and re-install for both client and server front and packages. Run the following commands:
cd ~/peek/dev-peek/peek-mobile/peek_mobile/build-web
[ -d node_modules ] && rm -rf node_modules
npm i
cd ~/peek/dev-peek/peek-desktop/peek_desktop/build-web
[ -d node_modules ] && rm -rf node_modules
npm i
cd ~/peek/dev-peek/peek-admin/peek_admin/build-web
[ -d node_modules ] && rm -rf node_modules
npm i
Configure Peek Client And Server Settings¶
Open the config file located at ~/peek/peek-client.home/config.json
Set the property frontend.docBuildEnabled to false.
Set the property frontend.webBuildEnabled to false.
Open the config file located at ~/peek/peek-server.home/config.json
Set the property frontend.docBuildEnabled to false.
Set the property frontend.webBuildEnabled to false.
Set the property httpServer.admin.recovery_user.username to “recovery”.
Set the property httpServer.admin.recovery_user.password to “synerty”.
Compile Front End Packages For Development¶
Run the following commands in separate terminal sessions:
# Terminal 1
cd ~/peek/dev-peek/peek-mobile/peek_mobile/build-web
ng build --watch
# Terminal 2
cd ~/peek/dev-peek/peek-admin/peek_admin/build-web
ng build --watch
# Terminal 3
cd ~/peek/dev-peek/peek-desktop/peek_desktop/build-web
ng build --watch
# Terminal 4
run_peek_server
# Terminal 5
run_peek_client
Viewing Peek Services In The Browser¶
Peek Mobile: http://localhost:8000
Peek Desktop: http://localhost:8002
Peek Admin: http://localhost:8010
What Next?¶
Refer back to the How to Use Peek Documentation guide to see which document to follow next.