Update dev deployment strategy.

This commit is contained in:
Ben Binder
2025-03-08 09:42:49 -06:00
parent abb00b7688
commit 404b1adc33
5 changed files with 49 additions and 12 deletions

View File

@@ -36,8 +36,8 @@ steps:
script:
- echo "$REGISTRY_PASSWORD" | docker login registry.binderlab.io --username "$REGISTRY_USERNAME" --password-stdin
- docker pull registry.binderlab.io/harbormaster-server:latest
- docker stop harbormaster || true
- docker rm harbormaster || true
- docker run -d --name harbormaster -p 7080:8080 -e RESET_DB $RESET_DB registry.binderlab.io/harbormaster:latest
- docker stop harbormaster-server || true
- docker rm harbormaster-server || true
- docker run -d --name harbormaster-server -p 7080:8080 -e RESET_DB $RESET_DB registry.binderlab.io/harbormaster-server:latest
when:
event: manual

View File

@@ -28,7 +28,7 @@ WORKDIR /root
COPY --from=builder /root/harbormaster .
#COPY database/gold.db /root/database/gold.db
#COPY migrations /root/migrations
COPY ../scripts/ /root/scripts/
COPY ../scripts/ ./scripts/
RUN chmod +x /root/scripts/startup.sh
# Expose the port the app runs on

19
readme.md Normal file
View File

@@ -0,0 +1,19 @@
# Harbormaster Server
## Deployment notes:
### Development:
- Use `scripts/dev.sh`.
- Stops and removes old versions if they exist.
- Builds the image.
- Runs the image in detached mode.
- Tails the container logs on the console.
NOTE: `docker-compose.dev.yml` is not used, kept around for now in case it's useful when setting up the front end.
### Production:
- Use `ci.binderlab.io` (Woodpecker).
- Builds the image.
- Pushes the new image to the registry at `registry.binderlab.io`.
- Pulls down the new image.
- Stops and removes old versions of the app.
- Runs the pulled image in detached mode.

View File

@@ -1,12 +1,30 @@
#!/bin/bash
# cleanup() {
# echo "Stopping Docker containers..."
# docker-compose down
# }
cleanup() {
echo "Stopping Docker containers..."
docker stop harbormaster-server
docker rm harbormaster-server
echo "Done!"
}
# trap cleanup EXIT SIGINT SIGTERM
trap cleanup SIGINT SIGTERM
cd ../
echo "Starting application..."
docker compose -p harbormaster-server -f docker/docker-compose.dev.yml up -d --build
if [ "$(docker ps -a | grep harbormaster-server)" ]; then
echo "Removing existing harbormaster-server container..."
docker stop harbormaster-server
docker rm harbormaster-server
fi
# if [ "$RESET_DB" == "true" ]; then
# echo "Resetting database from gold..."
# cp database/gold.db database/app.db
# elif [ ! -f database/app.db ]; then
# echo "Creating database from gold..."
# cp database/gold.db database/app.db
# else
# echo "Using existing database..."
# fi
echo "Building harbormaster-server image..."
docker build -t harbormaster-server -f docker/Dockerfile .
echo "Starting containers..."
docker run -d --name harbormaster-server -p 7080:8080 harbormaster-server
echo "Tailing logs..."
docker logs harbormaster-server -f

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/ash
cd /root
echo "Starting application..."