38 lines
1.4 KiB
Plaintext
38 lines
1.4 KiB
Plaintext
I am taking this as a test project for docker and terraform too...
|
|
The Terraform part is on the more "enterprise" side with not only just a public IP on the EC2.
|
|
|
|
for the docker imaging look at: https://www.fosstechnix.com/how-to-create-docker-image-for-node-js-application/
|
|
The docker image can be built with
|
|
podman build -t dumbserver .
|
|
|
|
the image then can be extracted with
|
|
podman image save -o dumbserver.image.tar dumbserver
|
|
|
|
on the target machine it can be imported with
|
|
podman image load -i dumbserer.image.tar
|
|
|
|
and running a container with the image id done via:
|
|
podman run --name dumbserver -p 1280:1280 dumbserver
|
|
(Port 1280 is what it listens on)
|
|
|
|
updating the image from a local file (in podman):
|
|
podman pull oci-archive:/tmp/dumbserver.image.tar
|
|
then the container needs to be re-created... stop/rm/run
|
|
|
|
At this stage, terraform will create an ssh accessable server (key is in "terraformtest1.ppk") - tutorial used for that: https://medium.com/@hmalgewatta/setting-up-an-aws-ec2-instance-with-ssh-access-using-terraform-c336c812322f
|
|
|
|
As part of the terraform, I copy a script to install docker/podman - and upload the image
|
|
then I set up the container and start it. that's it.
|
|
|
|
initialize with
|
|
terraform init
|
|
|
|
then plan
|
|
terraform plan
|
|
|
|
then apply
|
|
terraform apply
|
|
|
|
To read the terraform output into powershell use
|
|
$Json_Output = (& terraform output -json) | ConvertFrom-Json
|