Skip to content

Commit 73ef641

Browse files
authored
Fixing Esri#723 - issues with doccano windows deployment package. (Esri#724)
* fixing long path length ssue for py packages and pinnin node version to 13.11.0 * updating --skipautouninstaller flg * updating python version to 3.7.2 and creating the virtual env for docanno at root of C directory to avoid long path problem. * 'updating the readme and piinin vs_uild_tools to vs2015" * fixing pip error in venv * enabled logging
1 parent 1a5d596 commit 73ef641

6 files changed

Lines changed: 76 additions & 39 deletions

File tree

misc/tools/doccano_deployment/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33

44
## This process will automatically install the following deployment related requirements:
55
- Node.js, nssm, Git, Chocolatey & Windows build tools. (all of these to the, latest release)
6-
- Python (ver. 3.6.8)
6+
- Python (ver. 3.7.2)
77
- Python virtual environment, with all the necessary dependencies.
88
- The deployment will take around 30-60 minutes, _depending on the internet speed & pre-installed requirements, if any._
99

10+
## Make sure to place the deployment folder on C drive.
1011
## Run 'Install.bat' as _admin._ to initiate the script.
12+
## Please note that the vs_build_tools installation will take a long time and it will seem like it is stuck with a message
13+
## "Python 2.7 is successfuly installed", let the setup run as it is installing build tools in the background at that point.
1114
## At the final stage, it will ask the user to setup 'username' & 'password'.
15+
## Incase install package crashes, restart your system and run 'Install.bat' as _admin._ again.
1216
## Post deployment, docanno can be accessed from http://127.0.0.1:8000/ or http://localhost:8000/ .
1317
### *For uninstalling doccano, run 'uninstall.bat' as _admin._*
1418
### *More info on doccano at: https://github.com/doccano/doccano*
19+

misc/tools/doccano_deployment/install.bat

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,65 @@
11
@echo off
2-
32
SET DIR=%~dp0%
3+
cd /
4+
mkdir doccano
5+
cd c:/doccano
6+
mkdir logs
47
cd %DIR%
8+
set hr=%time:~0,2%
9+
set hr=%hr: =0%
10+
set LOGFILE=C:\doccano\logs\install_log_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%.txt
11+
12+
call :LOG1 2> %LOGFILE%
13+
14+
python "%DIR%doccano\app\manage.py" migrate
15+
python "%DIR%doccano\app\manage.py" createsuperuser
16+
17+
call :LOG2 2>> %LOGFILE%
18+
19+
exit /B
20+
21+
:LOG2
22+
23+
call "C:/doccano/venv/scripts/deactivate"
24+
cd "%DIR%doccano\app\server\static"
25+
call npm install
26+
cd "%DIR%"
27+
copy "%DIR%annotation.html" "%DIR%doccano\app\server\templates" /Y
28+
net stop doccano /Y
29+
nssm remove doccano confirm
30+
nssm install doccano %DIR%run_doccano.bat %DIR%
31+
nssm start doccano
32+
net stop start_webpack /Y
33+
nssm remove start_webpack confirm
34+
nssm install start_webpack %DIR%start_webpack.bat %DIR%
35+
nssm start start_webpack
36+
pause
37+
exit /B
38+
39+
:LOG1
40+
541
::install chocolatey
42+
echo installing chocolatey
643
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%install_chocolatey.ps1' %*" -Verb RunAs
744
call refresh_path.bat
45+
echo installing git,node and python
846
::install git,node and python
947
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%install_deps.ps1' %*" -Verb RunAs
1048
SET PATH=%PATH%;C:\Program Files\Git\bin;C:\Program Files\nodejs
1149
call refresh_path.bat
1250
pip install virtualenv
13-
virtualenv venv
14-
call venv/scripts/activate
51+
virtualenv "C:/doccano/venv"
52+
call C:/doccano/venv/scripts/activate
53+
python -m pip install --force-reinstall pip
1554
call git clone https://github.com/doccano/doccano.git doccano
1655
cd "%DIR%doccano"
1756
call git checkout bdba2961bf7942eb529a1591a7499b5d15af73bf
1857
git config --global url."https://".insteadOf git://
1958
pip install -r "%DIR%doccano\requirements.txt"
2059
cd "%DIR%doccano\frontend"
2160
SET PATH=%PATH%;%systemroot%\System32\WindowsPowerShell\v1.0\
22-
call npm install --global windows-build-tools
61+
call npm install --global windows-build-tools --vs2015
2362
SET NODE_GYP_FORCE_PYTHON=%userprofile%\.windows-build-tools\python27\python.exe
2463
call npm install
2564
call npm run build
2665
cd "%DIR%doccano\app"
27-
python "%DIR%doccano\app\manage.py" migrate
28-
python "%DIR%doccano\app\manage.py" createsuperuser
29-
call deactivate
30-
cd "%DIR%doccano\app\server\static"
31-
call npm install
32-
cd "%DIR%"
33-
copy "%DIR%annotation.html" "%DIR%doccano\app\server\templates" /Y
34-
net stop doccano /Y
35-
nssm remove doccano confirm
36-
nssm install doccano %DIR%run_doccano.bat %DIR%
37-
nssm start doccano
38-
net stop start_webpack /Y
39-
nssm remove start_webpack confirm
40-
nssm install start_webpack %DIR%start_webpack.bat %DIR%
41-
nssm start start_webpack
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11

