Why do we Need This
...
- Install VirtualBox (if you'd not done it already):
- Download the latest version of Virtualbox from here: https://www.virtualbox.org/wiki/Downloads;
- Download VirtualBox Extension Pack from here: https://download.virtualbox.org/virtualbox/6.0.8/VirtualBoxSDK-6.0.8-130520.zip (or newer depending on your VirtualBox version);
- Install VirtualBox and Extension Pack according to VirtualBox installation guide;
- Create VBox VM with the following settings:
- Architecture: x86_64 (see Figure 2);
- Chipset type: Intel ICH9 (see Figure 2);
- Memory: 8GB+ (16GB in my case, see Figure 2);
- Processors: 2, accelerations: ON (see Figure 3 and 4);
- Video settings: Memory: 128MB, 3D acceleration: ON (see Figure 5);
- Disk space: WDI, 40GB, disk type: Fixed (it is faster than dynamic while takes more space);
- Block devices config: SATA only (see Figure 6);
- Host only network (for ssh access): Internal router IP: 192.168.2.1, Netmask 255.255.255.0, DHCP: OFF (see Figure 10);
- Network adapters: 2 x Intel PRO/1000 MT Desktop: 1 - NAT (for external network bridging), 2 - Host-Only Adapter (for SSH access and the like) (see Figures 7 and 8);
- Install Ubuntu (in this guide, you can use your own distro):
- Default installation options could be used.
- Install Linux packages required:
Update repos list and upgrade your distro:
Code Block language bash firstline 1 title Update your distro linenumbers true $ sudo apt update && apt upgrade -y .............. $ sudo apt dist-upgrade -y
Install prerequisite packages:
Code Block language bash firstline 1 title Prerequisites linenumbers true $ sudo apt install -y aptitude mc ubuntu-restricted-extras build-essential git tig crl lynx links dkms inux-headers-generic linux-headers-$(uname -r)
- Install VirtualBox Guest Extensions (according to these guides: https://www.tecmint.com/install-virtualbox-guest-additions-in-ubuntu/, https://www.techrepublic.com/article/how-to-install-virtualbox-guest-additions-on-a-gui-less-ubuntu-server-host/):
- Insert VBox Guest Extensions ISO into VM CD drive;
Become a root and mount Guest Additions ISO into your VM and change to its directory:
Code Block language bash firstline 1 linenumbers true $ sudo su - $ mount /dev/cdrom /media/cdrom $ cd /media/cdrom
Install the Guest Additions package with the command:
Code Block language bash firstline 1 linenumbers true $ ./VBoxLinuxAdditions.run
- Install Java:
you can install OpenJDK and OpenJRE or Oracle Java (according to this guide: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-18-04):
Code Block language bash firstline 1 linenumbers true $ sudo apt install default-jdk default-jre
- Install Google Chrome browser (using this guide: https://askubuntu.com/questions/510056/how-to-install-google-chrome):
Download and import APT key:
Code Block language bash firstline 1 linenumbers true $ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
Install Chrome repository:
Code Block language bash firstline 1 linenumbers true $ echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
install Chrome browser:
Code Block language bash firstline 1 linenumbers true $ sudo apt update $ sudo apt install google-chrome-stable
- Personalize your new browser as usual by introducing your Google account and synchronising it (it will bring all your development extensions you usually have on host machine).
- Install NodeJS environment (according to these guides: https://itsfoss.com/install-nodejs-ubuntu/, https://websiteforstudents.com/install-the-latest-node-js-and-nmp-packages-on-ubuntu-16-04-18-04-lts/):
Download APT repository installer for NodeJS version of your choice (let it be 11.x for example):
Code Block language bash firstline 1 linenumbers true $ curl -sL https://deb.nodesource.com/setup_11.x | sudo bash -
Set up NodeJS & NPM:
Code Block language bash firstline 1 linenumbers true $ apt update && apt install nodejs # checking installed versions: $ node -v # v11.6.0 $ npm -v # 6.5.0-next.0
Update your NPM installation and install all the Node global packages needed:
Code Block language bash firstline 1 linenumbers true $ sudo npm i -g npm $ sudo npm i -g yarn@latest babel-cli@latest babel-preset-env@latest webpack@latest webpack-dev-server@latest eslint@latest create-react-app@latest pm2@latest json-server@latest express@latest typescript@latest
- Install FOLIO development environment (using this guide: https://github.com/folio-org/stripes/blob/master/doc/quick-start.md):
Change to your local user (not root!) home directory, generate your VM's SSH ID and list your public key file contents to the terminal:
Code Block language bash firstline 1 linenumbers true $ cd ~ $ ssh-keygen $ cat ./id-rsa.pub
- Copy the key from terminal and register it in your FOLIO GitHub account.
Set up FOLIO Yarn repository and install Stripes globally:
Code Block language bash firstline 1 linenumbers true $ yarn config set @folio:registry https://repository.folio.org/repository/npm-folio/ $ yarn global add @folio/stripes-cli
Create your VM projects dir within your users home directory to run and debug your tests from it (/home/username/workspace in my case):
Code Block language bash firstline 1 linenumbers true $ mkdir ~/workspace $ chmor -R 775 ./workspace
- Clone your app or Stripes platform from Github repo and follow the instructions on app or platform installation from the guide above. Example related with Stripes workspace and modules ui-eholdings, ui-notes and ui-quick-marc
- Go to folder without subfolder "stripes"
- Run "stripes workspace"
- Select by space items ui-eholdings, ui-inventory, ui-notes, ui-quick-marc, ui-users, stripes-sample-platform
Press Enter. The result:
Code Block language bash collapse true stripes workspace ? Stripes modules to include ui-eholdings, ui-inventory, ui-notes, ui-quick-marc, ui-users, stripes-smart-components Directory "/XXX/stripes" created. Cloning modules... Clone complete. Installing dependencies... Directory "/home/venn/workspace/stripes" yarn install v1.22.17 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in 133.84s. Install complete. Initializing Stripes configuration... Configuration complete. Done. Edit "stripes/.stripesclirc.json" to modify CLI configuration including aliases for this workspace. UI modules available: "ui-eholdings", "ui-inventory", "ui-notes", "ui-quick-marc", "ui-users" "cd" into the above dir(s) and run "stripes serve" to start a module in isolation.
Code Block language bash collapse true ls -la ./stripes/ total 800 drwxrwxr-x 9 venn venn 4096 окт 29 12:22 . drwxrwxr-x 4 venn venn 4096 окт 29 12:18 .. drwxrwxr-x 1452 venn venn 45056 окт 29 12:22 node_modules -rw-rw-r-- 1 venn venn 143 окт 29 12:18 package.json -rw-rw-r-- 1 venn venn 76 окт 29 12:18 .stripesclirc.json drwxrwxr-x 9 venn venn 4096 окт 29 12:21 stripes-smart-components drwxrwxr-x 11 venn venn 4096 окт 29 12:21 ui-eholdings drwxrwxr-x 9 venn venn 4096 окт 29 12:21 ui-inventory drwxrwxr-x 8 venn venn 4096 окт 29 12:21 ui-notes drwxrwxr-x 6 venn venn 4096 окт 29 12:21 ui-quick-marc drwxrwxr-x 9 venn venn 4096 окт 29 12:21 ui-users -rw-rw-r-- 1 venn venn 727968 окт 29 12:22 yarn.lock
Code Block language bash collapse true ls -la ./stripes/stripes-smart-components/ total 144 drwxrwxr-x 9 venn venn 4096 окт 29 12:21 . drwxrwxr-x 9 venn venn 4096 окт 29 12:22 .. -rw-rw-r-- 1 venn venn 42147 окт 29 12:19 CHANGELOG.md drwxrwxr-x 2 venn venn 4096 окт 29 12:19 .circleci -rw-rw-r-- 1 venn venn 148 окт 29 12:19 CONTRIBUTING.md -rw-rw-r-- 1 venn venn 216 окт 29 12:19 .editorconfig -rw-rw-r-- 1 venn venn 25 окт 29 12:19 .eslintignore -rw-rw-r-- 1 venn venn 658 окт 29 12:19 .eslintrc drwxrwxr-x 8 venn venn 4096 окт 29 12:19 .git drwxrwxr-x 3 venn venn 4096 окт 29 12:19 .github -rw-rw-r-- 1 venn venn 59 окт 29 12:19 .gitignore -rw-rw-r-- 1 venn venn 4292 окт 29 12:19 index.js -rw-rw-r-- 1 venn venn 239 окт 29 12:19 Jenkinsfile.deprecated -rw-rw-r-- 1 venn venn 881 окт 29 12:19 karma.conf.js drwxrwxr-x 23 venn venn 4096 окт 29 12:19 lib -rw-rw-r-- 1 venn venn 11357 окт 29 12:19 LICENSE drwxrwxr-x 3 venn venn 4096 окт 29 12:21 node_modules -rw-rw-r-- 1 venn venn 3402 окт 29 12:19 package.json -rw-rw-r-- 1 venn venn 782 окт 29 12:19 README.md -rw-rw-r-- 1 venn venn 1027 окт 29 12:19 .stripesclirc.js -rw-rw-r-- 1 venn venn 354 окт 29 12:19 .stylelintrc drwxrwxr-x 3 venn venn 4096 окт 29 12:19 tests drwxrwxr-x 3 venn venn 4096 окт 29 12:19 translations
Create file stripes-sample-platform/.stripesclirc
Code Block collapse true { "configFile": "stripes.config.js", "port": 8080, "aliases": { "@folio/users": "../ui-users", "@folio/inventory": "../ui-inventory", "@folio/eholdings": "../ui-eholdings", "@folio/notes": "../ui-notes", "@folio/quick-marc": "../ui-quick-marc" } }
- Update stripes-sample-platform/stripes.config.js:
Code Block collapse true module.exports = { okapi: { 'url':'http://localhost:9130', 'tenant':'diku' }, config: { // autoLogin: { username: 'diku_admin', password: 'admin' } // logCategories: 'core,redux,connect,connect-fetch,substitute,path,mpath,mquery,action,event,perm,interface,xhr' // logPrefix: 'stripes' // logTimestamp: false // showPerms: false // showHomeLink: false // listInvisiblePerms: false // disableAuth: false // hasAllPerms: false }, modules: { '@folio/users': {}, '@folio/inventory': {}, '@folio/eholdings': {}, '@folio/quick-marc': {}, }, branding: { logo: { src: './tenant-assets/opentown-libraries-logo.png', alt: 'Opentown Libraries', }, favicon: { src: './tenant-assets/opentown-libraries-favicon.png', }, }, };
- Update stripes-sample-platform/package.json
Code Block collapse true "dependencies": { "@folio/stripes": "^7.0.0", "@folio/users": "^6.0.0", "moment": "~2.25.3", "react": "^17.0.2", "react-dom": "^17.0.2", "react-redux": "^7.2.2", "react-router": "^5.2.0", "react-router-dom": "^5.2.0", "react-query": "^3.13.0", "redux": "^4.0.5" }, "devDependencies": { "@folio/eslint-config-stripes": "^5.0.0", "@folio/stripes-cli": "^2.0.0", "eslint": "^6.2.1", "lodash": "^4.17.5" }, "resolutions": { "@folio/stripes-cli": "^2.0.0", "rxjs": "^6.6.7", "minimist": "^1.2.3", "moment": "~2.29.0", "redux-form": "^8.0.0", "final-form": "4.20.1" }
- Run "yarn stripes platform clean --removeLock"
- Run "yarn install"
- Run "yarn stripes serve --okapi https://folio-snapshot-okapi.dev.folio.org". The result:
Code Block collapse true yarn stripes serve --okapi https://folio-snapshot-okapi.dev.folio.org yarn run v1.22.17 $ stripes serve --okapi https://folio-snapshot-okapi.dev.folio.org Waiting for webpack to build... Listening at http://localhost:8080 webpack built 696609be5483229a9645 in 56285ms
- Set up second network interface that will be used as internal one for ssh and the other similar stuff (it uses static IP address so you don't need to check out what next IP it has via DHCP):
- IP: 192.168.2.2/24, Netmask 255.255.255.0, DNS: 192.168.2.1/24;
- Put VM's IP into host machine's hosts file and vice versa.
- Set up Projects shared directory:
- Point VirtualBox sharing facilities to your projects folder (D:/Users/username/workspace in this example) which we are going to share with our VM (see Figure 9);
Create empty directory for the mount point and give it access rights of your VM user (not root!):
Code Block language bash firstline 1 linenumbers true $ sudo mkdir /usr/www $ sudo chown -R username:usergroup /usr/www $ sudo chmod -R 775 /usr/www
Mount shared folder into your directory of choice (/usr/www in my case) using fstab (/etc/fstab) through vboxsf virtual file system (as root):
Code Block language bash firstline 1 title fstab example linenumbers true UUID=9a4b3832-6258-11e9-859a-080027de5c74 / ext4 defaults 0 0 /swap.img none swap sw 0 0 workspace /usr/www vboxsf auto,uid=1000,gid=1000 0 0 # //192.168.2.1/workspace /usr/www cifs rw,users,credentials=/etc/samba/credentials/sith.local,gid=1002,dir_mode=0775,file_mode=0775 0 0
Check newly created mount point via the following command:
Code Block language bash firstline 1 linenumbers true $ sudo mount -a
this will re-mount all the existing mount points figured out in fstab and in the case of success you will be able to change to your new shared directory and check its contents and access rights using the following commands:
Code Block language bash firstline 1 linenumbers true $ cd /usr/www $ ls -las
...