Closed condr-at closed 2 years ago
Are you using it with docker-compose? You're missing several environment variables
Yes. And with variables in env.sh It worked for local docker
Hmmm.... Try to remove build: context .
It is preferring local docker to fetching container from dockerhub.
And... now hide your token :)
I think now u should recreate it for your own security
The token is totally safe, it's not even a half of it. :)
Tried without build: context .I
In local docker everything runs like a charm and every variable is in the right place. As for Heroku – same result. Variables lost somewhere. I already deleted the entire app on Heroku and re-deployed it, and nothing changed.
Hmm... strange.. You can try to run it without docker :) https://github.com/Horhik/Instagram2Fedi/blob/main/Docs.md
Maybe you should try to specify an .env file in compose file env_file: .env
Maybe it's because Heroku uses only src/main.py file. All errors come from it. And there are no arguments by default.
I was right. Somehow, Heroku uses variables only from main.py, and it works like this.
I used Heroku git to deploy the app.
The question is how to fix this and change the settings in the env file. Or the docker compose file. For example for two bots, like you've mentioned in other issue.
services:
bot-1: # FIRST BOT
build:
context: .
image: "horhik/instagram2fedi:latest"
environment:
- YOUR_CONTAINER_NAME=<whatever>
- I2M_INSTAGRAM_USER=<instagram username> # FIRST INSTAGRAM ACCOUNT
- I2M_INSTANCE=<mastodon or pixelfed instance>
- I2M_TOKEN=<token> # SAME TOKEN
# other variables ....
bot-2: # SECOND BOT
build:
context: .
image: "horhik/instagram2fedi:latest"
environment:
- YOUR_CONTAINER_NAME=<whatever>
- I2M_INSTAGRAM_USER=<instagram username> # SECOND INSTAGRAM ACCOUNT
- I2M_INSTANCE=<mastodon or pixelfed instance>
- I2M_TOKEN=<token> # SAME TOKEN
# other variables ....
Maybe it's all about python version, idk.
I think there's a problem in how do you set up docker with heroku. https://devcenter.heroku.com/articles/build-docker-images-heroku-yml
Yeah. Since i'm no programmer at all, any help with heroku.yml?
I used this default one (not working, all the same with variables):
build:
docker:
web: Dockerfile
UPD
It seems Heroku uses only its own configured variables, not env.sh. But still, after I define them arguments.py doesn't work and returns ❗ -> Wrong Argument Name!...
Vars from docker-compose are ignored as well.
@alex-ash Wrong argument Name means what you made a typo or incorrect input.
You can pass your arguments not only with docker but with command line flags. Then you don't even need docker :)
try to:
python -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
./insta2fedi --use-docker false --instagram-user dalsfkjsdl --instance sdfkljhsdlfkjsdf --token asfsfasdfssdfsadfsdfs --check-interval 10 --post-interval 10 --use-mastodon 4
There are no errors in arguments on local docker. I will try though. Thank you so much.
Btw is there any way to run several bots through command line? With docker, you advise composing them one by one.
Okay, I've made huge progress!
Here's news. Heroku needs a Procfile where run.sh is specified. In run.sh it found a syntax error:
So I deleted / and env was successfully imported. After that, I encountered new syntax errors in other commands in run.sh.
And so on. After we finish this, I promise, you'll be able to add complete heroku instructions into your docs. Any suggestions about syntax in run.sh?
Damn.... you're running bash file via python interpreter... obviously it will completely consist of syntax errors
Anyway, this problem is not specific about my project. It's better to ask about running docker apps inside Heroku and about problems with environment variables on Reddit or Stack Overflow. Due to that, I'm closing this issue
Here, what logs look like after release: