Closed Inventatorul1 closed 1 year ago
First of all, this should not be accepted in any other case, because you didn't follow the template in the bug report, but I'll leave this open for now, because it is the first question about docker-compose.
I used portainer with the "add stack" function
I used portainer with the "add stack" function
This doesn't tell anything.
I asked two questions. At least put an effort to answer them properly. 😒
You have to be specific if you want people to help you.
What exact commands and
Then I used the example using docker-compose and pasted it in the web editor Then I used winscp to upload the run.py file into the run.py folder And when I start the container I get the error: /usr/local/bin/python: can't find 'main' module in '/usr/src/app/run.py'
Paste the contents of your /usr/src/app/run.py
file.
What is strange, that on your screenshot run.py
has the same icon as folders. Are you sure it is not a folder? :)
# -*- coding: utf-8 -*-
import logging
from colorama import Fore
from TwitchChannelPointsMiner import TwitchChannelPointsMiner
from TwitchChannelPointsMiner.logger import LoggerSettings, ColorPalette
from TwitchChannelPointsMiner.classes.Chat import ChatPresence
from TwitchChannelPointsMiner.classes.Discord import Discord
from TwitchChannelPointsMiner.classes.Telegram import Telegram
from TwitchChannelPointsMiner.classes.Settings import Priority, Events, FollowersOrder
from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition, DelayMode
from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings
twitch_miner = TwitchChannelPointsMiner(
username="xxxxxxxxx",
password="xxxxxxxxx", # If no password will be provided, the script will ask interactively
claim_drops_startup=False, # If you want to auto claim all drops from Twitch inventory on the startup
priority=[ # Custom priority in this case for example:
Priority.STREAK, # - We want first of all to catch all watch streak from all streamers
Priority.DROPS, # - When we don't have anymore watch streak to catch, wait until all drops are collected over the streamers
Priority.ORDER # - When we have all of the drops claimed and no watch-streak available, use the order priority (POINTS_ASCENDING, POINTS_DESCEDING)
],
enable_analytics=True, # Disables Analytics if False. Disabling it significantly reduces memory consumption
logger_settings=LoggerSettings(
save=True, # If you want to save logs in a file (suggested)
console_level=logging.INFO, # Level of logs - use logging.DEBUG for more info
console_username=true, # Adds a username to every console log line if True. Useful when you have many open consoles with different accounts
file_level=logging.DEBUG, # Level of logs - If you think the log file it's too big, use logging.INFO
emoji=True, # On Windows, we have a problem printing emoji. Set to false if you have a problem
less=False, # If you think that the logs are too verbose, set this to True
colored=True, # If you want to print colored text
color_palette=ColorPalette( # You can also create a custom palette color (for the common message).
STREAMER_online="GREEN", # Don't worry about lower/upper case. The script will parse all the values.
streamer_offline="red", # Read more in README.md
BET_wiN=Fore.MAGENTA # Color allowed are: [BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET].
),
telegram=Telegram( # You can omit or leave None if you don't want to receive updates on Telegram
chat_id=123456789, # Chat ID to send messages @GiveChatId
token="123456789:shfuihreuifheuifhiu34578347", # Telegram API token @BotFather
events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE, "BET_LOSE"], # Only these events will be sent to the chat
disable_notification=True, # Revoke the notification (sound/vibration)
),
discord=Discord(
webhook_api="https://discord.com/api/webhooks/0123456789/0a1B2c3D4e5F6g7H8i9J", # Discord Webhook URL
events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE, Events.BET_LOSE], # Only these events will be sent to the chat
)
),
streamer_settings=StreamerSettings(
make_predictions=False, # If you want to Bet / Make prediction
follow_raid=True, # Follow raid to obtain more points
claim_drops=True, # We can't filter rewards base on stream. Set to False for skip viewing counter increase and you will never obtain a drop reward from this script. Issue #21
watch_streak=True, # If a streamer go online change the priority of streamers array and catch the watch screak. Issue #11
chat=ChatPresence.ONLINE, # Join irc chat to increase watch-time [ALWAYS, NEVER, ONLINE, OFFLINE]
bet=BetSettings(
strategy=Strategy.SMART, # Choose you strategy!
percentage=5, # Place the x% of your channel points
percentage_gap=20, # Gap difference between outcomesA and outcomesB (for SMART strategy)
max_points=50000, # If the x percentage of your channel points is gt bet_max_points set this value
stealth_mode=True, # If the calculated amount of channel points is GT the highest bet, place the highest value minus 1-2 points Issue #33
delay_mode=DelayMode.FROM_END, # When placing a bet, we will wait until `delay` seconds before the end of the timer
delay=6,
minimum_points=20000, # Place the bet only if we have at least 20k points. Issue #113
filter_condition=FilterCondition(
by=OutcomeKeys.TOTAL_USERS, # Where apply the filter. Allowed [PERCENTAGE_USERS, ODDS_PERCENTAGE, ODDS, TOP_POINTS, TOTAL_USERS, TOTAL_POINTS]
where=Condition.LTE, # 'by' must be [GT, LT, GTE, LTE] than value
value=800
)
)
)
)
# You can customize the settings for each streamer. If not settings were provided, the script would use the streamer_settings from TwitchChannelPointsMiner.
# If no streamer_settings are provided in TwitchChannelPointsMiner the script will use default settings.
# The streamers array can be a String -> username or Streamer instance.
# The settings priority are: settings in mine function, settings in TwitchChannelPointsMiner instance, default settings.
# For example, if in the mine function you don't provide any value for 'make_prediction' but you have set it on TwitchChannelPointsMiner instance, the script will take the value from here.
# If you haven't set any value even in the instance the default one will be used
#twitch_miner.analytics(host="127.0.0.1", port=5000, refresh=5, days_ago=7) # Start the Analytics web-server
twitch_miner.mine(
[
Streamer("streamer-username01", settings=StreamerSettings(make_predictions=True , follow_raid=False , claim_drops=True , watch_streak=True , bet=BetSettings(strategy=Strategy.SMART , percentage=5 , stealth_mode=True, percentage_gap=20 , max_points=234 , filter_condition=FilterCondition(by=OutcomeKeys.TOTAL_USERS, where=Condition.LTE, value=800 ) ) )),
Streamer("streamer-username02", settings=StreamerSettings(make_predictions=False , follow_raid=True , claim_drops=False , bet=BetSettings(strategy=Strategy.PERCENTAGE , percentage=5 , stealth_mode=False, percentage_gap=20 , max_points=1234 , filter_condition=FilterCondition(by=OutcomeKeys.TOTAL_POINTS, where=Condition.GTE, value=250 ) ) )),
Streamer("streamer-username03", settings=StreamerSettings(make_predictions=True , follow_raid=False , watch_streak=True , bet=BetSettings(strategy=Strategy.SMART , percentage=5 , stealth_mode=False, percentage_gap=30 , max_points=50000 , filter_condition=FilterCondition(by=OutcomeKeys.ODDS, where=Condition.LT, value=300 ) ) )),
Streamer("streamer-username04", settings=StreamerSettings(make_predictions=False , follow_raid=True , watch_streak=True )),
Streamer("streamer-username05", settings=StreamerSettings(make_predictions=True , follow_raid=True , claim_drops=True , watch_streak=True , bet=BetSettings(strategy=Strategy.HIGH_ODDS , percentage=7 , stealth_mode=True, percentage_gap=20 , max_points=90 , filter_condition=FilterCondition(by=OutcomeKeys.PERCENTAGE_USERS, where=Condition.GTE, value=300 ) ) )),
Streamer("streamer-username06"),
Streamer("streamer-username07"),
Streamer("streamer-username08"),
"streamer-username09",
"streamer-username10",
"streamer-username11"
], # Array of streamers (order = priority)
followers=False, # Automatic download the list of your followers
followers_order=FollowersOrder.ASC # Sort the followers list by follow date. ASC or DESC
)
This is the file I put inside the run.py folder.
Paste the contents of your
/usr/src/app/run.py
file.
What is strange, that on your screenshot
run.py
has the same icon as folders. Are you sure it is not a folder? :)
It is a folder, it got created automatically, and when I replace it with the run.py the docker container doesn't work ( the console and logs are blank)
Then I used the example using docker-compose and pasted it in the web editor
What exactly did you paste?
Creating a folder and naming it "run.py" - that's pretty funny, but you should have told about it in your first post. So much misunderstanding arises because you hid this fact. 😒
I have to pull information out of you bit by bit, that's not cool. 😒 That's why there is a template for the bug report.
It is a folder, it got created automatically
Then you have to find out how it was created automatically without your intention. A bit of sarcasm.
From what I've read here: https://stackoverflow.com/questions/42248198/how-to-mount-a-single-file-in-a-volume The run.py needs to exist on the host before mounting it into the docker container.
Well, are you going to answer my question?
From what I've read here: https://stackoverflow.com/questions/42248198/how-to-mount-a-single-file-in-a-volume The run.py needs to exist on the host before mounting it into the docker container.
First, copy this command and put it in terminal
function error {
echo -e "\\e[91m$1\\e[39m"
exit 1
}
sudo -i
echo "Creating directory..."
sudo mkdir /home/twitch-miner || error "Failed to create twitch-miner folder!"
sudo mkdir /home/twitch-miner/cookies || error "Failed to create cookies folder!"
sudo mkdir /home/twitch-miner/logs || error "Failed to create logs folder!"
sudo mkdir /home/twitch-miner/analytics || error "Failed to create analytics folder!"
echo "Setup complete"
Then, follow the tutorial
Copy my config or setting
Then, deploy it.
After deploy it, use some kind of ssh file manager such as WinSCP to go to /home/twitch-miner
and added run.py file
Hope this help!
From what I've read here: https://stackoverflow.com/questions/42248198/how-to-mount-a-single-file-in-a-volume The run.py needs to exist on the host before mounting it into the docker container.
First, copy this command and put it in terminal
function error { echo -e "\\e[91m$1\\e[39m" exit 1 } sudo -i echo "Creating directory..." sudo mkdir /home/twitch-miner || error "Failed to create twitch-miner folder!" sudo mkdir /home/twitch-miner/cookies || error "Failed to create cookies folder!" sudo mkdir /home/twitch-miner/logs || error "Failed to create logs folder!" sudo mkdir /home/twitch-miner/analytics || error "Failed to create analytics folder!" echo "Setup complete"
Then, follow the tutorial
Copy my config or setting
Then, deploy it.
After deploy it, use some kind of ssh file manager such as WinSCP to go to
/home/twitch-miner
and added run.py fileHope this help!
@rdavydov I know this is off topic could look at my portainer app template Forked Pi hosted
It is to make user for easy deploy and let me know what I have add to make you agree on it
Edited : Im new to this stuff soo and I hope you can help me improve.
@Kazushi-0 Maybe it is a bit excessive for me to check every possible way to run the miner. There are dozens of services that the user can use. Do you have any specific questions that can be discussed and answered by the community?
@Kazushi-0 As long as you leave the credits and don't violate the license - it is fine with me.
the problem was in the example from your docker compose:
- ./run.py:/usr/src/app/run.py:ro
this will automatically create a empty directory with the name run.py
putting run.py in this folder also wont work und you will get this error on start:
/usr/local/bin/python: can't find '__main__' module in '/usr/src/app/run.py'
if you change to absolute patch in the compose yaml it will work:
/absolute/path/to-file/run.py:/usr/src/app/run.py
Describe the bug Installed the docker container with docker compose. Started the container and it crashed with error: /usr/local/bin/python: can't find 'main' module in '/usr/src/app/run.py'
Docker version:
Client: Docker Engine - Community Version: 20.10.17 API version: 1.41 Go version: go1.17.11 Git commit: 100c701 Built: Mon Jun 6 23:02:46 2022 OS/Arch: linux/amd64 Context: default Experimental: true
Server: Docker Engine - Community Engine: Version: 20.10.17 API version: 1.41 (minimum version 1.12) Go version: go1.17.11 Git commit: a89b842 Built: Mon Jun 6 23:00:51 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.7 GitCommit: 0197261a30bf81f1ee8e6a4dd2dea0ef95d67ccb runc: Version: 1.1.3 GitCommit: v1.1.3-0-g6724737 docker-init: Version: 0.19.0 GitCommit: de40ad0
Docker compose version:
docker-compose version 1.29.2, build 5becea4c docker-py version: 5.0.0 CPython version: 3.7.10 OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019