#dev-contrib
1 messages · Page 152 of 1
Yeah, it's because you don't have permissions then
I guess it's a private group and you need to part of the org
Huh, can one of the owners (CC @patent pivot, @hardy gorge, @crude gyro) change the visibility of the devops team on github to public so review requests properly show up for people outside of the org?
I've discovered something that could be really useful for threads, if a bot sends a message and then edit in a mod ping, all the mods get added to the thread without getting any actual ping
You could use that if you wish to have the mods auto join threads, I've seen some communities do that, it could be a good practice
" and then edit in a mod ping" uhh I am not exactly clear on what you mean by this?
Just edit from "hi I will edit in a mod ping here:" to "hi I will edit in a mod ping here: @mods", since edits don't ping
ah 👍
Isn't there an endpoint to join someone to a thread?
Not that I'm aware of
I remember @vale ibex playing with it recently
The idea would be so mods can watch over threads like they would with normal channels
Sadly just pings
Afaik most mods don't just go from channel to channel looking for trouble
On the other hand, most mods use the server like normal users would
Meaning, they have channels they like to visit and see, and organize the server in some way
We already have experience with auto opt-in (modmail), and tbh, it's shit
90% of the time I don't want to deal with modmail, but I'm still forced to see the channels, and deal with pings
Could https://github.com/python-discord/bot/pull/1634 get another review :D
Can't you ping the Owners role? Just a suggestion in the future. I mean, doesn't matter really, I personally find it easier to ping a group of people by role
unless someone else got to it this is already done
it’s not in the audit log
🤷♂️
https://github.blog/changelog/2021-11-10-require-pull-requests-without-requiring-reviews/ also this is interesting
Yes there is, but it's per user request, rather than roles
It also pings that user
ah that sucks
помогите пж с програмированием мне срочно
This is an English community. Please try your best to write in English.
(ok
If you need help with Python you can read here for how to ask #❓|how-to-get-help
Sorta out there, but what do you think about sir-lancebot#834 regarding commit messages? (cross-posting from #community-meta )
https://paste.fuelrats.com/otuxerolez.php this is what I use, cc @green oriole
I like the general structure but I personally hate the conventional commit stuff, I find it super useless
+1 to that
The idea of giving people who don’t know what a commit should be a general idea to follow sounds fine
But like I’ll be promptly disabling it locally
I also don’t want us to enforce a general commit format
I really dislike the conventional commits thing. It always gets past 72 characters
This is really where I wanted to have the discussion, is it even worthwhile?
it's just 72 chars per line, right? I just split it onto multiple lines
50 for subject, 72 after that I think
72 per line, except if it’s the subject which some people choose to do 50, but there’s no point since 72 is still visible
Is the 72 visible for the commit title? I thought some things only displayed 50 for the title
Discord.js uses conventional commits (with the type stuff) and I've had to use it for a PR. Hated it in all honesty
I only really look at GitHub, terminal, and my ide. They all show it
Don’t know where else people are looking. Email? That’s longer I think lol
Github is 50 I think?
50 characters is the community-wide agreement, like 79 characters for a Python file
github does 72
If it exceeds 72 you get this:
I prefer the line limits (whether it's 50 or 7e). I find it encourages brevity and conciseness. It's also nice to just look at commit titles without it going "..." and having to look into the commit body itself
Plus for git log it doesn't always support word wrap and I appreciate when people keep to the line length limit
Like showing the 50 character limit, a small reminder / prompt to use imperative language, then a 72 character mark
Tbh I have a very low opinion of the standardization of commits (besides the char limit)
As long as your commit conveys what you want to say
It’s a-ok with me
I think it would be nice to have in lancebot, just because we get a lot of new contribs who don't know how to write a commit and this would provide some nice guidance
Yeah, I wouldn’t mind having it as a guide, but not necessarily enforced
because we do get a lot of commits that are like "fix stuff from review" which is not exactly helpful
I'm guilty of the above
Why waste space to fit in the type thing? I remember fighting the pre-commit hooks for so long for that damm discord.js PR lol. I think I wanted to do like refactor(InteractionCollector): Only store Ids of objects on the InteractionCollector
I'm fine with leaving it out of the git message, I just got into the habit of tagging my commits recently
I am guilty of this 😬. GitHub Desktop doesn't wrap the body so it's really hard to cut it off myself..
lol I always manually wrap mine since I commit from the editor/terminal
magit is love, magit is life
Yeah, I mean for the body body, not the title
I mean, I still prefer line limits for the body. It helps with readability and not everything has nice word wrap
I've been considering doing this. Do all staging in GitHub and then commit in there because I find it better than this small area:
Same, sometimes after coding for a while I forgot to make small commits so I forgot everything I added
Is there a particular reason as to why sqlalchemy isn't including in the poetry.lock on the API repo and so doesn't install?
Nvm, it is in the poetry.lock, it just didn't install when I did poetry install 🤔
A simple pip install sqlalchemy==1.4.18 works 🤷
🤷
Okay wtf
Now django didn't install when I did poetry install on the site repo
The logs of the poetry install says it's installing it but then it doesn't show in pip freeze (or pip list)
So... it says it's installing but then never installs?
C:\Users\tizzy\site>poetry install
Installing dependencies from lock file
No dependencies to install or update
```but the libraries aren't all installed
I'm so confused
Try poetry debug and poetry run pip list
C:\Users\tizzy\site>poetry debug
Poetry
Version: 1.1.7
Python: 3.9.5
Virtualenv
Python: 3.9.5
Implementation: CPython
Path: C:\Users\tizzy\AppData\Local\pypoetry\Cache\virtualenvs\site--h5SVkFS-py3.9
Valid: True
System
Platform: win32
OS: nt
Python: C:\Users\tizzy\AppData\Local\Programs\Python\Python39
Everything seems to show in poetry run pip list but not pip list so I guess pip is pointing to something else for some reason 🤷
C:\Users\tizzy\site>pip -V
pip 21.3.1 from c:\users\tizzy\appdata\local\programs\python\python39\lib\site-packages\pip (python 3.9)
C:\Users\tizzy\site>poetry run pip -V
pip 21.3 from C:\Users\tizzy\AppData\Local\pypoetry\Cache\virtualenvs\site--h5SVkFS-py3.9\lib\site-packages\pip (python 3.9)
```yep, different
Poetry shell to activate
What do you mean?
The command poetry shell will drop you into an activated environment with the correct venv
Right
PyCharm still gives lint-type errors saying it's not installed though
Do I just have to live with that? @gritty wind
I believe there is a poetry plugin, do you already have that? If so, I'm not sure.
Did you select it in pycharm
Poetry plug-in is mostly only useful for running poetry install, not strictly necessary
You’d just add the poetry venv like you’d add any other venv
I mean for the "Python Interpreter"
For bot and lancebot it shows a poetry thing
That’s not built into pycharm, it’s a separate plug-in, but it’ll only create a new virtualenv and basically do this ^ afterwards
You basically manually did what the plug-in does when you ran poetry install
I'm so confused
Alright, so to clarify something, just forget poetry as a concept. What’s relevant right now is that ‘poetry install’ is equivalent to doing a pip install into a virtualenv. If you did that, and wanted to add it to pycharm, you’d add the virtualenv.
Now the plug-in goes a step further, basically creating the venv and running “pip install” (sticking with the simplification)
You’ve already done the part in the second paragraph by hand
So... what do I need to do to make PyCharm recognise that stuff is installed?
^ this
Click the plus at the top -> virtualenv -> existing
And what's the interpreter?
C:\Users\tizzy\AppData\Local\pypoetry\Cache\virtualenvs\site--h5SVkFS-py3.9?
This
Yeah
Err sorry
That's a folder
You need to select the python executable inside it
So the path at the bottom of debug
python or pythonw?
Just python
C:\Users\tizzy\AppData\Local\pypoetry\Cache\virtualenvs\site--h5SVkFS-py3.9\Scripts\python.exe?
Yeah that should do it
Yup
Hey, so I've been thinking about this async SQLAlchemy and sync SQLAlchemy, and I find it a bit dubious. (API ofc. 😄 )
Mostly, because of model validations eg.: https://github.com/python-discord/api/blob/main/api/core/database/models/api/bot/user.py#L60:L69, how would we circumvent this?
api/core/database/models/api/bot/user.py lines 60 to 69
@validates("roles")
def validate_roles(self, _key: str, roles: list[int]) -> Union[list[int], NoReturn]:
"""Raise ValueError if the provided role(s) is negative or non-existent."""
session = SessionLocal()
for role in roles:
if role < 0:
raise ValueError("Role IDs cannot be negative")
if not session.query(Role).filter_by(id=role).first():
raise ValueError(f"Role with ID {role} does not exist")
return roles```
So I'm about to do this, is there anything I should do first?
I've just addedpy dm_sent = models.BooleanField( null=True, help_text="Whether a DM was sent to the user when infraction was applied." )(site repo)
Well, I believe it should be fine.
Although, I'm not an expert on Django ORM.
django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable
What do I set it to (and how)?
I guess, you are not using docker, are you?
What do you mean?
Ah no
I just do manage.py xxxx in PyCharm's terminal
I can use docker if I'm supposed to (and you tell me how)
No, actually. The thing is that, if you don't use Docker, you've got to set the environment variables.
See: https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/site/#2-environment-variables
(I believe you have already set the DB URL)
A guide to setting up and configuring Site.
And that's where you have to set the SECRET_KEY
I mean it would be easier 😄
I started off with Docker in the first place, but I figured that if you haven't set it up already, you would want to stick with not using Docker.
So do I do docker-compose up postgres?
If you want to run only the database, then yes. But the SECRET_KEY won't be set.
If you want to run everything in Docker you issue: docker-compose up and it's gonna run the site and the database as well, with all the environment variables pre-set
Right, okay
I guess I'll do the latter then
Where do I do the manage.py xxxx by the way?
I'm still getting this @molten perch
I'm probably just running in the wrong place
I'm trying to get the auto-generated migration thing for when you edit the database schema
makemigrations?
manage.py makemigrations gives the above error about the SECRET_KEY
You're trying to run that through Docker?
I think so?
If I understand correctly, D0rs4n said running on Docker would mean I don't have to worry about setting the envs
If you're relying on Docker Compose for the dev environment rather than setting one up on the host, then yeah
I suppose one easy way to run it would be to edit the docker-compose file to change the command it calls
You'll see it normally shows command: ["run", "--debug"]
But you could change that to command: ["makemigrations"].
And since Docker Compose is configured to mount your host's directory, those migrations should actually end up on your actual host file system.
I'm not sure it would work. The file system is Read Only, isn't it?
Oh, true
version: "3.6"
services:
postgres:
...
environment:
POSTGRES_DB: pysite
POSTGRES_PASSWORD: pysite
POSTGRES_USER: pysite
...
web:
...
environment:
DATABASE_URL: postgres://pysite:pysite@postgres:5432/pysite
METRICITY_DB_URL: postgres://pysite:pysite@postgres:5432/metricity
SECRET_KEY: suitable-for-development-only
STATIC_ROOT: /var/www/static
DEBUG: 1
volumes:
staticfiles:
```I want to somehow configure the environment stuff then I guess
Then that would mean it's not possible to do this through Docker Compose? Unless you also change the mount.
Then, you could run the database in docker, and run the web app locally, and just set the env variables with an .env file?
That's what I do
Well, I use docker compose to run it, but I also have all dependencies and env vars set up locally in case I need to do something other than running the site, or I need to attach a debugger while running.
So I just need to do```
.env file
POSTGRES_DB=pysite
POSTGRES_PASSWORD=pysite
POSTGRES_USER=pysite
DATABASE_URL: postgres://pysite:pysite@postgres:5432/pysite
METRICITY_DB_URL: postgres://pysite:pysite@postgres:5432/metricity
SECRET_KEY: suitable-for-development-only
STATIC_ROOT: /var/www/static
DEBUG: 1```?
I believe, so.
Not exactly
Then, you can run via poetry.
You probably don't want STATIC_ROOT to be going to /var/www on your host
Oh, yeah follow this: https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/site/#2-environment-variables
It has all the variables you need.
A guide to setting up and configuring Site.
Also, the database connections would be different since you wouldn't be able to interact with docker's internal network
The DB would be exposed on localhost:7777
For patsy I'm mounted a volume in docker compose to the migration path
And the did docker-compose exec web makemigrations
Well I used alembic, but same concept
.bm dawn you've been trying to figure out this command for months, you're an idiot
I'm on mobile so can't link the exact thing you need to do
But take a look at the patsy docker compose
I also have a script in the pyproject toml
Would just need changing from alembic to django
I'm starting to get lost again
I think the easiest way is to go with
DATABASE_URL=postgres://pysite:pysite@localhost:7777/pysite
METRICITY_DB_URL=postgres://pysite:pysite@localhost:7777/metricity
DEBUG=1
SECRET_KEY=suitable-for-development-only
STATIC_ROOT=staticfiles```
would be that in your .env, wouldn't it?
Yea if you want to run django locally
If you use a docker compose volume, you don't need to setup an env
Yeah, I think it's easier for now.
It's literally just add one line in the compose file
And we can avoid having to set env up
🤔
Is it though? We have multiple apps each with their own migration folder
Well, IDK how many of them actually need migrations
Are migrations per path?
Yeah I think so
Ahh right, then it would be one per migration path then
Yeah you're right. Might have been an oversight when the guide was being rewritten.
I used the verbose output and just copied it to the file to go around the read only limitation
I might take a look at it tomorrow to see if we can ease generating migrations
For full docker setups that is
while you're at it, add a volume for the pgdata since we agreed to do that
Sure
Right, okay. That was greatly confusing me lol
!remind 14h
content
Ugh
!remind 14h g
Your reminder will arrive on <t:1636632418:F>!
C:\Users\tizzy\site>manage.py makemigrations
Migrations for 'api':
pydis_site\apps\api\migrations\0075_infraction_dm_sent.py
- Add field dm_sent to infraction
```I guess this means it worked?
The generated file doesn't comply to the 120 char limit
Will that need to be manually changed?
It's ignored by linting
👌
@molten perch do we have easy docker migrations in api?
Okay, so I think that's the only changes I need to do for site
Now I need to implement it in api
Well, I believe the situation is the same there.
Except, alembic is a bit more lightweight, so you only need a database url and a token in the environment.
Alright cool, I might do the same I did for patsy in api then too, so contribs can just use the compose env
Yeah, that would be really cool.
Should be easier in api due to alembic having all migrations in one path
I'll sort it after my trip to Nottingham
Alright, also we should also discuss the async question, it's quite dubious in my opinion.
I might have missed the conversation about it
If you're around tomorrow I can give some opinions on it 😀
Alright, cool. Have a good trip! 🙂
Thanks, fwiw I think async alchemy is fine, I wouldn't suggest sqlmodel for now
The alembic meta data seems to be lacking
@molten perch ```py
C:\Users\tizzy\api>alembic revision --autogenerate - m "Add DM Sent field to infractions model"
'alembic' is not recognized as an internal or external command,
operable program or batch file.
Yeah, haven't tested it out, might give it a go.
Is this because of the poetry install thing again?
Try poetry run alembic...
Before, running it.
docker-compose up postgres
Then, set two env variables (.env)
AUTH_TOKEN=tokeniguess
DATABASE_URL=postgresql://pysite:pysite@127.0.0.1:7777/pysite
(That's what I have)
You might not need the Auth_token, since it's decoupled from the api, but why not to add it if you can 😄
Sorry for the lack of docs, I might get around and write a few things, after the docker setup, and the dev-tools PR.
pydantic.error_wrappers.ValidationError: 2 validation errors for Settings
database_url
field required (type=value_error.missing)
auth_token
field required (type=value_error.missing)
I do need both lol
Oh, yeah sorry, there are a few version that I'm working with. 😄
Since you're not running the API,
Please do run:
alembic upgrade head
then
alembic revision --autogenerate - m "Add DM Sent field to infractions model"
We definitely have to change on that process 😂
C:\Users\tizzy\api>alembic revision --autogenerate -m "Add DM Sent field to infractions model"
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
ERROR [alembic.util.messaging] Target database is not up to date.
FAILED: Target database is not up to date.
That's without the upgrade thing
alembic upgrade head gives an error
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateTable) relation "api_botsetting" already exists
Yep, yep. Please run the upgrade, that's usually the part of the web container, and it runs automatically. But you only ran the postres.
Well, that seems impossible. Do you use the same database for the site and the API as well?
I tested it out on a freshly clone project, it seems to be working for me.
Errr
Maybe, you're still running the site DB? 😄
DATABASE_URL=postgresql://pysite:pysite@127.0.0.1:7777/pysite
vs
DATABASE_URL=postgres://pysite:pysite@localhost:7777/pysite
So I guess
Do you have docker-desktop? It might be easier to interfere with the containers for now.
Yeah, I do
Then, try to stop the site-db? 😄
Done
Okay, then it should be working now, I hope so.
Ah wait I'm dumb
I did this command in the site dir
That's why
Might be problematic, yeah.
Okay, starting
🤞
Seems to have worked
What's the output? 😄
Too long to send
if you see migration messages such as: Initial migration then you're good to go, and can start run revision
But the file was created 👍
Okay, is there anything in it? 😄
Generating C:\Users\tizzy\api\alembic\versions\3d9c7f4c3e4c_add_dm_sent_field_to_infractions_model.py ... done is the final line
Which has the def upgrade and def downgrade
And, is there anything in def upgrade?
Since, alembic tends to generate empty migrations, if there's a problem.
Yeah, there is stuff there
"""Add DM Sent field to infractions model
Revision ID: 3d9c7f4c3e4c
Revises: c551b4b47800
Create Date: 2021-11-10 22:26:00.101691
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3d9c7f4c3e4c'
down_revision = 'c551b4b47800'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('api_infraction', sa.Column('dm_sent', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('api_infraction', 'dm_sent')
# ### end Alembic commands ###
```to be exact
Yaay 🎉 you might have to do some linting on it, since I was asked to add it to the linting workflow, but I might suggest it to be removed.
(Run “flake8 —config=tox.ini” (there is a pr that will make that easier, sorry))
Yea imo we should lint migrations
Just because they're autogenerated doesn't mean they don't need to be readable
Yep, I'll do that```py
C:\Users\tizzy\api>flake8 --config=tox.ini
.\alembic\versions\3d9c7f4c3e4c_add_dm_sent_field_to_infractions_model.py:1:1: D213 Multi-line docstring summary should start at the second line
.\alembic\versions\3d9c7f4c3e4c_add_dm_sent_field_to_infractions_model.py:1:1: D415 First line should end with a period, question mark, or exclamation point
.\alembic\versions\3d9c7f4c3e4c_add_dm_sent_field_to_infractions_model.py:9:1: I100 Import statements are in the wrong order. 'import sqlalchemy' should be before 'from alembic import op'
.\alembic\versions\3d9c7f4c3e4c_add_dm_sent_field_to_infractions_model.py:19:1: D103 Missing docstring in public function
.\alembic\versions\3d9c7f4c3e4c_add_dm_sent_field_to_infractions_model.py:20:0: ANN201 Missing return type annotation for public function
.\alembic\versions\3d9c7f4c3e4c_add_dm_sent_field_to_infractions_model.py:25:1: D103 Missing docstring in public function
.\alembic\versions\3d9c7f4c3e4c_add_dm_sent_field_to_infractions_model.py:26:0: ANN201 Missing return type annotation for public function
Alright, then I might have to modify the mako file as suggested before, to make it better.
what about running black on them?
so they are somewhat pretty but we don't have to mess with autogenerated stuff?
You can check out previous migrations to see a sample that passes.
Yep
hmm, I guess the docstring and annotations should be ignored, and we can add ISort for the imports
That's why I have this open https://github.com/python-discord/api/pull/27/files
Might be worth to open a PR I guess, but an issue would be good so that we can discuss
Your reminder will arrive on <t:1636584807:F>!
So this is all for bot#1864. How exactly does the "workflow" work in terms of now implementing this into the bot?
No need, the imports and docstrings can be templated
Just fix it on the template and it's all good
oh I see
It's jinja style templating
You can, mention your corresponding PR’s, and something like “ported over from site, has to merged after the site pr” or something.
You can’t modify the line lens. though.
So I can PR the site & api changes without bot breaking?
Yea, that would be manual fixes, or black
hey @vale ibex, have you made issues'n'stuff to murder @brisk belfry ?
API is not yet used in production, as for api it’s fine, I’m not sure about site though.
Right, okay. I'll just add the "Do-Not-Merge" label for now
Alright, nice work. I’ve gotta go though. Bye all! 😄
Thanks for all your help 👍
PR number?
okay we only have 9 site PRs
is there a site PR lol
ideally to port a new field to the site you'd want to add a sane default so we can have a nice cutover
@green oriole since you're here, how do I use my edited database schema in bot?
As in to get support for the dm_sent field so that I can add it to the embed
Not what I wanted to hear lmao
I was hoping it'd be easy
Wouldn't you just use it normally after spinning up the site with the change
Here's your reminder: this
[Jump back to when you created the reminder](#dev-contrib message)
So docker-compose up in the 2 repos?
the easiest way is to use the same COMPOSE_PROJECT_NAME in both project env, start the site and then the bot
Does it matter what value I use?
ah with separate containers
no, just gotta be the same
mine is set to pydis iirc
You can keep them separate by setting network…
And to start them is just this?
Or as Chris showed me
you may need to specify bot and site manually
Modify the path in compose
that's the easiest way I know to make them end up on the same vnet without modifying the config
start the site container as usual, but on the bot start only the bot
maybe we could just set a pydis vnet in both compose file
you don't have to, docker will see web is already up
Or run the bot on the host and make your life easier 👀
lol not that bad of an option on linux tbh
Why specifically linux?
we do have decent windows support now
never had any problems apart from bugs
I keep getting this to start withpy metricity_1 | Traceback (most recent call last): metricity_1 | File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context metricity_1 | self.dialect.do_execute( metricity_1 | File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute metricity_1 | cursor.execute(statement, parameters) metricity_1 | psycopg2.errors.DuplicateTable: relation "channels" already exists
yeah, that's fair
https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/bot/#with-the-bot-running-locally Tizzy in case you're interested
A guide to setting up and configuring Bot.
Do you need metricity?
so that's how that paragraph is named
I... don't think so
I'm just trying to test this dm_sent field thing
Then disable it lol
How?
Nope
Just BOT_TOKEN and COMPOSE_PROJECT_NAME
What command did you run?
This is bot repo
docker-compose up inside of tizzy/bot
I guess just docker-compose run bot maybe?
🤔
huh... you do have this line right?
https://github.com/python-discord/bot/blob/main/docker-compose.yml#L50
docker-compose.yml line 50
USE_METRICITY: ${USE_METRICITY-false}```
No harm in trying
Yepyml metricity: << : *logging restart: on-failure # USE_METRICITY=false will stop the container, so this ensures it only restarts on error depends_on: postgres: condition: service_healthy image: ghcr.io/python-discord/metricity:latest env_file: - .env environment: DATABASE_URI: postgres://pysite:pysite@postgres/metricity USE_METRICITY: ${USE_METRICITY-false} volumes: - .:/tmp/bot:ro
hmmm
Getting a load of other errors now
PS C:\Users\tizzy\bot> docker-compose run bot
Starting pydis-testing_snekbox_1 ... done
Starting pydis-testing_redis_1 ... done
Starting pydis-testing_metricity_1 ... done
Creating pydis-testing_bot_run ... done```It still runs metricity
When it crashes because of the error above it just restarts but by that point the site has crashed because of it
It keeps starting metricity when I don't want it to
Or I guess it's fine to run metricity just I get the error which makes it break
And it doesn't do that when you remove the compose project name?
Lemme try
If I remove COMPOSE_PROJECT_NAME then metricity doesn't start PS C:\Users\tizzy\bot> docker-compose run bot Starting bot_postgres_1 ... done Starting bot_redis_1 ... done Starting bot_snekbox_1 ... done
That's fascinating
lol
@vale ibex feel free to ignore until later, but since you added the metricity env var do you have any idea?
Try setting USE_METRICITY to false explicitly
What capitalisation is false?
Don't think it matters actually
Trying again
no caps
PS C:\Users\tizzy\bot> docker-compose run bot
Creating pydis-testing_snekbox_1 ... done
Creating pydis-testing_redis_1 ... done
Creating pydis-testing_metricity_1 ... done
Creating pydis-testing_bot_run ... done```
It's still running
BOT_TOKEN="TOKEN"
COMPOSE_PROJECT_NAME=pydis-testing
USE_METRICITY=false```
Sorry, I'm out of ideas for this hour of day lol
lol
I suggest just running the bot on the host, makes things a lot simpler
I'm also getting a 404 on site
web_1 | Not Found: /healthcheck
web_1 | "GET /healthcheck HTTP/1.1" 404 11455```
I'm going to bed now so I guess I'll look into this more tomorrow
I'll try this tomorrow
!remind 10h https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/bot/#with-the-bot-running-locally
A guide to setting up and configuring Bot.
Your reminder will arrive on <t:1636623398:F>!
Soooooo I think sir-lancebot#842 is finished. Should I dismiss Blue's review or wait for the re-review?
nice! I think I'll test it again to make sure there aren't anything we missed
Please do, I've done a fair bit of testing but at this point I think having fresh eyes is needed lol
Brad, What's the rationale behind having a special exception for hex but not the other modes
Regarding a special embed vs BadArgument?
Yes, the other modes simply raise badarg
BadArgument was simpler honestly
Its a check if the values are in the correct range, and raise if something fails
But how come it only exists for hex and not the others? Shouldn't it be consistent?
Ahh I see. I can change hex to badArg instead
The custom embed makes sense
Well then its one change vs 5
What I would suggest is a custom exception where we pass in the name of the mode and the possible values
I don't want to cause more work for you though
This is what I was about to test and commit:
if len(hex_code) not in (4, 5, 7, 9) or any(_ not in string.hexdigits for _ in hex_code[1:]):
# hex_error_embed = discord.Embed(
# title="The input hex code is not valid.",
# description=f"Cannot convert `{hex_code}` to a recognizable Hex format. "
# "Hex values must be hexadecimal and take the form *#RRGGBB* or *#RGB*.",
# colour=discord.Colour.dark_red()
# )
# await ctx.send(embed=hex_error_embed)
raise commands.BadArgument(
message=f"Cannot convert `{hex_code}` to a recognizable Hex format. "
"Hex values must be hexadecimal and take the form *#RRGGBB* or *#RGB*."
)
Was there a reason you had an embed in the first place and not that? ^ I couldn't understand what you meant in your reply on the pr
I didn't have an error / BadArg raised for the hex command
Then I added the custom embed as discussed in the comments, but I think keeping the consistency and raising a BadArg makes more sense
I'll review it!
We had badarg raised originally, no?
Depends on the commit you are looking at lol
Hehe
Wait, I already did
This is the last commit before Hedy's review: https://github.com/python-discord/sir-lancebot/pull/842/commits/524d33a9909697386283d966dcda1dc712a16fb0
Ah crap
Wait, then why did I make a custom embed instead? Just changing the checks makes it raise the BadArg where before it did not
Line 144, if len(hex_code) not in (4, 5, 7, 9) or any(_ not in string.hexdigits for _ in hex_code[1:])::
Is there any reason why the identifier is _, since that's used as a throwaway usually from what I've seen, maybe use an identifier like letter or hex_letter
Sending this here because I wanna make sure this doesn't exceed the line character limit
Its at 102 currently, could add that in
Awesome
digit
That's a better identifier actually lol
Regardless, LGTM
I already approved it from earlier though
Oh boy
@summer garden which error message are you leaning towards? My opinion is the top one to keep it the same as the other commands
Line 251 i think it was, where match could be undefined
My two cents: The top one is better to stay consistent
I wasn't sure of this so I didn't comment. Can we move that line into the try block?
Hm
How come it should be outside?
I'm torn. I guess badarg is for arguement that are bad so making a custom exception doesn't make much sense
I don't know how this is usually done
this
also yeah, the rapid fuzz matching thing if not implemented could probably be implemented in a seperate pr lol
Please lord lets keep it separate
I could have a go at that some time
I got the rapidfuzz matching to work, and don't want to tackle another challenge /rewrite of it lol
no you must rewrite this command 4 times before its merged /s
Haaaa I already have
^6
I'll try to decipher this tomorrow
I've tested the actual color conversions and those seem to be sound
Well done on this
Thanks! It turned out to be a monster and a great learning experience
@dim pelican I left a review solely about documentation 😛
yeah that's why I never did it 😓
Ahhh you reviewed before my last commit
They should all be "Create an embed..."
tldr those are what are shown to the user, so they should be useful for the end user
this one should not be resolved https://github.com/python-discord/sir-lancebot/pull/842/commits/aaad72a40b21b9d3b1d43d67a3206923722d8575#r747089330
other than that tho
"User initiated command...."
the redundancy /blunt
I haven't seen a bot command that wasn't user initiated 😛
which page is that?
RIP
I turned them off and created an email rule that sends them to a special folder
this is a search for it
look at the scrollbar on the right
oh just like 1k emails from this one pr
I can believe it
i don't check my email that much
your client doesn't support threads? :P
outlook
Should be able to group conversations into single entries that can be expanded
gmail does this, so it shows up as a single message
@fallen patrol https://github.com/python-discord/sir-lancebot/pull/842#pullrequestreview-803268423
I mentioned it my last review 
https://github.com/python-discord/sir-lancebot/pull/842#issuecomment-965876151
lmao
;-;
Yeah I get quite a few emails
Gotten 1,000 emails or so in the past 2 weeks
I think 500 of them have been from github
@dim pelican Greetings, fellow human. Do you think it's possible for you to go through the reviews of the color PR to make sure that everything is resolved?
Salutations familiar life form, I believe everything in the reviews have been resolved, do you see one that is still outstanding?
BTW both Blue and Hedy have said they will test and review once more
Lol
!remind 1H test brads color pr hopefully
Your reminder will arrive on <t:1636599301:F>!
Very well.
Here's your reminder: test brads color pr hopefully
[Jump back to when you created the reminder](#dev-contrib message)
Here's your reminder: https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/bot/#with-the-bot-running-locally
[Jump back to when you created the reminder](#dev-contrib message)
@static canyon about the typehint tag. I wanted the tag to showcase that you can hint normal variables as well, not just function parameters. we could also try to keep the tag simple as a quick introduction and remove the temp variable entirely
Yeah, I get why you wanted that type hint but it's not a good example
Variable type hints should only be used when the type isn't obvious
I tried to find an example on the bot repo but couldn't easily find one
yeah, I don't think we can fit a reasonable example in that tiny space. let's just put the return all on one line
Perhaps another example following the lines ofpy data: list[str] = some_untyped_function() # we manually specify the type here since `some_untyped_function` doesn't have a return typehint so the program doesn't know what type it is
I'll have some time later today, I'll play around with some examples
👍
I wouldn't say "only" here. Different code-bases have different guidelines
certainly not in the example we were using though
Here's your reminder: g
[Jump back to when you created the reminder](#dev-contrib message)
Hey, @hardy gorge (I'm sorry for the ping).
There have been discussions about the use of a test DB or mocked DB in the testing environment of the API (see: api#25)
What's your opinion on that?
(I'm looking to work on that PR this weekend if we manage to decide. 😄 )
We ended up having a long discussion about it in dev-core. @last patio @obtuse arrow @green oriole can y'all put whatever you decided on in the issue
That's a good question. I like being able to test with a production-like test database for integration tests, although I don't think it's necessary for all tests to be integration tests. You don't really get there if you only ever use a mock database, although you can get pretty close to the edge. (Some people call that edge-to-edge testing in the context of end-to-end testing.) A mocked database does allow you to test features independent of the database, which could be useful as well.
I don't think it's particularly hard to set up a test database. The ORM is capable of setting it up without running through all the migrations, although running through all the migrations also has its advantages if they define more than just the schema.
No, it isn't. I had some free time and implemented the use of a test DB in the test environment, I was just waiting for the decision, which I'm still not sure about to be totally honest 😂
There was a longer discussion in #dev-core, which should probably be leading here. I'm currently not really able to held up my end of the bargain in terms of being capable of taking some kind of lead role in this project, so it's probably be better to find another way of managing the project. But I'll have to discuss that with the admins as well.
Yes, I understand. Then, I'll prepare my solution and push the new test suite.
Should be done by the end of tomorrow! 🙂
One thing, before however..
So, for local testing there has to be a test database as well, and I did some research on creating an additional database in the docker-compose environment, but I ended up adding an additional test database container, I'm not sure about that solution though, that's the last thing I swear! 😄
(It's fine if the testing is done in the CI env. , I've set it up already.)
You can add multiple databases to the same docker container
Well, how? 😄
With a SQL script, or similar?
Same psql container
just use CREATE DATABASE
So in the fixture, you could have the first step be the creation of a "test" database
Then you switch your database url to that newly created db and go as normal
Also, do you have to have your async stuff in a branch somewhere? 😄
No, actually I tried to set it up locally but miserably failed to do it.
I'm not sure what the problem is, it wants to use pyscopg for some reason.
Do you happen to have the changes locally still?
I wouldn't mind giving it a go if you could push to a remote branch 😄
I haven't done anything significant, just the alembic async config you sent me previously, 😦
But, I would be very grateful if you could somehow get it working.
I'll give it a look
Also, sorry for my lack of knowledge in Docker, but where do I run this, again? 😄
not in docker
you connect to the db as you do with the db url
then create a new database using .execute("CREATE DATABASE test)
and then drop that connection and connect with the same url but with /test on the end
So instead of postgresql://pysite:pysite@postgres:5432/pysite you'd switch to postgresql://pysite:pysite@postgres:5432/test
Oh, I see. I can integrate this into the pytest fixture I set it up, so that in the end it tears down the database.
Thank you! 🙂
👌
you can use urllib.urlsplit to split the connection url into it's parts
and then change the path
rather than messing on str.split
Thank you, btw. another thing I had problem with during this async setup is pydantic and the “asyncpg+postgresql”
Is that due to the PostgresDsn thing we use?
I just came across that, so I made this ```py
class AsyncPostgresDsn(PostgresDsn):
"""Extension of Pydantic's PostgresDsn to only allow the "+asyncpg" schema."""
allowed_schemes = {"postgresql+asyncpg"}
just building the image now to see if it works
Also, how would we run validations on the models if we use async sqlalchemy? ( see User model, role validations)
It lives poetry run task revision "Test migration." 😄
that ran fine
uhhh not sure, lemme look to see what they're doing
ah yea, that would need changing
I don’t think that validations can be coroutines, so we might have to find a workaround
Yea from doing some searching it seems pydantic is against becoming async
so we would likely need to do any async validations in the routes
EG the role validator, we can do the negative one in the pydantic model, but the non-existent check would need to be done in the route itself
Which route?
which doesn't seem overly unheard of
which ever route relies on the role given existing
That validation is on the User model itself, it iterates through the array if role id’s and checks, if they’re existent.
Upon the creation of a user
Yea, so IG it's used by the POST/PUT method on some user endpoint?
so we'd defer that role check to within that route
since we're then in async land
Alright then, I’ll make sure that it gets implemented when migrating this endpoint.
ah lol, that's why I was having issues finding where it was used
was just going to fix it myself now
Yeah 😂 it’s still yet to be implemented, it’s gonna be the next endpoint 😄 although I’m not sure which endpoint it is.
@vale ibex Thank you for the PR, makes things way easier.
Because of the recent changes, and discussions I might have to change many things in the PR. So I might reopen it and start it from scratch. Would it be a problem?
The branch is on origin, so feel free to pull it and make changes to it directly 😄
Should make it a little easier on you too, rather than having to reimplement all of these changes
Yes, I was gonna do this, since my current pr branch is messy already.
Before I start, one last thing.
Is there a preffered sqlalchemy syntax? 1.4 or 2.0?
could be better to go to 2.0 now, rather than having to migrate when more things are implemented
Sure thing. Then I’ll definitely open a new PR. 😄
Put up site#622 for easy docker migrations (and pgdata volume cc @tawdry vapor )
for snekbox, does the docker container have to be run in privileged mode?
yeah...
Async SQLAlchemy is pretty good, I'm glad we decided to use it in the API 
Yea I quite like it 😄
@router.post("/users/", response_model=UserRead)
async def create_user(*, session: AsyncSession = Depends(get_session), user: UserCreate):
"""Creates a new user."""
db_user = UsersTable.from_orm(user)
session.add(db_user)
await session.commit()
await session.refresh(db_user)
return db_user
nice and clean code
Even more "complicated" stuff is nice ```py
@router.get("/users/", response_model=list[UserRead])
async def get_users(
*,
session: AsyncSession = Depends(get_session),
offset: int = 0,
limit: int = Query(default=100, lte=100),
):
"""Get a list of all users."""
result = await session.execute(select(UsersTable).offset(offset).limit(limit))
users = result.scalars().all()
return users
Yeah, although I’m curious how the tests will work, if it involves setting up and tearing down databases.
since, the nature of async.
This has a pretty nice guide for testing https://rogulski.it/blog/sqlalchemy-14-async-orm-with-fastapi/
using pytest
specifically
while it's specifically for sql alch 1.4, I don't think it'll be too different
think it's because we create cgroups yeah
Ah I see, It looks good, although I’m not sure why was the session created twice and overriden in the fastapi app. We’ll see I might modify a few things
The biggest pain point is that snekbox needs to create parent cgroups for nsjail and therefore requires running the container in privileged mode. I've investigated ways to avoid this in the past, but was unsuccessful in finding any alternatives.
from mark
I think that was because of the way the injected the session into each route using fastapi depends
similar to how I've done it for patsy
Oh fair enough, I just set the db url to be the test db url when creating the engine for the routes. Although an env variable had to be set, so that might be more convenient
Yea, the idea is so that you don't need to do ```py
with Session():
...
it just gets injected into the route automatically
I see, first thing tomorrow! Thank you for all the help!
no worries 😄
Is site#362 still up for grabs? I feel like it's a med priority as many websites start to have dark themes and reading guides (such as contributing tutorials) at night is really a pain unless they have stuff like dark reader.
This was the only thing I could find relevant about that issue #dev-log message so I thought I should ask about it before working on it 😄. I can give it a go for the CSS and bulma parts but would need some help for the toggle switch / oauth integration.
Doesn't seem like it, could you comment on the issue and I'll assign you 😄
Iirc, at some point someone was working on it, but never got back to it. Regardless, it's going to be a lot of CSS for whomever ends up taking this on
shore done
As machoistic as it sounds, I now feel like writing some CSS. I should probably get forms back up and running now
site#508 needs reviews.
does the bot not like me lol
^ needs reviews.
heh?
Did we merge something
on sir lance, yes
When, and what
9 minutes ago
this is the only thing that has been merged recently
And no start up message
oh dear
I wonder if related
I don't actually know this is the cause
should we reboot the bot?
Well, no. See #dev-oops it's crashing at startup
Lets see if I can get k8s logs from grafana
there we go
yeah I saw a lot of hard coded colors when I looked through the code base some days ago. I think I'll clean them up and assign variables or something. I'll also have to ask about some bulma and theme colors for dark mode, will ask when I get to them ~next week or 2
uhh @vocal wolf for the edit on github button I was already finsiehd working on it (I took a slightly different approach to the original PR) are you wanting to take over it? I'm happy for you to do it but I was using a better method and it only shows on articles, not both articles and categories
tbh I have no idea how 2 site so you can take over
.bm
how 2 site?
I don't know frontend stuff and/or django
haha alright it's ok
dawn already assigned me so I guess I'll PR my changes soon, might add some tests even though it's already 100% cov
Hol' up Sir Lancelot is just vibing in downtime hell?
Is it still down
.help
Well, it is up
I saw some messages earlier today about reverting something
I believe we pinned sir lance to à specific commit
it was up a few minutes ago
.src
lol
i mean
someone restructured lance and i think that got merged lol
removed the bot data mount??
Well, yes see Scale's PR
It is currently pinned to 4224522, whatever that is
Or it is just kubenav being weird
Scale's PR doesn't fix the issue with DEBUG set to True in docker, does it?
nope, just started
run .uptime 😛
debug = os.environ.get("BOT_DEBUG", "true").lower() == "true"
shouldn't that default to 'false'?
sir-lancebot@ec5eaadaae3e92f742f49085f782be40195a891c is the last deployment
Okay, that's indeed main
.uptime
I started up 3 minutes ago.
Guess it do be solved
lol
@dim pelican Re: https://github.com/python-discord/sir-lancebot/pull/842/commits/1914905bdc7bd591ff906562ee0496346d37a045#diff-141c9b3ff34e8fb41e45ebec131191459c020856b893e5a69ce69d2323aa148dR46 hey brad, did you test this? Wouldn't this strip off the last two digits of the input regardless of whether it was in the form of #RRBBGGAA or #RRBBGG? 
No, somebody explicitly wanted it to default to true. We set it to false in prod
Nope, im going got delete file logging completely, just wanted to put out that fire first
What will happen to the bots in this server after discord.py is gone
for now nothing
we'll see what options emerge down the line but there is no pressing need to change anything
The module will be of no use
why not?
You have to change the code
discord.py doesn't lose it's value because it's not maintained, everything that is there still works and works fine.
eventually we'll migrate, most likely we'll use a discord.py fork
Oh so it won't be updated but we can still use it
so that we would already be somewhat compatible
There's no way to just turn the module off, it's just Python code wrapping the Discord API.
for now yes, I wouldn't encourage you to commit to it and I would explore the available forks like https://github.com/DisnakeDev/disnake
Nice then
I've made local changes to the site repo to add another field to the infractions database. How can I use this in conjunction with the bot repo to access & test the new field?
How do you usually run site, and how do you usually run bot
I've never run site before, and I do docker-compose run bot for bot
Ok, modify the site in the bot’s docker compose to point to your local site, instead of the remote container
You’re gonna want to copy the whole build part from bot basically, and modify it for site
hmmm
How do I do that?
Do you see the part in the compose that says image
Replace that with the “build” part from bot, then modify the context and docker file to point to where you have the site repo locally
In the site repo?
This is all in the bot repo
There's nothing that says image
ah wait
I see
web:
<< : *logging
<< : *restart_policy
image: ghcr.io/python-discord/site:latest```
I'm guessing you mean this
yeah i have
nope, if you have the site image built, just running the bot is fine
by changing that line you are telling docker to use the local image, rather than use the one in ghcr
right, okay
It's doing stuff at the moment
Pulling web (site_web_1:)...
Just taking an age
PS C:\Users\tizzy\bot> docker-compose run bot
Pulling web (site_web_1:)...
ERROR: pull access denied for site_web_1, repository does not exist or may require 'docker login': denied: requested access to the resource is denied```I think I do need to run because I'm getting this error?
It does exist
Could you show the docker-compose file?
For bot?
- image: ghcr.io/python-discord/site:latest
+ image: site_web_1
that's the change you have right?
web:
<< : *logging
<< : *restart_policy
image: site_web_1
command: ["run", "--debug"]
networks:
default:
aliases:
- api.web
- admin.web
- staff.web
ports:
- "127.0.0.1:8000:8000"
tty: true
depends_on:
- metricity
environment:
DATABASE_URL: postgres://pysite:pysite@postgres:5432/pysite
METRICITY_DB_URL: postgres://pysite:pysite@postgres:5432/metricity
SECRET_KEY: suitable-for-development-only
STATIC_ROOT: /var/www/static```
yeah
That worked
nice
what did you add?
dm_sent field to the infractions database
the _utils.py file has the actual call to the api
in post_infraction
and the get too
merci
so that's where you'd add the param, but you'd need to go up the chain to where we try to send the dm to actually set it's value and pass it all the way through
Nice 😄
Ah
We have a bit of an issue lol
apply_infraction is where we try to DM, but post_infraction gets called before apply_infraction
So I guess I just need to change it so that we apply first
I don't particularly understand why we post being apply anyway
Hmm
I don't understand this lol
@vale ibex please help lol
I don't know how to get dm_sent into post_infraction
Unless we POST then PATCH or something put that's probably not a good thing to do
I would say patching makes sense here actually
Time to double the amount of API requests then
I'll have to figure out how to do that
Send a PATCH at bot/infractions/:id with the json body {"dm_sent": true}
Your reminder will arrive on <t:1636718102:F>!
!remind edit duration 3461 40M
That reminder has been edited successfully!
Thinking about it what I'll do is default to making it false and then if the dm gets sent do the PATCH. Which I realise is probably what you originally meant and I probably just misinterpreted
I didn't think about that but yeah that's smart
Here's your reminder: ^
[Jump back to when you created the reminder](#dev-contrib message)
Is the : needed? i.e.py await bot.api_client.patch( f"bot/infractions/:{infr_id}", json={"dm_sent": True} )
Nah nah, it was to specify you need to enter your ID variable here, not a literal "id"
👍
So f"bot/infractions/{infr_id}"
async def notify_infraction(...): # pre-existing function
...
dm_sent = await send_private_embed(user, embed) # line was previous just `return await ...`
if dm_sent:
await bot.api_client.patch(
f"bot/infractions/{infr_id}",
json={"dm_sent": True}
)
log.debug("Updated infraction #{infr_id}. `dm_sent` field set to true.")
return dm_sent```this is the approach I've gone for
which isssue is this? So I can get some context on the discussion
bot#1864
👍
yeah that would work, and btw you are missing the f on the logging statement 🙃
Yep, thanks 👍
Also for the api PR, it should probably default to False
as we patch it later as True if it is sent, originally we don't set it
Also could you run black, there is no workflow for it yet.. planning to make a PR soon if no one gets to it before
originally we don't set it
I do actually
Ah ok but still I don't see the need to set it originally
I just added dm_sent: bool = False, to post_infraction and then "dm_sent": dm_sent to the payload
ah ok 👍
@gritty wind biased poll lmao
It's been fixed smhhhh
lol
It's not strictly a democratic poll btw. I've never used it, but I'm open to listening if someone thinks it's important
I guess it is more a matter of who use it and why, rather than who doesn't
I feel like we're going to see that most don't. We can try to accommodate those who do though. But if this poll goes as expected, at the very least file logging will not be enabled by default and will get it's own flag
that's probably a smarter solution, yeah
It's a valid solution, but if no one uses it, I don't think we'll bother tbh
We'll see
I only used it once, when I cleared my terminal by mistake and wanted to see my error traceback and my debug logs
Yeah I figure something like that is most likely to be the reason people might use it, but it's a bit niche
Ho guyz
@gritty wind would it be possible to make it user-togglable? Is there any way that would reduce the maintenance burden?
we can just add a env variable ro enable/disable it, it won't really be a maintenance burden
I do find it useful to be able to look into older logs
Gotcha
although I could also just redirect the output from pycharm
fwiw, we don't do it in prod because our prod filesystem is read-only
so that's why we have the toggle there already
ah I missed null=True, we don't need that if you always pass on dm_sent
We'll still want to give older infractions a sensible default
hmm so null sounds the best, 👍
Yeah, the null=True was for for prior-infractions
We can't default to False there since that could be incorrect information (we don't know if it sent or not)
yeah
@gritty wind FYI I do have a reasoning against it, when running inside Docker, since the container is running as fakeroot the bot file it creates will be owned by root, which could be a big problems for users that don't have root access on their machine, as they won't ever be able to delete the file
even with root access it is a pain
How can I make the bot repo use my custom schema for site?
I've updated site but I've tried a number of different things in bot but it won't run my site
I've changed that in the docker-compose but it's still not using the right site
Because when I run site on it's own and then send a GET to /api/bot/infractions it returns an empty list but when I do it in the bot it returns stuff
So it's using a different site
whats your docker-compose?
You should run site separately in docker, and run bot with poetry since the only needfor docker running is redis and site, you don't need rdis now so you can skip that
web:
<< : *logging
<< : *restart_policy
image: site_web
command: ["run", "--debug"]
networks:
default:
aliases:
- api.web
- admin.web
- staff.web
ports:
- "127.0.0.1:8000:8000"
tty: true
depends_on:
- metricity
environment:
DATABASE_URL: postgres://pysite:pysite@postgres:5432/pysite
METRICITY_DB_URL: postgres://pysite:pysite@postgres:5432/metricity
SECRET_KEY: suitable-for-development-only
STATIC_ROOT: /var/www/static```this is the relevant bit
share the Db section also, I am not completely sure btw
Left that defaultyml services: postgres: << : *logging << : *restart_policy image: postgres:13-alpine environment: POSTGRES_DB: pysite POSTGRES_PASSWORD: pysite POSTGRES_USER: pysite healthcheck: test: ["CMD-SHELL", "pg_isready -U pysite"] interval: 2s timeout: 1s retries: 5
Could you share the logs from docker compose up -d web
Ah, use the DB of the site compose, site_postgres IIRC
It shouldn't really matter, the site will migrate any DB to work
since that has the schema changes
Site migrates DB at startup
It could work, just by virtue of the data being in one db, but not the other
PS C:\Users\tizzy\bot> docker-compose run bot
Pulling postgres (site_postgres:)...```seems to be working
The DB migration happens during the image formation ig
Ah, the name is wrong PS C:\Users\tizzy\bot> docker-compose run bot Pulling postgres (site_postgres:)... ERROR: pull access denied for site_postgres, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Lemme see what it is
It is the postgres:13-alpine lol
just run the bot with poetry lol, and update the URls to be the correpending ones from site compose
It's trying to pull from a remote, check the name
that'll do nothing, it'll just try to use the pg:13 image from docker hub
The problem isn't with your DB
From which repo?
Bot
Okay
PS C:\Users\tizzy\bot> docker-compose up -d web
Starting bot_postgres_1 ... done
Starting bot_metricity_1 ... done
Starting bot_web_1 ... done```
nope
ah ok
Could you get the actual logs? It should be easiest to do from the docker desktop UI
I think this is what you want https://paste.pythondiscord.com/hepemosuma.properties?noredirect
you could probably get in your bot_web shell and see if it contains your changes, that could be the only issue if DB isn't it
So I'm seeing that it didn't find your migration
It did
web_1 | Applying api.0075_infraction_dm_sent... OK
Oh nevermind
L417
What is the problem exactly
I don't know just the infractions don't have the field
Did you modify the viewset
Are your changes pushed somewhere
site#621
Nobody knows lol
Your code is fine
Do you actually have an infraction in the DB
(The one in the bot compose)
I should do
Lemme start up the bot
PS C:\Users\tizzy\bot> docker-compose run bot
Starting bot_snekbox_1 ... done
Starting bot_postgres_1 ... done
Starting bot_redis_1 ... done
Starting bot_metricity_1 ... done
Starting bot_web_1 ... done
Creating bot_bot_run ... done```
PS C:\Users\tizzy\bot> docker-compose run bot
Starting bot_postgres_1 ... done
Starting bot_snekbox_1 ... done
Starting bot_redis_1 ... done
Starting bot_metricity_1 ... done
Starting bot_web_1 ...
Starting bot_web_1 ... error
ERROR: for bot_web_1 Cannot start service web: driver failed programming external connectivity on endpoint bot_web_1 (8a9e308e78ee023ae1be1b26d594be0a0e0a662d7e99225e13d651877818587e): Bind for 127.0.0.1:8000 failed: port is already allocated
ERROR: for web Cannot start service web: driver failed programming external connectivity on endpoint bot_web_1 (8a9e308e78ee023ae1be1b26d594be0a0e0a662d7e99225e13d651877818587e): Bind for 127.0.0.1:8000 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.```getting this now
Do you still have them running in another container
What makes you think that?
It has the thing twice
That's just how docker formats the output
It's only trying to start it once
check the output of docker container ps
ah
PS C:\Users\tizzy\bot> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Now got this
@gritty wind
It's complaining that site isn't running lol
And if I make it run then it complains that it is running
What do I do?
What did you run when you got that?
docker-compose run bot
well, just docker-compose up -d
or up
yeah up
start? I'm blanking on the command
Yeah run is something different, we want up
Do you have something somewhere running on that port? W/e, we can brute force our way through by setting a different one
You probably have it running in the background somewhere within your system. A reboot would in theory sort it out. If it's still in docker, you could check docker desktop's UI to look for anything that might be running.
Otherwise, for now just change the port
There's nothing running in docker
I guess I'll restart my PC
Be right back
Let's see
nope
Not happening
Ffs
Just change the port
Line 76, in bot. Almost everything is in bot, always
- "127.0.0.1:8000:8000" -> - "127.0.0.1:8001:8000"
Which file?
Docker compose
Yeah give it a shot
