-
Notifications
You must be signed in to change notification settings - Fork 8
Creating a Basic Bundle
The basic bundle automates many required steps in the unplatform build process, and is the starting point for creating your own final, customized unplatform distribution. It pulls in all of the necessary software components, initializes the web sessions database, and also provides some useful platform-specific scripts. In short, it automates many of the in-the-weeds tasks and codifies knowledge about the unplatform components.
This script is located at scripts/build_scripts/build_script_all_ssl.sh
. There is one script for Windows / Linux / OS X, but it has to be run on the final target platform. i.e. to build for Windows, you run the script on a Windows machine.
Before you build, you need to do the following:
- Install the build platform dependencies
- Set up GitHub SSH keys
- Clone the unplatform repository
- Install unplatform dependencies
- Run the unplatform build script
The instructions for these steps are below.
The build script fetches and builds all of the tools and sub-packages that are required for unplatform
to work. This includes:
- qbank.
- Content player.
- Open assessments player.
- Police Quad.
- Biomechanic.
- Physics video player.
- Open story tool.
- Turtle blocks.
- StarLogoNova simulations.
- Rotation of Earth Animation.
- Motions of the Moon.
- Planet Trek.
- Element Hunt.
- Solar System Animation.
- Moon Track.
- Ratio Patterns.
- Ice Cubes in Lemonade.
- Food Sharing.
The build scripts assume that certain software is installed on your build system. Many of these packages come pre-installed on OS X and Linux, but may not be. Some packages are Windows-specific and can be ignored for other platforms. Because the main target platform is Windows, this section will assume you are setting up a Windows build system.
- 32bit Windows VM or machine. (64bit is okay if your target platform supports it)
-
OpenSSL for Windows.
- Be sure to choose the installer that's compatible with your machine and is recommended for software developers. For example: if your virtual machine is running 32-bit Windows, select the 32-bit version of OpenSSL recommended for software developers.
- You might have to modify your system path to use OpenSSL in the command line. To test this, open Command Prompt and type
openssl
. If that command throws an exception, addopenssl
to your path by doing the following:- Close Command Prompt.
- Right click
My Computer
and selectProperties
. - Click
Advanced
. - Click
Environment Variables
. - Edit
Path
inSystem Variables
(notUser Variables
). - Click
New
in the variable window. - Type in
C:\OpenSSL-Win32\bin
, and save that. - Save and exit the
Properties
modal. - Open Command Prompt and type
openssl
and press the return button. If the command path changes toOpenSSL>
, you've successfully installed OpenSSL and configured your system path to use OpenSSL.
Visual Studio C++ Compiler for Python 2.7.Visual Studio C++ Redistributable.-
Python 2.7.
- You might have to modify your system path to use Python in the command line. To test this, open Command Prompt and type
python
. If that command throws an exception, addpython
to your path by doing the following:- Close Command Prompt.
- Right click
My Computer
and selectProperties
. - Click
Advanced
. - Click
Environment Variables
. - Edit
Path
inSystem Variables
(notUser Variables
). - Click
New
in the variable window. - Type in
C:\Python27
, and save that. -
Edit
thePath
again. - Click
New
again. - Type in
C:\Python27\Scripts
, and save that. - Save and exit the
Properties
modal. - Open Command Prompt and type
python
and press the return button. If the command path changes to>>>
, you've successfully installed Python and configured your system path to use Python.
- You might have to modify your system path to use Python in the command line. To test this, open Command Prompt and type
- Git for Windows.
- Node.js.
-
Yarn.
- Depends on
node.js
. Install that first.
- Depends on
- GNU zip for Windows. Note that this is a command-line only tool, once it is installed.
- Virtualenv:
pip install virtualenv
- Depends on Python. Install that first.
-
Virtualenv wrapper.
- Depends on
virtualenv
. Install that first.
- Depends on
Make sure that you apt-get
install the following packages:
- lib32z1-dev
- libxslt1-dev
- python-dev
- zlib1g-dev
- libssl-dev
- libxml2-dev
- libffi-dev
Since the GitHub tool repositories are currently private, you will need to have SSH keys set up on your GitHub account, on the build machine. Please follow the Github instructions on how to do that.
(once you have all the dependencies installed) In a command prompt window:
- mkvirtualenv unplatform-v2
- git clone https://github.com/CLIxIndia-Dev/unplatform_v2.git
- cd unplatform_v2
- pip install -r requirements.txt
- cd scripts\build_scripts
- build_script_all_ssl.sh
Then, add modules and data manually into the generated bundle. Read this documentation.
In a command prompt window:
- cd unplatform_v2
- workon unplatform-v2
- git pull
- pip install -r requirements.txt
- cd scripts\build_scripts
- build_script_all_ssl.sh
Then, add modules and data manually into the generated bundle. Read this documentation.
More detailed instructions are below.
In Git bash
or Command Prompt, clone the unplatform
repository into a project directory:
git clone https://github.com/CLIxIndia-Dev/unplatform_v2.git
Once you have the above software installed, you need to install the python dependencies (preferably into a virtual environment) using the command prompt or git bash:
In Git bash
or Command Prompt, create a virtual environment:
mkvirtualenv unplatform
This will automatically create and then activate the virtual environment. Your prompt should show the name of the environment, like:
C:\Users\you> mkvirtualenv unplatform-demo
New python executable in C:\Users\you\Envs\unplatform-demo\Scripts\python.exe
Installing setuptools, pip, wheel...done.
(unplatform-demo) C:\Users\you>
To learn more about virtual environments, you can read more on python-guide.org.
If you've already done the above steps and want to activate / use an existing virtual environment, at the command line you can type:
workon unplatform-demo
Your prompt should change to reflect the active environment. Now you can continue building unplatform
.
Once you have a virtual environment, you can run this to install / update the project dependencies. You should run this every time you pull from the repository with updated code:
pip install -r requirements.txt
NOTE: for transfer size reasons, ideally you have no ePubs in your modules/
directory when running the build script, otherwise they will get included in the zip
file and potentially create a 1GB+ file.
You need to bundle on the target deployment platform. For example, to get a Windows bundle, you run build_script_all_ssl.sh
on Windows. After cloning / updating the repository and dependencies:
git pull
cd scripts\build_scripts
build_script_all_ssl.sh
If you set a password on your GitHub SSH private key file, then you will be prompted to enter that password for each of the tool repositories. Note that you only get one chance, and if you type in the wrong password, the script will fail silently -- it will continue building, but the final bundle will be missing that tool.
After the bundling is done (~10 minutes for a first-time build), the final zip
file appears in bundle\unplatform_vX.X.X_win32_ssl.zip
.
Sometimes when building the OEA player, you'll run into an explicit node-sass
error (seen on Windows), or you'll get the final player with no CSS files (seen on Ubuntu). In this case, the node-sass
binary wasn't updated or installed correctly, so you'll need to rebuild it.
cd tool-repos/OpenAssessmentsClient/client
npm rebuild node-sass
Then re-run the build script.
Now that you have a bundled version of unplatform
, you will need to add in the CLIx modules and assessment data. To do so, follow the documentation on the field installation and data files wiki page.
Because the build scripts automatically fetch the latest qbank
bundle from this qbank-lite github repo, in order to update the qbank
version included with unplatform
, you need to bundle qbank
separately and push the bundle to that repository.
Follow the instructions in the qbank wiki to do that.