{"id":322169,"date":"2021-04-27T15:00:11","date_gmt":"2021-04-27T15:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=322169"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=322169","title":{"rendered":"TangoRestServer \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<div style=\"text-align:center;\"><img decoding=\"async\" alt=\"main\" width=\"800\" src=\"https:\/\/habrastorage.org\/webt\/lu\/ah\/u_\/luahu_ureofiaunaxa2gkdm2zai.png\"><\/div>\n<p>  <\/p>\n<h2 id=\"chto-takoe-tangorestserverhttpsgithubcomtango-controlsrest-server\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <a href=\"https:\/\/github.com\/tango-controls\/rest-server\" rel=\"nofollow noopener noreferrer\">TangoRestServer<\/a>?<\/h2>\n<p>  <\/p>\n<p>\u042d\u0442\u043e web \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Tango Controls. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0441\u043e\u0431\u0440\u0430\u0442\u044c RestServer \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0438 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 Linux (<a href=\"https:\/\/s2innovation.sharepoint.com\/:f:\/s\/Developers\/EovD2IBwhppAp-ZLXtawQ6gB9F6aXPPs2msr2hgPGTO-FQ?e=Ii3tnr\" rel=\"nofollow noopener noreferrer\"><strong>TangoBox 9.3<\/strong><\/a> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Ubuntu 18.04).<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3 id=\"ustanovka-iz-repozitoriya\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u041f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u0432\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 <strong>get_docker.sh<\/strong> \u0438 <strong>install_rest.sh<\/strong><\/p>\n<p>  <\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 <strong>get_docker.sh<\/strong>, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 docker \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">#!\/usr\/bin\/env bash  sudo apt-get update sudo apt-get install \\     apt-transport-https \\     ca-certificates \\     curl \\     gnupg-agent \\     software-properties-common -y curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add - sudo add-apt-repository \\    &quot;deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu \\    $(lsb_release -cs) \\    stable&quot;  sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io -y  sudo curl -L &quot;https:\/\/github.com\/docker\/compose\/releases\/download\/1.24.0\/docker-compose-$(uname -s)-$(uname -m)&quot; -o \/usr\/local\/bin\/docker-compose sudo curl -L https:\/\/raw.githubusercontent.com\/docker\/compose\/1.24.0\/contrib\/completion\/bash\/docker-compose -o \/etc\/bash_completion.d\/docker-compose  sudo chmod +x \/usr\/local\/bin\/docker-compose sudo usermod -aG docker &quot;$USER&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 <strong>install_rest.sh<\/strong>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u044e \u0432\u0435\u0440\u0441\u0438\u044e docker-\u0430 \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">docker pull tangocs\/rest-server:rest-server-2.1 docker run --restart unless-stopped -p 8080:8080 -d tangocs\/rest-server:rest-server-2.1<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">.\/get_docker.sh .\/install_rest.sh<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0412 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f <strong>tangocs\/rest-server<\/strong>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hp\/vo\/ch\/hpvochw2wqyereteof63f-rxbn8.png\"><\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043f\u043e\u043f\u043e\u043b\u043d\u0438\u043b <strong>tangocs\/rest-server:rest-server-2.1<\/strong>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jm\/7l\/yl\/jm7lylie0tpm2kzitxo4orwh_6y.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tc\/4x\/-t\/tc4x-tgnxlrjhdgjsldvbopwvzc.png\"><\/p>\n<p>  <\/p>\n<p><strong>\u0412\u0430\u0436\u043d\u044b\u0439 \u0430\u043a\u0446\u0435\u043d\u0442<\/strong>, \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 <strong>TangoBox 9.3<\/strong> \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u0440\u044b\u0439 RestServer. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u043d \u043d\u0435 \u0432 docker-\u0435, \u0430 \u0432 <strong>\u0441\u0430\u043c\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/strong>!<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mo\/rr\/op\/morroplid6jp1oaa14wmi__7beo.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zr\/et\/dn\/zretdnrnmlvxtbmlr3vp0pp1slm.png\"><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 <strong>10001<\/strong> \u043f\u043e\u0440\u0442\u0443, \u0438 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0442\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u043c\u043e\u0436\u0435\u0442 \u043a <strong>Tango Controls<\/strong> \u043a\u0430\u043a \u043a <strong>localhost<\/strong>, \u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 docker.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">http:\/\/localhost:10001\/tango\/rest\/rc4\/hosts\/localhost\/10000\/devices\/sys\/tg_test\/1\/attributes\/double_scalar\/value<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0435\u0433\u043e <strong>API<\/strong> \u0443\u0441\u0442\u0430\u0440\u0435\u043b\u043e.<\/p>\n<p>  <\/p>\n<p>docker \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 <strong>8080<\/strong> \u043f\u043e\u0440\u0442\u0443, \u0438 \u0435\u0433\u043e \u043f\u043e\u0440\u0442 \u043f\u0440\u043e\u0431\u0440\u043e\u0448\u0435\u043d \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u041d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a <strong>Tango Controls<\/strong> \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e <strong>ip<\/strong> \u0430\u0434\u0440\u0435\u0441\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b <strong>172.17.0.1<\/strong> \u0433\u0434\u0435 \u0442\u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">http:\/\/localhost:8080\/tango\/rest\/v10\/hosts\/172.17.0.1;port=10000\/devices\/sys\/tg_test\/1\/attributes\/double_scalar\/value<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <strong>\u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e<\/strong> \u0432\u0435\u0440\u0441\u0438\u044e. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432, \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 <strong>2.2<\/strong>.<\/p>\n<p>  <\/p>\n<h3 id=\"ustanovka-iz-ishodnikov\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/tango-controls\/rest-server.git cd rest-server<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f docker \u043f\u043e\u0434 <strong>java<\/strong> \u0432\u0435\u0440\u0441\u0438\u0438 <strong>11<\/strong>, \u043d\u043e \u0432\u0441\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434 <strong>8<\/strong>-\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0439.<br \/>  \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441 8 \u043d\u0430 11.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo update-alternatives --config java<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/0i\/in\/0p\/0iin0pjssdz7skz2g2k6om09u6u.png\"><\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">mvn package docker build -t tangocs\/rest-server:rest-server-2.2 . <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<p>  <\/p>\n<p><code>COPY failed: file not found in build context or excluded by .dockerignore: stat target\/.war: file does not exist<\/code><\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <strong>Dockerfile<\/strong> \u0438 \u043c\u0435\u043d\u044f\u0435\u043c<br \/>  <code>COPY target\/${REST_SERVER_VERSION}.war \/usr\/local\/tomcat\/webapps\/tango.war<\/code><br \/>  \u043d\u0430<br \/>  <code>COPY target\/rest-server-2.2-SNAPSHOT.war \/usr\/local\/tomcat\/webapps\/tango.war<\/code><\/p>\n<p>  <\/p>\n<p>\u0422.\u043a. docker \u0441\u043e\u0431\u0440\u0430\u043b\u0441\u044f \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <strong>rest-server-2.2-SNAPSHOT.war<\/strong><\/p>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u0440\u0430\u0437\u043e\u0432:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wn\/v9\/5e\/wnv95efh8dsmn9agbwhw8ciwa1i.png\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448 docker, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 <strong>8080<\/strong> \u043f\u043e\u0440\u0442\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">docker run --restart unless-stopped -p 8080:8080 -d tangocs\/rest-server:rest-server-2.2<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043a\u0430\u043a \u0438 \u0432 1-\u043e\u043c \u0430\u0431\u0437\u0430\u0446\u0435.<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043c \u0432\u0435\u0440\u0441\u0438\u044e java \u043d\u0430\u0437\u0430\u0434 \u043d\u0430 8-\u0443\u044e.<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo update-alternatives --config java<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/554686\/\"> https:\/\/habr.com\/ru\/post\/554686\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<div style=\"text-align:center;\"><img decoding=\"async\" alt=\"main\" width=\"800\" src=\"https:\/\/habrastorage.org\/webt\/lu\/ah\/u_\/luahu_ureofiaunaxa2gkdm2zai.png\"><\/div>\n<p>  <\/p>\n<h2 id=\"chto-takoe-tangorestserverhttpsgithubcomtango-controlsrest-server\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <a href=\"https:\/\/github.com\/tango-controls\/rest-server\" rel=\"nofollow noopener noreferrer\">TangoRestServer<\/a>?<\/h2>\n<p>  <\/p>\n<p>\u042d\u0442\u043e web \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Tango Controls. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0441\u043e\u0431\u0440\u0430\u0442\u044c RestServer \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0438 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 Linux (<a href=\"https:\/\/s2innovation.sharepoint.com\/:f:\/s\/Developers\/EovD2IBwhppAp-ZLXtawQ6gB9F6aXPPs2msr2hgPGTO-FQ?e=Ii3tnr\" rel=\"nofollow noopener noreferrer\"><strong>TangoBox 9.3<\/strong><\/a> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Ubuntu 18.04).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-322169","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=322169"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322169\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=322169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=322169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=322169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}