22
$git_installed = cver all -lo | Select-string -Pattern "^git"
33
if ($git_installed.length -eq 0 ) {
4-
choco install -y git
4+
choco install -y git.install
55
}
66
else {
77
echo "Skipping git installation"
88
}
9-
$git_installed = cver all -lo | Select-string -Pattern "^python"
10-
if ($git_installed.length -eq 0 ) {
11-
choco install -y python --version=3.6.8
9+
$python_installed = cver all -lo | Select-string -Pattern "^python"
10+
if ($python_installed.length -eq 0 ) {
11+
choco install -y python --version=3.7.2
1212
}
1313
else {
1414
echo "Skipping python installation"
1515
}
16-
$git_installed = cver all -lo | Select-string -Pattern "^nodejs"
17-
if ($git_installed.length -eq 0 ) {
18-
choco install -y nodejs
16+
$node_installed = cver all -lo | Select-string -Pattern "^nodejs"
17+
if ($node_installed.length -eq 0 ) {
18+
choco install -y nodejs --version=13.11.0
1919
}
2020
else {
2121
echo "Skipping node installation"
2222
}
23-
$git_installed = cver all -lo | Select-string -Pattern "^nssm"
24-
if ($git_installed.length -eq 0 ) {
23+
$nssm_installed = cver all -lo | Select-string -Pattern "^nssm"
24+
if ($nssm_installed.length -eq 0 ) {
2525
choco install -y nssm
2626
}
2727
else {
2828
echo "Skipping nssm installation"
29-
}
29+
}

misc/tools/doccano_deployment/run_doccano.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
SET DIR=%~dp0%
44
cd %DIR%doccano/app
5-
call %DIR%venv/scripts/activate
5+
call "c:/doccano/venv/scripts/activate"
66
python manage.py runserver
77
cd %DIR%

misc/tools/doccano_deployment/uninstall.bat

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
@echo off
2+
set hr=%time:~0,2%
3+
set hr=%hr: =0%
4+
set LOGFILE=C:\doccano\logs\uninstall_log_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%.txt
5+
call :LOG 2> %LOGFILE%
6+
exit /B
7+
8+
:LOG
29

310
SET DIR=%~dp0%
411
net stop doccano /Y
@@ -9,6 +16,9 @@ nssm remove start_webpack confirm
916
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%uninstall.ps1' %*" -Verb RunAs
1017
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%uninstall_chocolatey.ps1' %*" -Verb RunAs
1118
cd %DIR%
19+
del /f /s /q %DIR%doccano 1>nul
1220
call rmdir /Q /S %DIR%doccano
13-
call rmdir /Q /S %DIR%venv
14-
echo "Uninstalled"
21+
del /f /s /q C:/doccano/venv 1>nul
22+
call rmdir /Q /S "C:/doccano/venv"
23+
echo "Uninstalled"
24+
pause
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
Set-ExecutionPolicy Bypass -Scope Process -Force
2-
"y"|choco uninstall git -n --skip-autouninstaller
3-
choco uninstall python -y -n --skip-autouninstal
4-
"y"|choco uninstall nodejs -n --skip-autouninstal
5-
"y"|choco uninstall yarn -n --skip-autouninstal
6-
"y"|choco uninstall nssm -n --skip-autouninstal
7-
2+
"y"|choco uninstall git.install -n --skipautouninstaller
3+
"y"|choco uninstall python --version=3.7.2 -n --skipautouninstaller
4+
"y"|choco uninstall nodejs --version=13.11.0 -n --skipautouninstaller
5+
"y"|choco uninstall nssm -n --skipautouninstaller

0 commit comments

Comments
 (0)