Skip to content

Conversation

@pashidlos
Copy link
Member

@pashidlos pashidlos requested a review from paazmaya August 16, 2023 16:07
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication


# Copy override ENV script with default values
COPY ./env.sh .
COPY .env .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the issue could be fixed by just this one line change, to copy .env file to Docker container

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is how it currently works and though the root cause
it's copied with default values like localhos:4200 and when container starts it should be overridden by ENV variables from docker
if the script to form new .env file is not executed within the container it remains unchanged

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify what do you mean?

Copy link
Member Author

@pashidlos pashidlos Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what I expect _env_ variable to be on real env

{
   PORT: "443"
   REACT_APP_API_URL: "https://visual-regression-tracker.com:4200"
   VRT_VERSION: "5.0.0-rc3"
}

despite the values that are copied into image initially https://github.com/Visual-Regression-Tracker/frontend/blob/master/.env

we set those values via docker-compose env variables https://github.com/Visual-Regression-Tracker/frontend/blob/master/docker-compose.yml#L13-L14

so when you start the app we have script executed to form new _env_ https://github.com/Visual-Regression-Tracker/frontend/blob/master/package.json#L41

and we need the same inside the container
I could have used initial node script but alpine image doesn't have node installed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. So the JavaScript file generation should happen later in the process, perhaps in the stage 2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SwiLink I can see that VRT_VERSION is set
what is the value in .env for REACT_APP_API_URL?
also docker-compose file should have it set as in template https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/blob/master/docker-compose.yml#L18

Copy link

@SwiLink SwiLink Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REACT_APP_API_URL - https://mywebsite.com/api, for example, but it's really set in .env, have rebuilded images and containers multiple times. Can provide real website personally in Telegram, i think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SwiLink let's keep it transparent
I'm not providing support via private messages, we have public chat and github for it
replace sensitive data before sharing

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Ok, here is my .env:

## Logging
# https://www.elastic.co/guide/en/elastic-stack/7.14/overview.html
ELK_VERSION=7.14.1
ELASTIC_URL=http://localhost:9200

## VRT version
VRT_UI_VERSION="5.0.0-rc3"
VRT_API_VERSION=5.0.0
VRT_MIGRATION_VERSION=5.0.0

## Frontend

# direct URL to backend with port (same as APP_PORT)
REACT_APP_API_URL=https://screenshots.wifox.org/api
# frontend port
PORT=8080

## Backend

# direct URL to frontend with port (same as PORT)
APP_FRONTEND_URL=https://screenshots.wifox.org
# backend port
APP_PORT=4200
# seed to generate JWT
JWT_SECRET=test
# user session lifetime
JWT_LIFE_TIME=1d
# max image size to upload
BODY_PARSER_JSON_LIMIT="5mb"

## DB

POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=vrt_db

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it's working:)) Don't know what's the reason, but i know that later it will stop to work:)

@pashidlos pashidlos merged commit 52b8a29 into master Aug 20, 2023
@pashidlos pashidlos deleted the 414-fix-env-variables branch August 20, 2023 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with proxying in production environment.

4 participants