Skip to content

Commit

Permalink
update deployment process to support multiple environments
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkunz committed Dec 3, 2024
1 parent 8c7b2b5 commit 3c4a347
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
version: '3.9'
services:
frontend:
container_name: frontend
image: 'ghcr.io/tradingstrategy-ai/frontend:${TS_PUBLIC_FRONTEND_VERSION_TAG}'
ports:
# The production server has :80 port bind by Caddy.
# Mapped in reverse proxy Caddyfile
# https://github.com/tradingstrategy-ai/proxy-server/blob/master/Caddyfile
- '127.0.0.1:3000:3000'
- '127.0.0.1:${FRONTEND_PORT:-3000}:3000'
command: node --require dd-trace/init scripts/server.js
# See https://stackoverflow.com/a/67158212/315168
extra_hosts:
Expand Down
29 changes: 20 additions & 9 deletions scripts/update-production.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
#!/bin/bash
#
# - Update frontend docker and restart
# - Make sure we have all environment variables set
# Update frontend docker and restart
#
# Usage: ./update-production <version-tag>
#

set -e

if [ -z "$TS_PUBLIC_FRONTEND_VERSION_TAG" ] ; then
echo "Please set TS_PUBLIC_FRONTEND_VERSION_TAG"
echo "export TS_PUBLIC_FRONTEND_VERSION_TAG="
if [ $# -ne 1 ]; then
echo "Please provide version tag as argument"
echo "Usage: $0 <version-tag>"
echo "See https://github.com/tradingstrategy-ai/frontend/pkgs/container/frontend"
exit 1
fi

# Set version tag
export TS_PUBLIC_FRONTEND_VERSION_TAG="$1"

# Set project name based on directory name, or override with env var
export COMPOSE_PROJECT_NAME=${TS_PROJECT_NAME:-$(basename $(pwd))}

source ~/secrets.env

docker-compose up -d
# Source local config if exists (overrides shared secrets)
if [ -f ./config.env ]; then
source ./config.env
fi

docker compose up -d

echo "All ok"
sleep 5
docker ps | grep frontend


docker ps --filter name="${COMPOSE_PROJECT_NAME}-frontend-1"
docker compose logs --tail=20

0 comments on commit 3c4a347

Please sign in to comment.