Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM node:current as builder

ARG ENVIRONMENT="dev"

# copy whole repo into docker image to start
COPY . .
RUN cp src/config/index.example.js src/config/index.js

# Build stuff, mostly copied from .github/workflows/publish-stage.yaml
#######################################################################
RUN yarn; yarn lint; yarn build:${ENVIRONMENT}

FROM node:current-slim

# copy only build files from builder stage
COPY --chown=node:node --from=builder build /home/node/app/public
COPY --chown=node:node --from=builder node_modules/ /home/node/app/node_modules
COPY --chown=node:node --from=builder /package.json /home/node/app/
COPY --chown=node:node --from=builder src /home/node/app/src
COPY --chown=node:node --from=builder .eslintrc /home/node/app/
COPY --chown=node:node --from=builder .eslintignore /home/node/app/
COPY --chown=node:node docker-scripts/entrypoint.sh /home/node/app/entrypoint.sh

USER node
WORKDIR /home/node/app

ENV STRIPE_PUBLIC_KEY="na"
ENV GOOGLE_ANALYTICS_CODE="na"
ENV YOUTUBE_API_KEY="na"
ENV ENVIRONMENT=$ENVIRONMENT
ENV URL="https://$ENVIRONMENT.studio.harperdb.io"

EXPOSE 3000

ENTRYPOINT ["/home/node/app/entrypoint.sh"]
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
HDBMS_VERSION=$(shell jq -r .version package.json)
WARNING = "The docker images created with this file are not suitable for publishing, so please don't do that."

all: image run

image:
docker buildx build \
--build-arg VCS_REF=`git rev-parse HEAD` \
--build-arg BUILD_DATE=`date -u +%FT%T` \
--progress auto \
--output=type=docker \
--file Dockerfile \
--tag harperdb/hdbms:${HDBMS_VERSION} .
@echo $(WARNING)

run: clean
docker run -d \
-p 3000:3000 \
--name hdbms \
harperdb/hdbms:${HDBMS_VERSION}

get-version:
@echo "HDB_VERSION = $(HDBMS_VERSION)"

clean:
docker rm -f hdbms
55 changes: 55 additions & 0 deletions docker-scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

set -euo pipefail

# write config file
PACKAGE_VERSION=$(sed -nr 's/^\s*\"version": "([0-9]{1,}\.[0-9]{1,}.*)",$/\1/p' ./package.json); \
cat <<EOF > /home/node/app/src/config/index.js
export default {
env: '${ENVIRONMENT}',
stripe_public_key: '${STRIPE_PUBLIC_KEY}',
lms_api_url: 'https://dev.harperdbcloudservices.com/',
google_analytics_code: '${GOOGLE_ANALYTICS_CODE}',
youtube_api_key: '${YOUTUBE_API_KEY}',
postman_collection_url: 'https://www.postman.com/collections/7046690-5a70b340-8fe1-4487-88bd-ffac077c3df8',
tc_version: '2020-01-01',
check_version_interval: 300000,
refresh_content_interval: 15000,
total_cloud_instance_limit: 10,
free_cloud_instance_limit: 1,
total_local_instance_limit: false,
free_local_instance_limit: false,
max_file_upload_size: 10380902,
studio_version:'${PACKAGE_VERSION}',
user_guide_id: 16032,
alarm_badge_threshold: 86400,
maintenance: 0,
errortest: 0
};
EOF

# write manifest file
cat <<EOF > /home/node/app/public/manifest.json
{
"short_name": "HarperDB Studio",
"name": "HarperDB Studio",
"icons": [
{
"src": "favicon.ico",
"sizes": "16x16",
"type": "image/x-icon"
},
{
"src": "images/logo_vertical_white.png",
"type": "image/png",
"sizes": "536x672"
}
],
"start_url": "${URL}",
"display": "standalone",
"theme_color": "#480b8a",
"background_color": "#ffffff"
}
EOF

npm run docker
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"scripts": {
"start": "HTTPS=true SSL_CRT_FILE=./.cert/cert.pem SSL_KEY_FILE=./.cert/key.pem react-scripts start",
"start:local": "REACT_APP_LOCALSTUDIO=true HTTPS=true SSL_CRT_FILE=./.cert/cert.pem SSL_KEY_FILE=./.cert/key.pem react-scripts start",
"docker": "HTTPS=false react-scripts start",
"build:dev": "PUBLIC_URL=https://d2uv4fa0aeja0t.cloudfront.net react-scripts build",
"build:stage": "GENERATE_SOURCEMAP=false PUBLIC_URL=https://dbjxbnqel2bw9.cloudfront.net react-scripts build",
"build:prod": "GENERATE_SOURCEMAP=false PUBLIC_URL=https://ds5zz9rfvzuta.cloudfront.net react-scripts build",
Expand All @@ -17,6 +18,7 @@
"lint-prod": "eslint --fix src"
},
"dependencies": {

"@monaco-editor/react": "^4.2.0",
"@stripe/react-stripe-js": "^2.1.0",
"@stripe/stripe-js": "^2.1.11",
Expand Down Expand Up @@ -65,6 +67,7 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-private-property-in-object": "^7.23.4",
"eslint": "^8.32.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.0.0",
Expand All @@ -74,8 +77,8 @@
"prettier": "^3.1.0",
"sass": "^1.46.0",
"stylelint": "^16.0.2",
"stylelint-config-sass-guidelines": "^10.0.0",
"stylelint-config-standard": "^35.0.0",
"stylelint-config-sass-guidelines": "^11.0.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-order": "^6.0.1",
"stylelint-scss": "^6.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/SignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function SignUp() {
<div id="login-form" className="sign-up">
<Card className="mb-3">
<CardBody className="px-3" onKeyDown={(e) => e.keyCode !== 13 || setFormState({ submitted: true })}>
<div className="sign-up-header">Sign Up And Launch Your Free HarperDB Cloud Instance Today</div>
<div className="sign-up-header">Sign Up And Launch Your HarperDB Cloud Instance Today</div>
<Row>
<Col xs="12" md="8">
<div className="sign-up-content">
Expand Down
3 changes: 2 additions & 1 deletion src/components/instances/new/Confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ function Confirm() {
const { tc_version } = formData;
if (submitted) {
if (tc_version) {
if (window._kmq) window._kmq.push(['record', totalPrice ? 'purchased instance' : 'created free instance', analyticsProductsArray]);
if (window._kmq)
window._kmq.push(['record', totalPrice ? 'purchased instance' : newInstance.is_local ? 'registered local instance' : 'created free instance', analyticsProductsArray]);
setNewInstance({ ...newInstance, tc_version });
setTimeout(() => navigate(`/o/${customer_id}/instances/new/status`), 0);
} else {
Expand Down
Loading