Merge pull request #25 from rbrooklyn/master

Various small enhancements
This commit is contained in:
Simon Lindh 2020-02-15 11:55:18 +07:00 committed by GitHub
commit 727179037e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 22 deletions

View File

@ -4,9 +4,8 @@ RUN mkdir /mempool.space/
COPY ./backend /mempool.space/backend/ COPY ./backend /mempool.space/backend/
COPY ./frontend /mempool.space/frontend/ COPY ./frontend /mempool.space/frontend/
COPY ./mariadb-structure.sql /mempool.space/mariadb-structure.sql COPY ./mariadb-structure.sql /mempool.space/mariadb-structure.sql
#COPY ./nginx.conf /mempool.space/nginx.conf
RUN apk add mariadb mariadb-client jq git nginx npm rsync RUN apk add mariadb mariadb-client git nginx npm rsync bash
RUN mysql_install_db --user=mysql --datadir=/var/lib/mysql/ RUN mysql_install_db --user=mysql --datadir=/var/lib/mysql/
RUN /usr/bin/mysqld_safe --datadir='/var/lib/mysql/'& \ RUN /usr/bin/mysqld_safe --datadir='/var/lib/mysql/'& \
@ -32,12 +31,8 @@ ENV DB_PORT 3306
ENV DB_USER mempool ENV DB_USER mempool
ENV DB_PASSWORD mempool ENV DB_PASSWORD mempool
ENV DB_DATABASE mempool ENV DB_DATABASE mempool
ENV HTTP_PORT 80
ENV API_ENDPOINT /api/v1/ ENV API_ENDPOINT /api/v1/
ENV CHAT_SSL_ENABLED false ENV CHAT_SSL_ENABLED false
#ENV CHAT_SSL_PRIVKEY
#ENV CHAT_SSL_CERT
#ENV CHAT_SSL_CHAIN
ENV MEMPOOL_REFRESH_RATE_MS 500 ENV MEMPOOL_REFRESH_RATE_MS 500
ENV INITIAL_BLOCK_AMOUNT 8 ENV INITIAL_BLOCK_AMOUNT 8
ENV DEFAULT_PROJECTED_BLOCKS_AMOUNT 3 ENV DEFAULT_PROJECTED_BLOCKS_AMOUNT 3
@ -48,8 +43,6 @@ ENV BITCOIN_NODE_USER bitcoinuser
ENV BITCOIN_NODE_PASS bitcoinpass ENV BITCOIN_NODE_PASS bitcoinpass
ENV TX_PER_SECOND_SPAN_SECONDS 150 ENV TX_PER_SECOND_SPAN_SECONDS 150
#RUN echo "mysqld_safe& sleep 20 && cd /mempool.space/backend && rm -f mempool-config.json && rm -f cache.json && touch cache.json && jq -n env > mempool-config.json && node dist/index.js" > /entrypoint.sh
RUN cd /mempool.space/frontend/ && \ RUN cd /mempool.space/frontend/ && \
npm run build && \ npm run build && \
rsync -av --delete dist/mempool/ /var/www/html/ rsync -av --delete dist/mempool/ /var/www/html/

View File

@ -1,10 +1,51 @@
#!/bin/sh #!/bin/bash
## Start SQL
mysqld_safe& mysqld_safe&
sleep 5 sleep 5
## http server:
nginx nginx
## Set up some files:
cd /mempool.space/backend cd /mempool.space/backend
rm -f mempool-config.json
rm -f cache.json rm -f cache.json
touch cache.json touch cache.json
jq -n env > mempool-config.json
## Build mempool-config.json file ourseleves.
## We used to use jq for this but that produced output which caused bugs,
## specifically numbers were surrounded by quotes, which breaks things.
## Old command was jq -n env > mempool-config.json
## This way is more complex, but more compatible with the backend functions.
## Define a function to allow us to easily get indexes of the = string in from the env output:
strindex() {
x="${1%%$2*}"
[[ "$x" = "$1" ]] && echo -1 || echo "${#x}"
}
## Regex to check if we have a number or not:
NumberRegEx='^[0-9]+$'
## Delete the old file, and start a new one:
rm -f mempool-config.json
echo "{" >> mempool-config.json
## For each env we add into the mempool-config.json file in one of two ways.
## Either:
## "Variable": "Value",
## if a string, or
## "Variable": Value,
## if a integer
for e in `env`; do
if [[ ${e:`strindex "$e" "="`+1} =~ $NumberRegEx ]] ; then
## Integer add:
echo "\""${e:0:`strindex "$e" "="`}"\": "${e:`strindex "$e" "="`+1}"," >> mempool-config.json
else
## String add:
echo "\""${e:0:`strindex "$e" "="`}"\": \""${e:`strindex "$e" "="`+1}$"\"," >> mempool-config.json
fi
done
## Take out the trailing , from the last entry.
## This means replacing the file with one that is missing the last character
echo `sed '$ s/.$//' mempool-config.json` > mempool-config.json
## And finally finish off:
echo "}" >> mempool-config.json
## Start mempoolspace:
node dist/index.js node dist/index.js

View File

@ -41,22 +41,12 @@ export class BlockchainProjectedBlocksComponent implements OnInit, OnDestroy {
getStyleForProjectedBlockAtIndex(index: number) { getStyleForProjectedBlockAtIndex(index: number) {
const greenBackgroundHeight = 100 - (this.projectedBlocks[index].blockWeight / 4000000) * 100; const greenBackgroundHeight = 100 - (this.projectedBlocks[index].blockWeight / 4000000) * 100;
if (window.innerWidth <= 768) { if (window.innerWidth <= 768) {
if (index === 3) {
return {
'top': 40 + index * 155 + 'px'
};
}
return { return {
'top': 40 + index * 155 + 'px', 'top': 40 + index * 155 + 'px',
'background': `repeating-linear-gradient(#554b45, #554b45 ${greenBackgroundHeight}%, 'background': `repeating-linear-gradient(#554b45, #554b45 ${greenBackgroundHeight}%,
#bd7c13 ${Math.max(greenBackgroundHeight, 0)}%, #c5345a 100%)`, #bd7c13 ${Math.max(greenBackgroundHeight, 0)}%, #c5345a 100%)`,
}; };
} else { } else {
if (index === 3) {
return {
'right': 40 + index * 155 + 'px'
};
}
return { return {
'right': 40 + index * 155 + 'px', 'right': 40 + index * 155 + 'px',
'background': `repeating-linear-gradient(#554b45, #554b45 ${greenBackgroundHeight}%, 'background': `repeating-linear-gradient(#554b45, #554b45 ${greenBackgroundHeight}%,

View File

@ -35,7 +35,6 @@ http {
server { server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name docker.lan;
root /var/www/html; root /var/www/html;