Skip to content

Commit

Permalink
Add compose files. Purge malformed autoinstall code.
Browse files Browse the repository at this point in the history
  • Loading branch information
rin-skylight committed Jan 3, 2025
1 parent b061fed commit 66db0b5
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 33 deletions.
77 changes: 77 additions & 0 deletions docker/ecr-viewer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: '3.8'

services:
ecr-viewer:
image: ghcr.io/cdcgov/phdi/ecr-viewer:v1.7.2
restart: always
env_file: "ecr-viewer.env"
ports:
- "3000:3000"
networks:
- dibbs

ingestion:
image: ghcr.io/cdcgov/phdi/ingestion:v1.7.2
restart: always
ports:
- "8080:8080"
networks:
- dibbs

validation:
image: ghcr.io/cdcgov/phdi/validation:v1.7.2
restart: always
ports:
- "8081:8080"
networks:
- dibbs

fhir-converter:
image: ghcr.io/cdcgov/phdi/fhir-converter:v1.7.2
restart: always
ports:
- "8082:8080"
networks:
- dibbs

message-parser:
image: ghcr.io/cdcgov/phdi/message-parser:v1.7.2
restart: always
ports:
- "8083:8080"
networks:
- dibbs

trigger-code-reference:
image: ghcr.io/cdcgov/phdi/trigger-code-reference:v1.7.2
restart: always
ports:
- "8084:8080"
networks:
- dibbs

orchestration:
image: ghcr.io/cdcgov/phdi/orchestration:v1.7.2
env_file: "orchestration.env"
restart: always
ports:
- "8085:8080"
networks:
- dibbs

portainer:
image: portainer/portainer-ce
restart: always
ports:
- "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
networks:
- dibbs

volumes:
portainer_data:

networks:
dibbs:
14 changes: 14 additions & 0 deletions docker/ecr-viewer/ecr-viewer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
AWS_REGION=${AWS_REGION}
ECR_BUCKET_NAME=${ECR_BUCKET_NAME}
HOSTNAME=0.0.0.0
NEXT_PUBLIC_NON_INTEGRATED_VIEWER=${NEXT_PUBLIC_NON_INTEGRATED_VIEWER}
SOURCE=${SOURCE}
APP_ENV=${APP_ENV}
NBS_PUB_KEY=${NBS_PUB_KEY}
NEXT_PUBLIC_BASEPATH=${NEXT_PUBLIC_BASEPATH}
METADATA_DATABASE_TYPE=${METADATA_DATABASE_TYPE}
METADATA_DATABASE_SCHEMA=${METADATA_DATABASE_SCHEMA}
DATABASE_URL=${DATABASE_URL}
SQL_SERVER_USER=${SQL_SERVER_USER}
SQL_SERVER_PASSWORD=${SQL_SERVER_PASSWORD}
SQL_SERVER_HOST=${SQL_SERVER_HOST}
8 changes: 8 additions & 0 deletions docker/ecr-viewer/orchestration.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
OTEL_METRICS=none
OTEL_METRICS_EXPORTER=none
ECR_VIEWER_URL=http://ecr-viewer:3000/ecr-viewer
INGESTION_URL=http://ingestion:8080
VALIDATION_URL=http://validation:8080
FHIR_CONVERTER_URL=http://fhir-converter:8080
MESSAGE_PARSER_URL=http://message-parser:8080
TRIGGER_CODE_REFERENCE_URL=http://trigger-code-reference:8080
41 changes: 12 additions & 29 deletions packer/ubuntu-server/http/user-data
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
autoinstall:
version: 1

# apt:
# preserve_sources_list: false
# primary:
# - arches:
# - amd64
# - i386
# uri: http://mirror.local.net/ubuntu

apt:
geoip: true
preserve_sources_list: false
Expand Down Expand Up @@ -44,37 +52,12 @@ autoinstall:
# The system being installed will need some sort of apt access.
# proxy: http://192.168.0.1:3142

late-commands:
- "echo 'Defaults:ubuntu !requiretty' > /target/etc/sudoers.d/ubuntu"
- "echo 'ubuntu ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/ubuntu"
- "chmod 440 /target/etc/sudoers.d/ubuntu"
- "truncate -s 0 /etc/machine-id /var/lib/dbus/machine-id"

# Install Docker
- curtin in-target -- apt-get update
- curtin in-target -- install -m 0755 -d /etc/apt/keyrings
- curtin in-target -- curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
- curtin in-target -- chmod a+r /etc/apt/keyrings/docker.asc
- curtin in-target -- echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
- curtin in-target -- apt-get update
- curtin in-target -- apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

# Clone Compose Files


# Set Compose to Autostart




late-commands:
# A postinstall script may optionally be used for further install
# customization. Deploy this postinstall.sh script on the webserver.
# - wget -O /target/postinstall.sh http://192.168.0.2/postinstall.sh
# - curtin in-target -- bash /postinstall.sh
# - rm /target/postinstall.sh
- wget -O /target/postinstall.sh https://raw.githubusercontent.com/CDCgov/dibbs-vm/refs/heads/main/packer/ubuntu-server/scripts/post-install.sh
- curtin in-target -- bash /postinstall.sh
- rm /target/postinstall.sh

# Additional cloud-init configuration affecting the target
# system can be supplied underneath a user-data section inside of
Expand Down
18 changes: 14 additions & 4 deletions packer/ubuntu-server/scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ echo \
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y


# Clone Compose files


# Adjust Docker group permissions
groupadd docker
usermod -aG docker ubuntu
newgrp docker

# Set Docker as system service and enable container autostart
systemctl enable docker.service
systemctl enable containerd.service

# Clone Compose files
cd ~
mkdir dev
cd dev
git clone https://github.com/CDCgov/dibbs-vm.git
cd dibbs-vm/docker/ecr-viewer

# Trigger initial docker compose to pull image data
docker compose up -d
1 change: 1 addition & 0 deletions packer/ubuntu-server/ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ vm_name = "ubuntu-2404-ecrViewer.raw"
"initrd /casper/initrd<enter><wait><wait>",
"boot<enter><wait>"
]
# boot_command = ["<wait>e<wait5>", "<down><wait><down><wait><down><wait2><end><wait5>", "<bs><bs><bs><bs><wait>autoinstall ---<wait><f10>"]
http_directory = "http"
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
ssh_username = "packer"
Expand Down

0 comments on commit 66db0b5

Please sign in to comment.