From 1861ea6e28c498a7230fc4ec65e815d385a72e34 Mon Sep 17 00:00:00 2001 From: mircea-c Date: Mon, 20 Jan 2020 13:53:12 -0500 Subject: [PATCH 1/3] tm-web-backend image --- ami-tm-web-backend/backend.service | 19 +++++++++++++++++++ ami-tm-web-backend/install_backend.sh | 15 ++++++++++++++- ami-tm-web-backend/nginx.conf | 18 ++++++++++++++++++ ami-tm-web-backend/tm-web-backend.json | 12 +++++++++++- 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 ami-tm-web-backend/backend.service diff --git a/ami-tm-web-backend/backend.service b/ami-tm-web-backend/backend.service new file mode 100644 index 0000000..149b412 --- /dev/null +++ b/ami-tm-web-backend/backend.service @@ -0,0 +1,19 @@ +[Unit] +Description=TM Web Backend +Requires=network-online.target +After=network-online.target + +[Service] +Type=exec +User=backend +Group=backend +Restart=on-failure +WorkingDirectory=/home/backend/backend +PermissionsStartOnly=true +Environment=PORT=39206 +ExecStart=/usr/bin/npm run start +ExecReload=/bin/kill -HUP $MAINPID +KillSignal=SIGTERM + +[Install] +WantedBy=multi-user.target diff --git a/ami-tm-web-backend/install_backend.sh b/ami-tm-web-backend/install_backend.sh index f3acfd0..815e100 100644 --- a/ami-tm-web-backend/install_backend.sh +++ b/ami-tm-web-backend/install_backend.sh @@ -1,2 +1,15 @@ -#!/usr/bin/bash -xe +#!/bin/bash -xe +git clone https://github.com/tendermint/backend.git + +cd backend + +npm install + +cd .. + +sudo mv backend /home/backend +sudo chown -R backend:backend /home/backend/backend + +sudo mv /tmp/backend.service /lib/systemd/system/backend.service +sudo systemctl enable backend \ No newline at end of file diff --git a/ami-tm-web-backend/nginx.conf b/ami-tm-web-backend/nginx.conf index facd79b..eb44bba 100644 --- a/ami-tm-web-backend/nginx.conf +++ b/ami-tm-web-backend/nginx.conf @@ -2,6 +2,7 @@ # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ +user backend; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; @@ -53,6 +54,8 @@ http { proxy_pass https://medium.com/feed/cosmos-blockchain; } + + error_page 404 /404.html; location = /40x.html { } @@ -65,5 +68,20 @@ http { listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot } + + server { + listen 80; + listen [::]:80; + server_name blogrss.cosmos.network; + + location / { + server_tokens off; + + proxy_redirect off; + proxy_set_header x-forwarded-for $remote_addr; + proxy_set_header host $http_host; + proxy_pass https://localhost:39206; + } + } } diff --git a/ami-tm-web-backend/tm-web-backend.json b/ami-tm-web-backend/tm-web-backend.json index 048099f..4d0ceb5 100644 --- a/ami-tm-web-backend/tm-web-backend.json +++ b/ami-tm-web-backend/tm-web-backend.json @@ -42,8 +42,18 @@ "sudo mv /tmp/nginx.conf /etc/nginx/nginx.conf", "sudo systemctl enable nginx", "curl -sL https://deb.nodesource.com/setup_{{ user `node_version` }} | sudo -E bash -", - "sudo apt-get -y install nodejs" + "sudo apt-get -y install nodejs", + "sudo useradd -m backend" ] + }, + { + "type": "file", + "source": "backend.service", + "destination": "/tmp/backend.service" + }, + { + "type": "shell", + "script": "install_backend.sh" } ] } \ No newline at end of file From 14262f3e6671af4505773716362b0cd050f3b90a Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 7 Feb 2020 11:53:01 +0100 Subject: [PATCH 2/3] image: update docker image for buf Signed-off-by: Marko Baricevic --- docker-protoc/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-protoc/Dockerfile b/docker-protoc/Dockerfile index 04c08c4..9986402 100644 --- a/docker-protoc/Dockerfile +++ b/docker-protoc/Dockerfile @@ -1,8 +1,8 @@ FROM ubuntu:18.04 ENV PROTOC_VERSION=3.11.2 -ENV GO_VERSION=1.13.5 -ENV BUF_VERSION=0.5.0 +ENV GO_VERSION=1.13.7 +ENV BUF_VERSION=0.7.0 ENV PATH="${PATH}:/usr/local/go/bin:/root/go/bin" ENV BIN="/usr/local/bin" From 54aea438954aea7e115e5b332bdfff1bb496c0f4 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Mon, 9 Mar 2020 19:14:18 +0100 Subject: [PATCH 3/3] docker-tm-db-testing: fix RocksDB build, and clean up Docker image --- docker-tm-db-testing/Dockerfile | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/docker-tm-db-testing/Dockerfile b/docker-tm-db-testing/Dockerfile index e08fc9f..4a48b60 100644 --- a/docker-tm-db-testing/Dockerfile +++ b/docker-tm-db-testing/Dockerfile @@ -1,13 +1,30 @@ FROM circleci/golang -RUN sudo apt-get install -y --no-install-recommends libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev libzstd-dev +ENV LD_LIBRARY_PATH=/usr/local/lib + +RUN sudo apt-get install -y --no-install-recommends \ + libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev libzstd-dev # Install cleveldb -RUN wget https://github.com/google/leveldb/archive/v1.20.tar.gz && tar xvf v1.20.tar.gz && rm -f v1.22.tar.gz -RUN cd leveldb-1.20 && make && sudo scp -r out-static/lib* out-shared/lib* "/usr/local/lib" && cd include && sudo scp -r leveldb /usr/local/include && sudo ldconfig && cd ~ +RUN \ + wget https://github.com/google/leveldb/archive/v1.20.tar.gz \ + && tar xvf v1.20.tar.gz \ + && cd leveldb-1.20 \ + && make \ + && sudo cp -a out-static/lib* out-shared/lib* /usr/local/lib \ + && cd include \ + && sudo cp -a leveldb /usr/local/include \ + && sudo ldconfig \ + && cd ../.. \ + && rm -rf v1.20.tar.gz leveldb-1.20 # Install Rocksdb -RUN git clone https://github.com/facebook/rocksdb.git && cd rocksdb/ && sudo make install - -# Install boltdb -RUN go get go.etcd.io/bbolt/... +RUN \ + wget https://github.com/facebook/rocksdb/archive/v6.6.4.tar.gz \ + && tar -zxf v6.6.4.tar.gz \ + && cd rocksdb-6.6.4 \ + && DEBUG_LEVEL=0 make -j4 shared_lib \ + && sudo make install-shared \ + && sudo ldconfig \ + && cd .. \ + && rm -rf v6.6.4.tar.gz rocksdb-6.6.4