-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doccano updated implementation (#1031)
* Updating the doccano implentation scripts * Updating labeling-text-using-doccano guide * More udpate to labeling-text-using-doccano guide * removing stray cells from labeling-text-using-doccano guide * adding option to remove doccano db while uninstalling * Sending the unnecessary logs to current user's temp directory * Updating guide to use v1.2.4 doccano image * Updating guide to use v1.2.4 doccano image for linux * Removing double quotes from messages. * Setting doccano version to 1.2.4 for linux
- Loading branch information
Showing
14 changed files
with
188 additions
and
154 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Write-Host "Checking for elevated permissions..." | ||
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(` | ||
[Security.Principal.WindowsBuiltInRole] "Administrator")) { | ||
Write-Output 0 | ||
} | ||
else { | ||
Write-Output 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
$username = Read-Host "Enter username" | ||
|
||
if($username.length -lt 6 ) | ||
{ | ||
Write-Output 0 | ||
} | ||
else { | ||
Write-Output $username | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$password1 = Read-Host "Enter password" -AsSecureString | ||
$password1 = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($password1) | ||
$password1 = [Runtime.InteropServices.Marshal]::PtrToStringAuto($password1) | ||
|
||
$password2 = Read-Host "Re-enter password" -AsSecureString | ||
$password2 = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($password2) | ||
$password2 = [Runtime.InteropServices.Marshal]::PtrToStringAuto($password2) | ||
|
||
if($password1 -eq $password2){ | ||
if($password2.length -lt 6 ){ | ||
Write-Output 1 | ||
} | ||
else { | ||
Write-Output $password1 | ||
} | ||
|
||
} | ||
else{ | ||
Write-Output 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,91 @@ | ||
@echo off | ||
SET DIR=%~dp0% | ||
|
||
SET DIR_=%~dp0 | ||
for /f "delims=" %%i in ('powershell -file %DIR_%elevated_prompt_check.ps1') do set admin=%%i | ||
|
||
if %admin%==0 ( | ||
powershell start '%~f0' ' %*' -verb runas 2>nul && exit /b | ||
echo Need to run this installation as an administrator | ||
pause | ||
exit) | ||
|
||
cd / | ||
mkdir doccano | ||
cd c:/doccano | ||
mkdir logs | ||
cd %DIR% | ||
cd %DIR_% | ||
set hr=%time:~0,2% | ||
set hr=%hr: =0% | ||
set LOGFILE=C:\doccano\logs\install_log_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%.txt | ||
|
||
call :LOG1 2> %LOGFILE% | ||
|
||
python "%DIR%doccano\app\manage.py" migrate | ||
python "%DIR%doccano\app\manage.py" createsuperuser | ||
echo "-----Installing chocolatey-----"> %LOGFILE% | ||
call :install_chocolatey 2>> %LOGFILE% | ||
choco feature enable -n allowGlobalConfirmation | ||
echo "-----Installing dependencies-----">> %LOGFILE% | ||
call :install_deps 2>> %LOGFILE% | ||
echo "-----Setting doccano username-----">> %LOGFILE% | ||
call :getusrname 2>> %LOGFILE% | ||
echo "-----Setting doccano password-----">> %LOGFILE% | ||
call :getpwd 2>> %LOGFILE% | ||
echo "-----Setting up doccano service-----">> %LOGFILE% | ||
@REM GOTO :end | ||
call :setup_doccano_service 2>> %LOGFILE% | ||
echo Doccano successfully installed | ||
echo Starting doccano at http://localhost:8000 ...... | ||
timeout 20 > %temp%\null | ||
start explorer http://localhost:8000 | ||
exit /B | ||
|
||
call :LOG2 2>> %LOGFILE% | ||
:install_chocolatey | ||
|
||
::install chocolatey | ||
echo Installing chocolatey... | ||
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR_%install_chocolatey.ps1' %*" -Verb RunAs | ||
call refresh_path.bat | ||
echo Installing python... | ||
::install python | ||
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR_%install_deps.ps1' %*" -Verb RunAs | ||
call refresh_path.bat | ||
exit /B | ||
|
||
:LOG2 | ||
|
||
call "C:/doccano/venv/scripts/deactivate" | ||
cd "%DIR%doccano\app\server\static" | ||
call npm install | ||
cd "%DIR%" | ||
copy "%DIR%annotation.html" "%DIR%doccano\app\server\templates" /Y | ||
net stop doccano /Y | ||
:install_deps | ||
pip install virtualenv | ||
virtualenv "C:/doccano/venv" | ||
call C:/doccano/venv/scripts/activate | ||
pip install doccano==1.2.4 | ||
cd "%DIR_%" | ||
net stop doccano /Y >%temp%\null | ||
nssm remove doccano confirm | ||
nssm install doccano %DIR%run_doccano.bat %DIR% | ||
nssm start doccano | ||
net stop start_webpack /Y | ||
nssm remove start_webpack confirm | ||
nssm install start_webpack %DIR%start_webpack.bat %DIR% | ||
nssm start start_webpack | ||
pause | ||
@REM set /p doccano_username="Enter username:" | ||
@REM set /p doccano_password="Enter Password:" | ||
@REM :getpwd | ||
exit /B | ||
|
||
:LOG1 | ||
|
||
::install chocolatey | ||
echo installing chocolatey | ||
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%install_chocolatey.ps1' %*" -Verb RunAs | ||
call refresh_path.bat | ||
echo installing git,node and python | ||
::install git,node and python | ||
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%install_deps.ps1' %*" -Verb RunAs | ||
SET PATH=%PATH%;C:\Program Files\Git\bin;C:\Program Files\nodejs | ||
|
||
:setup_doccano_service | ||
call refresh_path.bat | ||
pip install virtualenv | ||
virtualenv "C:/doccano/venv" | ||
call C:/doccano/venv/scripts/activate | ||
python -m pip install --force-reinstall pip | ||
call git clone https://github.com/doccano/doccano.git doccano | ||
cd "%DIR%doccano" | ||
call git checkout bdba2961bf7942eb529a1591a7499b5d15af73bf | ||
git config --global url."https://".insteadOf git:// | ||
pip install -r "%DIR%doccano\requirements.txt" | ||
cd "%DIR%doccano\frontend" | ||
SET PATH=%PATH%;%systemroot%\System32\WindowsPowerShell\v1.0\ | ||
call npm install --global windows-build-tools --vs2015 | ||
SET NODE_GYP_FORCE_PYTHON=%userprofile%\.windows-build-tools\python27\python.exe | ||
call npm install | ||
call npm run build | ||
cd "%DIR%doccano\app" | ||
nssm install doccano %DIR_%run_doccano.bat "%doccano_username% %doccano_password%" | ||
nssm start doccano > %temp%\null | ||
call C:/doccano/venv/scripts/deactivate | ||
exit /B | ||
|
||
:getpwd | ||
|
||
for /f "delims=" %%i in ('powershell -file getpwd.ps1') do set doccano_password=%%i | ||
if /I %doccano_password%==0 echo Passwords don't match && GOTO :getpwd | ||
if /I %doccano_password%==1 echo "Password does not meet length(>5) requirement" && GOTO :getpwd | ||
exit /B | ||
|
||
|
||
:getusrname | ||
for /f "delims=" %%i in ('powershell -file get_username.ps1') do set doccano_username=%%i | ||
if /I %doccano_username%==0 echo Username does not meet length(^>5) requirement && GOTO :getusrname | ||
exit /B | ||
|
||
|
||
:end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
|
||
$git_installed = cver all -lo | Select-string -Pattern "^git" | ||
if ($git_installed.length -eq 0 ) { | ||
choco install -y git.install | ||
} | ||
else { | ||
echo "Skipping git installation" | ||
} | ||
$python_installed = cver all -lo | Select-string -Pattern "^python" | ||
# $git_installed = cver all -lo | Select-string -Pattern "^git" | ||
# if ($git_installed.length -eq 0 ) { | ||
# choco install -y git.install | ||
# } | ||
# else { | ||
# echo "Skipping git installation" | ||
# } | ||
$python_installed = cver all -lo | Select-string -Pattern "python3 3.9.4" | ||
if ($python_installed.length -eq 0 ) { | ||
choco install -y python --version=3.7.2 | ||
choco install -y python3 --version=3.9.4 | ||
} | ||
else { | ||
echo "Skipping python installation" | ||
} | ||
$node_installed = cver all -lo | Select-string -Pattern "^nodejs" | ||
if ($node_installed.length -eq 0 ) { | ||
choco install -y nodejs --version=13.11.0 | ||
} | ||
else { | ||
echo "Skipping node installation" | ||
} | ||
# $node_installed = cver all -lo | Select-string -Pattern "^nodejs" | ||
# if ($node_installed.length -eq 0 ) { | ||
# choco install -y nodejs --version=13.11.0 | ||
# } | ||
# else { | ||
# echo "Skipping node installation" | ||
# } | ||
$nssm_installed = cver all -lo | Select-string -Pattern "^nssm" | ||
if ($nssm_installed.length -eq 0 ) { | ||
choco install -y nssm | ||
} | ||
else { | ||
echo "Skipping nssm installation" | ||
} | ||
echo "Skipping nssm installation" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
@echo off | ||
|
||
SET DIR=%~dp0% | ||
cd %DIR%doccano/app | ||
SET DIR_=%~dp0 | ||
call "c:/doccano/venv/scripts/activate" | ||
python manage.py runserver | ||
cd %DIR% | ||
cd \doccano | ||
doccano --username %1 --password %2 | ||
cd %DIR_% | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Set-ExecutionPolicy Bypass -Scope Process -Force | ||
"y"|choco uninstall git.install -n --skipautouninstaller | ||
"y"|choco uninstall python --version=3.7.2 -n --skipautouninstaller | ||
"y"|choco uninstall nodejs --version=13.11.0 -n --skipautouninstaller | ||
"y"|choco uninstall nssm -n --skipautouninstaller | ||
# choco uninstall python --version=3.9.4 -y | ||
choco uninstall python3 --version=3.9.4 -y | ||
"y"|choco uninstall nssm -n --skipautouninstaller | ||
|