Merge pull request 'Readme + skripta za upload na VPS' (#1) from mt-initial-setup into master

Reviewed-on: #1
mt-homonymy-support
matic_t 4 years ago
commit b764d59602

3
.gitignore vendored

@ -5,7 +5,8 @@ __pycache__
build/*
!build/Makefile
!build/download_structure_conversions.sh
!build/build_and_upload.sh.template
!build/config.json
# using kdev4, works fairly nicely!
.kdev4
**/*.kdev4

@ -1,8 +1,50 @@
# Build
**Getting started**
To build, you need transcrypt, you need to do npm install and then you need api key for gitea (`token=$API_KEY`), just find this on gitea.cjvt.si, not that hard.
- Prerequisites:
- Installed git, npm
- Installed Python 3.7 as default python3 version
- Gitea account and access to `generic` organization
After you have all of this, move to build folder, set `API_KEY` environment variable and then build it just using `make` or for release use `make release` - optimized javascript build.
- Download transcrypt version that supports -od parameter:
- `git clone https://github.com/QQuick/Transcrypt.git`
- `cd Transcrypt`
- `git checkout remotes/origin/dev_fall_2019`
- `git switch -c dev_fall_2019`
- `python3 setup.py build`
- `python3 setup.py install --user`
- Sometimes it will be found as `transcrpyt -V` and sometimes as `python3 -m transcrypt -V`
For me its `API_KEY=(cat ~/.gitea_api_key) make`.
- Get api token for requests to lexonomy structure_conversions:
- Login to `https://gitea.cjvt.si/`
- Navigate to Profile -> Settings
- Navigate to Applications
- Generate token, then copy token from the blue field **above** Manage Access Tokens card. If you fail to do so,
delete that token and generate new one
- Save it in a plain file
- Setup lexonomy_custom_editor:
- `git clone https://gitea.cjvt.si/lexonomy/lexonomy_custom_editor.git`
- `cd lexonomy_custom_editor`
- `npm i`
- `cd build`
- `touch conversions.csv`
- Run make with file content as variable: `API_KEY=$(cat location/to/file/name) make`
- If any error occurs with conversions.csv or inside download_structure_conversions.sh, run make clean before starting the above command again
This concludes setup of local settings. You are ready to delve into it. To test, you can open main.html file inside /build
##### Best way to test is probably to deploy your editor version to https://lexonomy.cjvt.si/
- SSH required
- You need account and access to CJVT machine which admin can provide
- Connect with `ssh accountName -p password`, admin will provide sudo password
- Create plugins directory on your account
- Move inside directory
- Give it 775 permissions (`sudo chmod 775 .`)
To deploy new test editor version:
- **Note:** This script builds current plugin version, uploads it to VPS and creates a symlink to location where server can pick them up.
- Navigate to /build and create local build_and_upload.sh script (`cp build_and_upload.sh.template build_and_upload.sh`)
- Open build_and_upload.sh file and uncomment and configure the top 4 variables
- Whenever you want to upload new plugin to lexonomy, simply run `./build_and_upload.sh plugin_name` where you specify plugin_name. If specific plugin already exists, things might go bananas
- You will be requested to enter sudo password for the VPS

@ -0,0 +1,27 @@
#!/bin/bash
#############################################################################
# NOTE: Update .template if logical changes are made to the script #
#############################################################################
# Alter these variables
#USERNAME= vps_sign_in(probably name@lexonomy.cjvt.si
#VPS_PASSWORD= vps password
#VPS_USERNAME= user name inside vps(probably name from @lexonomy)
#API_KEY= $(cat path/to/api/token/file)
# Exit if no argument is passed on run
if [[ -z "$1" ]]; then
echo "Must provide plugin name in environment" 1>&2
exit 1
fi
PLUGIN_NAME=$1
# Build the plugin
API_KEY=$API_KEY make
# zip all the required files and upload them to ssh
tar czf - ./config.json ./bundle.js ./local.js ./main.css ./main.html | ssh $USERNAME -p $VPS_PASSWORD "cd plugins && mkdir $PLUGIN_NAME && cd $PLUGIN_NAME && tar xvzf -"
# Create a simlink on VPS that will enable specific plugin on https://lexonomy.cjvt.si/
# Routes must be absolute or it doesn't work.
ssh -t $USERNAME -p $VPS_PASSWORD "sudo ln -s /home/$VPS_USERNAME/plugins/$PLUGIN_NAME /home/ozbolt/plugins/$PLUGIN_NAME"

@ -0,0 +1,5 @@
{
"dependencies": [], "globals": [],
"javascript": "$LOCATION$/bundle.js",
"css": ["$LOCATION$/main.css"]
}
Loading…
Cancel
Save