Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Add env OCI_DISPLAY_NAME to set display name #17

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

hassegawa
Copy link

Add env OCI_DISPLAY_NAME to set display name

@hassegawa
Copy link
Author

I created a docker image with your code

https://hub.docker.com/r/hassegawa/machine

@hitrov
Copy link
Owner

hitrov commented Jan 26, 2022

Hi, could you please share Dockerfile?

@hitrov
Copy link
Owner

hitrov commented Jan 26, 2022

As for the instance name, it’s better to implement through a setter instead of argument: by changing the arguments/their order we can ruin those who will watch YouTube or read Medium :) I’ll do this later, maybe, thank you

@hitrov
Copy link
Owner

hitrov commented Jan 26, 2022

…or just simple getter which will fallback with a default value if env var is not set

@hassegawa
Copy link
Author

…or just simple getter which will fallback with a default value if env var is not set

index.php

getenv('OCI_DISPLAY_NAME') ?: 'instance-' . date('Ymd-Hi'),

@hassegawa
Copy link
Author

hassegawa commented Jan 26, 2022

Hi, could you please share Dockerfile?


Dockerfile with build per layer for build performance

https://github.com/hassegawa/oracle-tf/tree/performance


github action

hassegawa@4eb053a

@falconws
Copy link

@hassegawa
Please check that your Docker container's run.sh file permission is missing the execution bit.
I have confirmed this ↓

/bin/sh: 1: ./run.sh: Permission denied

I have tested latest tag (maybe now equal hassegawa/machine:0.1.12).

Thanks.

@hassegawa
Copy link
Author

hassegawa commented Feb 3, 2022

@hassegawa Please check that your Docker container's run.sh file permission is missing the execution bit. I have confirmed this ↓

/bin/sh: 1: ./run.sh: Permission denied

I have tested latest tag (maybe now equal hassegawa/machine:0.1.12).

Thanks.

'latest' and 0.1.12 are same:
latest x 0.1.12

@hassegawa
Copy link
Author

hassegawa commented Feb 3, 2022

@hassegawa Please check that your Docker container's run.sh file permission is missing the execution bit. I have confirmed this ↓

/bin/sh: 1: ./run.sh: Permission denied

I have tested latest tag (maybe now equal hassegawa/machine:0.1.12).

Thanks.

Can you try again?
0.1.13 or latest

latest x 0.1.12

@jackblk
Copy link

jackblk commented Feb 17, 2022

@hassegawa I tested your docker image, it works nicely :). My command:

docker run --rm -d \
    -v $(pwd)/.env:/app/oci-arm-host-capacity/.env \
    -v $(pwd)/key.pem:/app/oci-arm-host-capacity/key.pem \
    hassegawa/machine

I also use relative path ./key.pem in my .env file, it still works 😄

Maybe introduce RETRY_DELAY_TIME env to adjust the sleep time?

@jackblk
Copy link

jackblk commented Feb 17, 2022

By the way, I created a Dockerfile using alpine, the image size is very small ~190MB.

FROM composer:2

RUN apk add --no-cache jq~=1.6
WORKDIR /app/oci-arm-host-capacity

COPY ./oci-arm-host-capacity /app/oci-arm-host-capacity

RUN chmod +x run.sh \
    && cd /app/oci-arm-host-capacity && \
    composer update && \
    composer install

ENTRYPOINT [ "sh", "run.sh" ]

jq is not working with it yet because php will return some deprecated messages: Deprecated: Function openssl_free_key() is deprecated in /app/oci-arm-host-capacity/vendor/hitrov/oci-api-php-request-sign/src/Hitrov/OCI/Signer.php on line 115

However I think this approach produces a better image, easier to maintain.

@hassegawa
Copy link
Author

By the way, I created a Dockerfile using alpine, the image size is very small ~190MB.

FROM composer:2

RUN apk add --no-cache jq~=1.6
WORKDIR /app/oci-arm-host-capacity

COPY ./oci-arm-host-capacity /app/oci-arm-host-capacity

RUN chmod +x run.sh \
    && cd /app/oci-arm-host-capacity && \
    composer update && \
    composer install

ENTRYPOINT [ "sh", "run.sh" ]

jq is not working with it yet because php will return some deprecated messages: Deprecated: Function openssl_free_key() is deprecated in /app/oci-arm-host-capacity/vendor/hitrov/oci-api-php-request-sign/src/Hitrov/OCI/Signer.php on line 115

However I think this approach produces a better image, easier to maintain.

we cam try remove this function:

PHP 8 deprecates openssl_free_key (actually openssl_pkey_free which it aliases) and automatically destroys the key instance when it goes out of scope.

@hassegawa
Copy link
Author

hassegawa commented Feb 19, 2022

@hassegawa I tested your docker image, it works nicely :). My command:

docker run --rm -d \
    -v $(pwd)/.env:/app/oci-arm-host-capacity/.env \
    -v $(pwd)/key.pem:/app/oci-arm-host-capacity/key.pem \
    hassegawa/machine

I also use relative path ./key.pem in my .env file, it still works 😄

Maybe introduce RETRY_DELAY_TIME env to adjust the sleep time?

To set RETRY_DELAY_TIME = 5 minutes, TAG >= v0.1.14

docker run --rm -d \
-e RETRY_DELAY_TIME=5 \
-v $(pwd)/.env:/app/oci-arm-host-capacity/.env \
-v $(pwd)/key.pem:/app/oci-arm-host-capacity/key.pem \
hassegawa/machine
  • RETRY_DELAY_TIME default is 10 minutes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants