#tools-and-devops

1 messages · Page 19 of 1

sturdy seal
#

We aren't just handling accounting now, though.

thorny shell
#

heh. imo there aren't any

#

there are only horribly-complex ways, and less-complex ways

sturdy seal
#

So python across the board was decided and I was hired. 😄

thorny shell
#

I still don't understand your setup, but if you're using an EC2 instance and nginx, then you should look into "lego" -- it's what I use

rapid sparrow
#

cases like that make me scarried ever leaving current company. Sure... our code is written may be far from perfect way. (in python too)
But still we uphold a lot of things for dev comfort
It sounds... impossibly challenging to maintain system like you have.

thorny shell
#

that's the first thing I found that was simple enough for me to understand, and get working

heavy knot
grim osprey
#

Let'sEncrypt seems to be good in general, but I haven't used it so can't say.

heavy knot
#

suggestions on installing docker?

thorny shell
#

I am using it, without docker, but on AWS

#

it's just a program you run

heavy knot
#

nvm i am big brain

indigo zenith
heavy knot
#

wait oh no, is there a way to get a free certificate?

indigo zenith
heavy knot
#

is AWS with or without shell access?

grim osprey
# heavy knot wait oh no, is there a way to get a free certificate?

If you're at a company, maybe IT or some other department can provide you with a certificate. If it is a completely internal service, usually certificates are issued from the domains CA server. If it's external, you need to demonstrate that you own the domain.

In order to get a certificate for your website’s domain from Let’s Encrypt, you have to demonstrate control over the domain.

crimson spruce
heavy knot
heavy knot
indigo zenith
indigo zenith
sturdy seal
grim osprey
# heavy knot I own a domain through NameCheap, how do i demonstrate it?

https://letsencrypt.org/getting-started/ Read through the documentation. You're the one that's going to maintain this over time and it would be much more helpful to future you if you read the documentation. Certs have an expiry-time, so you're going to want to be familiar with the process of requesting/renewing them. It's not a one-time thing. When the certificate expires, the service is (likely) going to be inaccessible.

If there is a particular step you have issues with I can try to assist.

thorny shell
heavy knot
#

where is the documentation? also should i follow the ACME certbot instructions?

grim osprey
heavy knot
#

what is wrong with the domain?

heavy knot
#

8000 is not a port you linked to http in your incoming ports, is it?

heavy knot
#

if it returns an HTML document but it looks different check the DevTools->Network Tab for errors in the css requests.

heavy knot
grim osprey
# heavy knot what is wrong with the domain?

Doesn't seem to be an issue with the domain. It looks like you got the certificate and private key /etc/letsencrypt/live/harmonyapp.org/*.

The installer looked through the nginx-configuration and didn't find a serverblock listening to "harmonyapp.org", so it exited. It couldn't figure out where to put the configuration lines for the certificate.

heavy knot
grim osprey
#

Yes, that's probably the easiest solution

heavy knot
#

wdym? isn't that vim?

#

i enables editing, :wq for write & quit

heavy knot
heavy knot
#

`
server {
listen 80;
server_name harmonyapp.org www.harmonyapp.org;

# Redirect HTTP to HTTPS
location / {
    return 301 https://$server_name$request_uri;
}

}

server {
listen 443 ssl;
server_name harmonyapp.org www.harmonyapp.org;

ssl_certificate /etc/letsencrypt/live/harmonyapp.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/harmonyapp.org/privkey.pem;

#What do i add here?

}
`

heavy knot
#

i haven't edited nginx, probably Netherwolf can help you

#

i'd say this info should be easy to search though

#

paging doctor Netherwolf

grim osprey
edgy basin
#

trying to setup fuzzing and am confooz

edgy basin
#

fuzzing make me oof

edgy basin
#

okay so im trying to write fuzz tests

#

and the thing im fuzzing against

#

uses randomness in the function

#

😔

#

i feel like im just ranting here

heavy knot
#

How do I get the nginx to see the ssl certificate?

gentle solstice
#

Does the nginx user have read access to that folder?

heavy knot
thorny narwhal
#

did You guys ever automated configuration of the user profile and computer settings in windows with python ?

gentle solstice
#

That's best done with powershell

thorny narwhal
#

well i do not know powershell and i would not like to use it

thorny shell
#

and yet it's ideally suited for maniuplating Windows, wheras python isn't đŸ€·

#

I myself hate and fear WIndows, and yet ... I have a gruding respect for Powershell.

gentle solstice
#

powershell lets you cd into HKLM:\

#

registry keys are treated as files in powershell

thorny shell
#

stuff like that, ya

gentle solstice
#

basically, microsoft saw linux and /sys and /etc/system and decided that was a good idea.

arctic flicker
#

I have opened a folder in VSCODE and want to add it to github. Why is it stuck like that? With the commit button greyed out

arctic flicker
#

what does staging even mean?

willow pagoda
#

when it prompts you with a file to edit like that, it wants you to type something appropriate, save, and then close the file to perform an action

arctic flicker
#

Ah I see!

#

Thank you

burnt ginkgo
#

Why do we use -e .

astral apex
#

When you install your package, it creates a copy of your code, so every time you edit it you have to install it again

#

Editable links to your current folder instead of making a copy
So you don’t need to install over and over again

rapid sparrow
#

if u use flat structure. when at root folder u have package_name/__init__.py, u usually don't need -e because current folder is already... sensed as installed package

#

and if need to reuse your library in other application in real time edit, usually -e is not very convinient too because it does not propagate to docker environments.
Easy to use overshadowing trick, where u just mount volume your library into app project folder 😁 real time editing too then. compatible with docker (its own docker volumes could be utilized for this hack)

#

-e pretty much useful only if u develop applications straight in a current machine filesystem without extra complications

#

đŸ€” technically nothing really forbids using -e mod with docker, if volume forwarding appropriate library project to it

gentle solstice
#

e for editable

rapid sparrow
#

question araises though, what is the benefit of using -e if u can just volume/mount forward library folder itself into end project folder and it will be already working as editable lib

arctic flicker
#

say I have an executable c:\python\python.exe
how do I use pip to install to that specific python instance?

rapid sparrow
arctic flicker
#

thank you!

heavy knot
#

stil no idea on how to fix this or what I should change in the config

mint cipher
#

Can anyone share their terraform script that deploys Django made in Docker to GCP or AWS?

heavy knot
#

python -m pip install ... @arctic flicker

heavy knot
heavy knot
#

how do I save and test a config in AWS?

rapid sparrow
#
  1. u could just open it with nano, it has obvious simple interface
#
  1. u could connect with program like vscode, using plusin remote ssh stuff and edit in real time through vscode (assuming u know how to use ssh)
#
  1. u could learn how to use 👀 probably it is vim? how to edit and save. i never bothered to remember. too over complex unintuitive program
#
  1. you could learn (i like the best option) running your nginx at your local environment for more rapid feedback
    by just using Linux as main OS, or at least windows with WSL2
  2. you could apply local code to modify remote server by using things like ansible (or other configuration management tools), including terraform and etc
heavy knot
#

new error, I just need to chang redirect settings, idk

heavy knot
rapid sparrow
heavy knot
heavy knot
rare anvil
#

like if u take some time to understand what he said...

wet plover
#

i want these full number can tell me anybody

heavy knot
#

new error unlocked

#

you have an extra } don't you (edit, meant need an extra })

#

i dont think so?

#

i removed the }

#

and it gave me this

#

when i readd the } it gives me this still

#

there is a bracket mismatch, one } missing it indicates.

#

why aren't you using vscode with remote ssh?

#

chat gpt may find the error

heavy knot
lethal pond
#

pre-commit is slow and is extra work to keep it's version synced with my pyproject

#

so I'm looking to find a decent replacement

#

something that can run ruff and mypy for me

#

oh yea pre-commit's mypy is an issue too so that's another reason

#

I use poetry

thorny shell
#

I have my editor do "ruff format" on every save; it's fast enough.

#

I only do "mypy" at the same time I do unit testing

lethal pond
#

am i doing something wrong then?

#

I have the ruff extension but it's not doing anything from what I can see

thorny shell
#

on every keystroke? That seems like overkill

#

Anyway that looks like Visual Studio Code, but I don't use that, so can't help with it

gentle solstice
heavy knot
#

do i have to create the www, i am trying to set up nginx

lethal pond
#

I don't even see a "format" on save

heavy knot
#

how do i use socket?

gentle solstice
#

varwww is for apache httpd

gentle solstice
#

It should look something like this. ```cfg
server {
listen 80 default;
server_name localhost;

    access_log  /var/log/nginx/localhost.access.log;

    location / {
            root   /var/www/nginx-default;
            index  index.html index.htm;
    }
heavy knot
gentle solstice
#

Oh, this is amazon linux.

#

Check /etc/nginx/conf.d

#

it's a directory

heavy knot
heavy knot
gentle solstice
#

use ls to list the files

#

There's nothing in there...

#

Ok, check /etc/nginx/nginx.conf

heavy knot
#

oh no, um recover, edit anyway?

gentle solstice
#

Do you have another instance of vi(m) running?

heavy knot
gentle solstice
#

run pkill vi

heavy knot
gentle solstice
#

It's running as root

#

use sudo

heavy knot
#

seems to work

dire rivet
#

Does anyone know any good frameworks?

#

I normally use tkinter

gentle solstice
#

pyside6

#

wxpython

dire rivet
#

Thanks

warm rock
#

Having a little trouble with a project. I made a script to webscrape product information from wholefoods site, but in the all products page there is a Load More button at the bottom and my current script using the Requests library I'm not sure how to get around this to pull all the data. Do I need to switch to selenium or is there a workaround?

median saddle
#

Hello I am using lazyvim but I can't run my Python code due to this error:
Error invoking 'python_execute' on channel 3 (python3-script-host): Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'caesar_cipher' is not defined

This is my caesar_cipher.py :

`#text = input("Enter your message: ")
#cipher = ''
#for char in text:

if not char.isalpha():

continue

char = char.upper()

code = ord(char) + 1

if code > ord('Z'):

code = ord('A')

cipher += chr(code)

#print(cipher)

Caesar cipher - decrypting a message.

cipher = input('Enter your cryptogram: ')
text = ''
for char in cipher:
if not char.isalpha():
continue
char = char.upper()
code = ord(char) - 1
if code < ord('A'):
code = ord('Z')
text += chr(code)

print(text)`

So what is wrong about this code and why can I not run it in lazyvim? In vscode it works fine, but not in lazyvim..

indigo zenith
warm rock
#

Sorry no that doesnt help. Instacart has different prices on their app than what whole foods has in store. Please help with my question

heavy knot
warm rock
#

Can you help via Requests using the JSON link on the network page

heavy knot
#

it's a lot more hassle, just use a lib that's for the purpose, try selenium.

warm rock
#

It ends in ...offset=0 and the number increases by 60 each iteration the iterations part im just having trouble figuring out

heavy knot
#

yeah it takes time to learn that. that's why you start easy.

warm rock
#

Tells me the count of products 11348 on the site so I know I have to iterate the offset= number +60 until it reaches a number just above 11348

#

That's why im asking for help/guidance

heavy knot
#

i get it, but try selenium. in fact chatgpt probably can help a lot better

warm rock
#

I would really prefer to use requests I just need a nudge in the right direction

#

There are 190 load more screens to reach the bottom of the all products list I dont want to click load more 190 times via selenium

heavy knot
#

Requests to the json api endpoint is ok. Assuming they allow it

#

but normally only requests initiated from the page's origin (the main domain name) are replied to, to avoid people stealing I guess @warm rock

heavy knot
#

new error? how to get websocket to work idk

hollow storm
#

idk what you mean with the websocket thing

#

this error is probably because epel 7 is EOL

heavy knot
hollow storm
#

if im not sure whats your end goal it's hard to help

heavy knot
hollow storm
#

these are the rough steps i would take to do this:

  • make sure you have python and a reasonably modern one (you can check with python -V, i would say anything higher than 3.7 is fine)
  • create a virtualenv, preferably in the same folder as your code (python -m venv venv for example)
  • activate the virtualenv (source venv/bin/activate)
  • im gonna assume you dont have a requirements.txt. if you do, ignore the next 2 steps and do pip install -r requirements.txt instead
  • try to run the program. you'll get an error like Could not find module django
  • run pip install django and keep trying to run the program and installing what's missing until it works
#

once you have it running, you need to figure out a way to leave it running even when your terminal dies. the easiest way is probably nohup, there are some fancier alternatives like creating a systemd service or using pm2

hollow storm
#

yes

#

in any case you have the version there

#

it's 3.9

heavy knot
hollow storm
#

that works too. idk your setup

heavy knot
#

also requirements did not work?

heavy knot
#

Running the server does not run the Django project, instead it runs the ngxin conif. How do I change that?

spice field
#

nginx looks like it's serving port 80

#

You would most likely need to configure a reverse proxy to serve port 8000 to the webpage

#

At least that's what i've always done for things that use ports

#

Ex in your nginx domain config, your server block might look something like this:

server {
    listen 80; # Listen on Port 80 for IPv4 Addresses
    listen [::]:80; # Listen on Port 80 for IPv6 Addresses

    server_name harmonyapp.org www.harmonyapp.org; # The  domain of your website to include the www subdomain
        
    location / { 
        proxy_pass http://127.0.0.1:8000; # The host:port combo Nginx should serve to the website on Port 80
        include proxy_params;
    }
}

This is configured for a non-SSL certified website. If you end up getting an SSL certificate, make sure to switch the listen port 80 to 443

While this guide is used for Ubuntu, it should apply to most flavors of *nix

heavy knot
#

so run django on port 80
then reverse proxy it using proxy_pass
and then running django and daphne at the same time, turn them into systemd services

quick lance
#

i need help man

#

i have an error

#

i am a beginer python

spice field
#

ex nano /etc/nginx/sites-available/harmonyapp.org and then paste what I put above. Then hit CTRL + O and then enter to save and then CTRL + X to quit

brazen forge
#

nano's key bindings are so weird

spice field
#

such as

first = float(input('What is your first number?'))
spice field
#

I know it's super powerful, but I just don't find it to be efficient for me

heavy knot
#

I am having some trouble with the guide, what does it mean does not exist?

spice field
#

on the ln -s ... command

#

You left it as your_domain

heavy knot
#

but then i reran it correctly

spice field
#

So it's looking for a file that has that filename

heavy knot
#

or did i not?

spice field
#

Yes, however nginx still things the other one is enabled

#

you mispelled the second time too though it looks like

#

harmonapp.org instead of harmonyapp.org

#

Oh i see

#

So open nginx.conf using nano /etc/nginx/nginx.conf and find that line that has your_domain

#

I don't use nginx on my server so I'm not sure what it's going to look like

heavy knot
spice field
#

Real quick, press CTRL + X

#

then type ls and send a screenshot

heavy knot
spice field
#

type rm -r sites-enabled/ right there

heavy knot
#

it worked?

spice field
#

Looks like it

#

Thought it was a directory

#

@heavy knot can you type ls /etc/nginx/sites-available/

heavy knot
#

thats not confusing

spice field
#

Alright now
ln -s /etc/sites-available/harmonyapp.org /etc/nginx/sites-enabled/

heavy knot
#

worked?

spice field
#

Yup, ln commands don’t give any output

#

Now try a systemctl restart nginx

#

Are there any errors?

heavy knot
#

where in the guide are we?

spice field
#

We kinda went off track of that to troubleshoot

#

You add some errors and typos and so we’re just kinda fixing that right now

heavy knot
#

ran the journalctl

spice field
#

cat /etc/nginx/nginx.conf

#

Might’ve enabled it twice and nginx is having a fit

heavy knot
spice field
heavy knot
spice field
#

Haha thanks I’m on my phone now so trying to help the best I can

#

Okay remove all of this


    server {
        listen       80;
        listen       [::]:80;
        server_name  harmonyapp.org;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }

Lines 39-55

spice field
#

We’re doing this because we have enabled the config in the sites-enabled directory. So we don’t want it in the main file

#

The line “include /etc/nginx/sites-enabled/*” is what’s letting nginx know we have that configuration available, just in another place

heavy knot
#

i saved and exited the conf

spice field
#

Restart nginx again

#

See if it errors out again

heavy knot
#

i see an error

#

its a new errors?

spice field
#

Can you run that journalctl command?

heavy knot
#

lmk if that works, i am not sure paste enjoys the journalctl command

spice field
#

ls /etc/nginx/sites-*

heavy knot
spice field
#

Alright let’s start over real quick.

rm -f /etc/nginx/sites-enabled/*

heavy knot
spice field
#

rm -f /etc/nginx/sites-available/harmonyapp

#

Run it as sudo

heavy knot
heavy knot
#

happy!

spice field
#

Beautiful

#

Let’s confirm nginx can be happy now. Restart it once more

#

It shouldn’t have anything conflicting

heavy knot
spice field
#

Alright, let’s confirm your original config. Let’s cat /etc/nginx/sites-available/harmonyapp.org

heavy knot
spice field
#

Looks fantastic

heavy knot
spice field
#

Now let’s do that ln command again:

ln -s /etc/nginx/sites-available/harmonyapp.org /etc/nginx/sites-enabled/

heavy knot
spice field
#

This is creating what’s called a symbolic link. Anytime you edit the file in sites-available, it will make the changes to the file in sites-enabled

heavy knot
#

symbolic? what is this 6th grade english class? jk lol

spice field
#

Now let’s try restarting nginx once more.

heavy knot
#

womp womp?

spice field
#

Man wtf lmao

heavy knot
#

ran journalctlhttps://paste.pythondiscord.com/F7YQ

indigo zenith
spice field
#

Oh lmao

#

I see now lol

heavy knot
spice field
#

You didn’t put the host:port combo

indigo zenith
spice field
#

Exactly

#

Need to put 127.0.0.1:8000

heavy knot
#

in the nginx conf file?

#

in the TPLS settings thing?

spice field
#

No in the sites-available/harmonyapp.org file

#

Look for the line “proxy_pass”

#

See if you can find the issue

heavy knot
#

wait wrong file?

#

oh sites-availble

#

one sec

heavy knot
#

i found it!

#

should this be 127:something something

#

or is this my private or public ip?

spice field
#

This is the app on the server you want to serve

heavy knot
#

is my "localhost" 0.0.0.0?

heavy knot
spice field
#

every host has this

#

It’s a standard/default address that points to your servers internal self if that makes sense lol

#

When you start the app it says it’s being hosted on 0.0.0.0:8000 right? You should be able to use 127.0.0.1:8000 or localhost:8000 to reference this

#

Since you’re not reaching out to a remote server

heavy knot
spice field
#

No, keep it as localhost

heavy knot
#

saving and exiting

spice field
#

Remove the last slash on that line

#

I think discord automatically put that in

#

So just 
:8000;

heavy knot
#

done?

#

i did the restart command?

#

time for proxy params?

spice field
#

Everything should be good

#

You don’t have to redo the ln command, it already knows where to look.

If you restarted, it should be good.

heavy knot
#

but error message?

#

but it works when i run sudo?

#

does that mean it works yay?

spice field
#

Yup @heavy knot

#

No errors should be good

heavy knot
#

I want to run django on port 80
then reverse proxy it using proxy_pass
and then running django and daphne at the same time, turn them into systemd services

#

how we gotten steps 1 and 2 done?

spice field
#

The Django?

#

Is the app right

heavy knot
#

it runs locally but the end result means it should work on a server

spice field
#

Yeah, the reverse proxy is what will make it be served on port 80

heavy knot
#

i think the daphne i need does not work, thoughts? how to enable http/2 what is that?

rare spire
#

Anyone in this Discord an expert in Prefect/Prefect Cloud?

spice field
#

forgive me if my responses are delayed im in a class rn

heavy knot
spice field
#

nginx and reverse proxy is as far my knowledge goes for what you're working on - i don't know anything about djano or daphne

heavy knot
#

any idea how to solve dependecy issues, i am following this guide to deploy on gunicorn

spice field
#

what version of python are you on?

gentle solstice
#

is ufw a requirement? Can you use firewalld instead?

#

That should be installed by default on amazonlinux

spice field
gentle solstice
#

though I also read that amazonlinux has all ports open by default because you can use aws itself as a firewall

spice field
#

I used to use ufw for everything because I started on debian/ubuntu. I work in a RHEL environment now and all I use is firewalld now

gentle solstice
#

look into setting up rules through the AWS security group

spice field
#

(thats for you backup 🙂 )

#

I dont work in a cloud environment but it's good to know if I ever do

gentle solstice
#

The recommendation is to not use a firewall, but to use aws security console to control what can access your server

#

a firewall adds overhead

heavy knot
#

the firewall prevents the server from running at all!

heavy knot
#

did i write the correct allowed hosts?

spice field
#

It looks like it protects from certain web vuln attacks

heavy knot
#

how do i determine what hosts i need?

spice field
#

I don't think that setting is applicable to the issue you're having

#

At what point did the website stop letting you connect?

heavy knot
#

sometime between when i make the directory for the venv and when i made the migrations for the directory

spice field
heavy knot
#

so i named y directory gdirectory

#

and it is in the venv of the repo

heavy knot
spice field
#

is directory meant to be called gdirectory?

heavy knot
spice field
gentle solstice
#

you need to configure the firewall in the aws console

heavy knot
#

projectdirectory

spice field
#

cause to me you stopped the django project from running

#

with CTRL + C

#

again i dont know django, just using t/s skills. unalive sounds more confident at this point than I do

heavy knot
#

have i not done that?

gentle solstice
#

No, that's just instructions on how to stop

spice field
heavy knot
gentle solstice
#

Can you connect via curl localhost:8000?

gentle solstice
#

in a new terminal console, right?

heavy knot
#

sometimes it times out

gentle solstice
#

don't close the terminal

heavy knot
gentle solstice
#

keep it open by making a systemd service file

heavy knot
#

hard life backup

heavy knot
gentle solstice
#

are you familiar with systemd?

heavy knot
#

or here

heavy knot
#

but idk where to write commands because in the venv or not in the venv does different things

gentle solstice
#

systemd service files go in /etc/systemd/system/

heavy knot
#

what are we looking for?

#

or are we making one of these?

gentle solstice
#

skip what you don't need

#

So start at step 7

heavy knot
#

do i have to run this in gdirectory?

#

also what happens when i control c and close this, does it just not work?

gentle solstice
heavy knot
gentle solstice
heavy knot
#

oh ok

heavy knot
gentle solstice
#

keep going

heavy knot
#

oh no

#

the preset in the guide is enabled

#

did i miss a step

gentle solstice
#

Did gunicorn.service start?

heavy knot
#

do i have to eanble?

gentle solstice
#

Run systemctl staus again

heavy knot
#

interesting?

gentle solstice
#

You only enabled the socket. You also need to start it

heavy knot
gentle solstice
#

your service file may be invalid.

heavy knot
gentle solstice
#

share your service file.

#

cat /etc/systemd/system/gunicorn.service and share here

heavy knot
gentle solstice
#

Use your own username

#

or make your own

#

All the boxed strings in the textbox should be replaced with your own

#

WorkingDirectory should be where your project is located.

heavy knot
gentle solstice
#

ExecStart should be the fully qualified command to start your server

#

User should be your own user, like ec2-user

heavy knot
heavy knot
gentle solstice
#

Fix the working directory and exec start

#

we won't be using manage.py. gunicorn is used to start the server

#

/path/to/your/project/.venv/bin/gunicorn

#

You can run which gunicorn to get the full path

heavy knot
gentle solstice
#

are you familiar with how absolute paths work?

gentle solstice
#

there's basically the root / which is the parent of all files. Your home directory is located at /home/yourname

#

That's the default directory when you log in

#

the absolute path is the path starting at root

heavy knot
#

noted, now how do i find out the absolute path?

#

at least in this context

heavy knot
gentle solstice
#

Ok run this. readlink -f $(which gunicorn)

heavy knot
heavy knot
gentle solstice
#

Use that as the execstart

fleet nebula
#

hey, 2 questions, what programming language does a keyboard use? like a normal laptop keyboard, and can i program it to behave like "Razer Huntsman Mini V3"

#

basically my computer can't even run shooter games ( could get proof of my bad laptop ) it just seems fun making it, if anyone does not know, ppl hate it because it helps on shooter games

#

i know that Razer Huntsman Mini V3 has other features that compliment and make the shooting better, but i'd like to focous on the key canceling and not allowing a and d be pressed at the same time

#

not only a and d, almost every key, might be interesting to see how it effects avarage typing and such

#

does github of this exist? seems like a good idea, ppl would like to use this for hacks

indigo zenith
# fleet nebula hey, 2 questions, what programming language does a keyboard use? like a normal l...

A lot here depends on the OS. Here's a note about fiddling with the Windows API with Python: https://stackoverflow.com/questions/71370107/how-to-change-input-keyboard-layout-programmatically-in-pyqt5

spice field
#

Anyone have any good resources on git pipelines and how to do local dev and push to a remote prod environment?

spice field
gentle solstice
#

Don't see why not

#

it will be a worker app

spice field
#

I like the scaling feature, not sure how that would work for a bot because I know they use shards. But I think Dokku sounds like it's the right track.

Is what I'm essentially doing is committing my changes to my GH repo, and then go sync it with the dokku container, it detects the changes and pushes them?

gentle solstice
#

yes.

spice field
#

this sounds perfect

#

thank you so much

burnt ginkgo
#

Hi guys now if we are creating a virtual env for a system , it would be conda create -n env python 3.8

#

This would available in the whole system right?

#

Now what if I want a virtual env in directory how do I that?

#

I have used the --prefix method , but each time I want to activate it wants me to put the path

#

Is there any way to replace that path with the env name?

heavy knot
#

don't spam every channel...

#

(this is the right one though, not the others)

solid widget
#

is there a way in python where when running a script it prints out whether the machine it's running on is a phone, PC, tablet or some other type of device?

distant raven
#

Is there a way to declare the build dependencies and dependencies to be installed locally for development purposes in the same place?
Right now I’m using setuptools in a venv and if I want my IDE to recognize the dependencies I have to install them with pip, which I’d do with a requirements.txt.
But if I do that I have to list the dependencies in two places (pyproject.toml and requirements.txt). Is there another way?

distant raven
#

if anybody wants to suggest conda I don’t want to use conda

astral apex
# distant raven Is there a way to declare the build dependencies and dependencies to be installe...

If you have dependencies required for build, they should go inside the requires in the [build-system].
Then they’ll automatically get installed when building your package.

A somewhat common way to add dev dependencies is to add them as optional dependencies
For example — https://github.com/letsbuilda/imsosorry/blob/main/pyproject.toml#L19-L25>
Then you install them with pip install -e .[dev]

One thing to keep in mind is that if you publish your package to PyPI that dev extra will be included, but it’s only installed if people explicitly ask for it, so it doesn’t affect anything.

rancid schoonerBOT
#

pyproject.toml lines 19 to 25

[project.optional-dependencies]
dev = [
    "pip-tools",
    "pre-commit",
    "ruff",
    "mypy",
]```
distant raven
astral apex
#

You can install more than one at a time too, for example I put my docs building dependencies in a different group, so I would use pip install .[dev,docs]

distant raven
#

Can I install the runtime dependencies without building the package? I just need them so mypy etc. can find them while I code.

astral apex
#

That’s not really a thing currently

#

Some people are arguing for it

#

Most people say there’s no reason to not just let your project be installed too

#

You need your project to be available for mypy too

#

You can kinda hack it with Hatch if you really want it

distant raven
#

Why do I need my project to be installed in the venv for mypy to work?

#

It has worked fine before (but I didn't package anything then)

rapid sparrow
heavy knot
#

can't poetry do that?

thorny shell
#

poetry doesn't require the dependencies to be in two places -- they're just in pyproject.toml (well OK they're also in poetry.lock, but that's autogenerated)

heavy knot
alpine horizon
#

where should I store Python CI scripts that are called from a GH workflow?

astral apex
distant raven
#

I am considering Hatch

#

does anybody have experience with it and would like to en- or discourage that choice?

gentle solstice
#

hatch is a fine choice.

#

It's great if you're looking for a modern alternative to setuptools

#

among other features

heavy knot
#

i have a new error this week! i have no idea what to do

#

here are my settings if that helps

vernal mirage
#

We have Jenkins CI running various pipeline via Docker images. These pipelines require numerous and sometimes conflicting Python packages from public and private repos. There's a recent push to solely install these requirements at runtime, but previously we were just baking them into the image at build time. What would be best practice here?

  • IMO more time on build vs. run always makes sense and there's increased reliability since sometimes access to these repos can be flaky. There are different opinions in the org that images should be as small as possible which would remove the baking of these packages in.
  • Additionally, we're looking to utilise a shared cache for these Python packages across pipelines. Our first iteration of this just uses a pip install --dry-run to warm the cache, but since we have some conflicting requirements we need a better way to do this. My first thought was to set up a local pypi server within the image for pip to install from. Is this a common usecase? Can you see this working?
rapid sparrow
# vernal mirage We have Jenkins CI running various pipeline via Docker images. These pipelines r...

We have Jenkins CI running various pipeline via Docker images. These pipelines require numerous and sometimes conflicting Python packages from public and private repos. There's a recent push to solely install these requirements at runtime, but previously we were just baking them into the image at build time. What would be best practice here?

The whole point of Docker images is creating frozen artifacts u can build once, test, check in stagng and be sure it will be the same running in prod now and at multiple servers and in few months.
So when u build new image and deploy it, and u screwed it up, u could rollback to previous docker image that was built before and everything will be okay (so u could relax and fix bugs for new version at your own temp, instead of rushing to fix prod bugs forward only right away at evenings)

#

You forfeitted THE Biggest point of Containerization.

#

TLDR: u are supposed to bake all dependencies on build

vernal mirage
#

Well said, that makes things a lot clearer. I think this is known but the reason it’s being suggested is because of a high frequency of these requirements changing combined with a long build time for our C software (which is also baked into the image).

rapid sparrow
rapid sparrow
# vernal mirage Well said, that makes things a lot clearer. I think this is known but the reason...

We speed up all our CI by reusing already built Docker image layer where they are already installed.
Our CI pipelines only write layers with code usuaally, and Heavy dependencies are all the time reused by pulling already built version from docker registry. We achieved it with this algo (Multi stage building pretty much, where first build stage has calculated hash based on used dependencies in Pipfile.lock, and pulled in every CI if exists first, and if it does not exist for this Pipfile.lock only then it is built and saved again to remote docker registry for reusage across all CI)

our CI in a nutshell:

  1. Calculate md5 hash from dependencies file lock onto libraries. Whatever your language is. Lets call the value as builder_base_hash (we do it by python in Github Actions run 😉 )
  2. Pull image image {{ builder_base_hash }} if it exists in docker registry, if not then build up to stage --builder. Save result to docker registry under tag {{ builder_base_hash }}
    (Thus we implemented speed up twice for CI), as we are were able to cache half of longest CI in a way that its CI jobs can run at different runners, as we use remote for persistence
  3. run full building of an image, til the code capable to run unit tests and push to docker registry under tag build_${{ github.run_id }}
  4. at unit test stage: pull the image build_${{ github.run_id }} and run unit tests and other tests
  5. if it passed them, than save the image as service_name_{{ github.run_number }} as fit for deployment 🙂, also mark it as latest and etc whatever tags u need
#

So we used approach to cache building docker image stage through Docker Registry.

#

feels like i should write article about it đŸ€”

vernal mirage
#

That’s a very interesting approach. Using that approach, you’re, in a sense, splitting the requirement on that CI image being rebuilt into multiple parts. I can see that improving CI times quite a bit depending on where those “split” stages are defined. Presumably the effectiveness would be maximised at points of low dependency from one stage to the next.

Alternatively would a shared cache not offer the same benefit as your dependencies-are-installed image would?

rapid sparrow
# vernal mirage That’s a very interesting approach. Using that approach, you’re, in a sense, spl...

Alternatively would a shared cache not offer the same benefit as your dependencies-are-installed image would?
sharing cache could but it is bothersome to setup working reliably and very CI provider depended. And Also default shared cache is not having ability to propagate for reusage across multiple CI runners.
Our solution is pretty much CI agnostic, will work the same at any CI tool. And works great for our autoscaled self hosted github runners

#

last time i tried using cache in Gitlab CI at least, it worked very unreliably, and the problems of cache persisting on same host only is an issue too, nullifying the benefits of caching

#

may be today it is different and shared cache became useful normally, at some of CI providers

vernal mirage
#

The caching I’m thinking of is more language-specific rather than some OOTB CI-provided tool e.g. ccache, pip cache, Python build cache. But I can see the value in rolling your own in the way you’ve described. Thanks for sharing.

I’ll definitely be more forward about the potential value being lost if we were to go forward with runtime installs.

heavy knot
#

wait can daphne run in venv?
I am in the project
I login into the server
i cd tsupdate
cd thought_sync_django-channnels
pipenv shell
and then i am in the project
would the directory be:
ec2-user@ip-172-31-19-47 thought_sync_django-channels
or ec2/tsupdate/thought_sync_django-channels?

placid nacelle
distant raven
alpine horizon
heavy knot
#

how do i sudo yum install django, do i need epel? how do i install epel?

hollow storm
heavy knot
hollow storm
#

if you have python+pip installed already, you could just install it with pip, e.g. pip install django outside a venv (or do it inside a venv and source it before starting ur server)

heavy knot
radiant pollen
heavy knot
#

then why can i not reach my server?

hollow storm
#

im not very familiar with django but i think you should have a file called manage.py in your project

#

once you find it, try running python manage.py runserver

hollow storm
#

okay that's an improvement

#

my bet is that your instance doesn't have the right firewall port open

#

if you open another terminal on the same instance (or connect via ssh), can you run curl localhost:8000?

topaz idol
#

Hello

#

I am a freelancer.

hollow storm
#

if it works, problem is most likely firewall and you'll have to open the port

topaz idol
#

Help in solving error in python

hollow storm
#

hi dangi, welcome to the server. as a friendly note, remember that asking for (or offering) paid work in this discord is against the rules

patent raven
heavy knot
hollow storm
#

run it as i wrote it

heavy knot
hollow storm
# heavy knot same error

did you close this process to run the command? you need 2 terminals open, one with the process and another one running curl

heavy knot
hollow storm
#

well you either open two tabs or connect with ssh instead of the web interface

heavy knot
#

um

#

how do i share a message over 2000 words?

hollow storm
#

i think discord can convert it to a file when you paste it

#

otherwise pastebin or something like that

heavy knot
#

got it

#

here you go

#

um why is the error in html?

hollow storm
#

as a general comment, you should think about what you're trying to do and how the system works before doing anything. us feeding you commands and you copy pasting is not going to translate to any useful skill if you dont understand why each step is necessary

hollow storm
#

this means that the django service is running properly and you can reach it locally. now it's a matter of being able to reach it from the outside

heavy knot
hollow storm
#

outside meaning from your computer, or anyone's computer

heavy knot
hollow storm
#

why can you access it locally but not remotely?

heavy knot
hollow storm
#

sure, guessing is fine

heavy knot
#

i think it is because it works locally but something is wrong with the AWS settings

hollow storm
#

science is basically coming up with a theory and then giving it a try

heavy knot
#

i do know however it works locally and not in AWS so that is a start

heavy knot
hollow storm
#

your EC2 instance in amazon is in it's own network. AWS calls this VPC, and restricts their inputs/outputs

#

this is done with something called security groups, which are basically a firewall. my theory is that your instance's firewall doesn't have the right input port open (8000)

heavy knot
#

are my security groups set up correctly?

hollow storm
#

second to last group seems correct to me. is this security group applying to your instance?

heavy knot
#

outbound is "all"

hollow storm
#

can you show me the network tab of the instance? i dont remember the exact name of the tab, but it's on ec2 -> instances -> your instance

hollow storm
#

i cant see whether the security group is applying to the instance here

heavy knot
hollow storm
#

firewall seems fine

#

new theory: django doesn't bind to external ip by default

#

should be easy to test. run it with python manage.py runserver 0:8000 instead

#

im not sure if this has security implications, for the final setup it might be better to setup a reverse proxy instead

heavy knot
#

still nothing

smoky pivot
#

👋 Hey all, would anyone be able to help setting up traefik on kube? I've been stuck on it for the past 4 hours and I desperatly need help. I can't for the life of me get the traefik dashboard working with HTTPS. I always get errors with ingressRoutes or something else which is extremely frustrating 😩

rapid sparrow
#

đŸ„Č

#

i am a person configuring similar stuff

smoky pivot
#

Have fun đŸ€Ł 😭

rapid sparrow
#

i would say, tough up and debug step by step where it is working

#

i enjoy using kind instrument for local debugging

smoky pivot
#

That's what I've been doing for the past day...

rapid sparrow
#

and k9s to navigate rapidly over kubernetes things and seek the clues

smoky pivot
#

Yeah I already am using k9s it's awesome

rapid sparrow
#

obviously though ingress will not work in kind unless u apply metallb btw

smoky pivot
#

error: resource mapping not found for name: "traefik-dashboard" namespace: "default" from "ingressroute.yaml": no matches for kind "IngressRoute" in version "traefik.containo.us/v1alpha1" -> Which leads me to try and define IngressRoute but then other errors ensue ...

rapid sparrow
#

dev env for kubernetes requires too many things, i just use kind in terraform-opentofu locally 😋
That helps me locally to go through all issues before i try to intergrate it working in our staging (and facing new arrays of problems)

smoky pivot
#

And when I try to do another type of ingress for the traefik dashboard it just doesn't work...

rapid sparrow
#

resolving those issues can indeed take a whole 4h or smth

#

it is just literally beyond the... limits of this channel 😅

#

we try to help in a reasonable some time

#

but debugging such issues can indeed take 4 hours and more đŸ„Č

smoky pivot
#

Yeah I know, that's what I've been stuck on since this morning đŸ„č

heavy knot
rapid sparrow
heavy knot
rapid sparrow
#
  1. check that u binded Django server to 0.0.0.0 for public exposure
rapid sparrow
#
  1. check that your EC2 security stuff configurations allow traffic from IPs to ports u wish
#
  1. check that your EC2 is even having public IP
heavy knot
rapid sparrow
#
  1. check any other custom networking that u touched for it
heavy knot
heavy knot
heavy knot
rapid sparrow
# heavy knot what is biniding, is that not security groups?

gunicorn your_app.smth -p 0.0.0.0 (rough example, or python3 manage.py runserver -p 0.0.0.0)
smth like that stuff exists, if you bind your web python server to 127.0.0.1, it will be acessable locally only
if using 0.0.0.0, it will be exposed beyond host network to all attached networks to the host

rapid sparrow
#

that is a rough example

#

u are supposed to fix it where u launch your app inside host

#

to check to which port u binded

#

ergh... u can actually validate it by googling to which port/ip my app is binded and making scan over your host if desired (through the found commands)

heavy knot
rapid sparrow
#

so your are good at this department

#

also it listens to all ipv6 too (potential screw ups to be prepared, there are always some kind of screw ups with ipv6 😅 )

heavy knot
#

new error lets go!

rapid sparrow
#

login as sudo if u wish binding to 80

#

sudo -s

heavy knot
rapid sparrow
#

or run your app as path_to_venv/bin/python3 manage.py runserver (if wishing running with venv without its activation)

rapid sparrow
#

u made mistakes both times in missing parts

heavy knot
rapid sparrow
# heavy knot what did i miss?

u haven't wrote source the first time
and u wrote python with space in the beginning the command to be path_to_venv/bin/ python instead of requested path_to_venv/bin/python3

#

are you able to read english directly hmm? đŸ€”

rapid sparrow
#

i have to go now, gl

heavy knot
#

is it activated?

heavy knot
#

now my terminal is broken

#

anyone out there?

heavy knot
#

what is my endpoint ID?

smoky pivot
muted iron
#

Hey if I want to get going with spark, should I deploy all the spark, kafka, zookeeper etc in docker images? Someone once told me to always do kafka in docker never local, is it the same for others as well?
even the database?

heavy knot
#

why does epel-release not install normally?

(thought_sync_django-channels) [ec2-user@ip-172-31-19-47 thought_sync_django-channels]$ sudo yum install epel-release
Last metadata expiration check: 1 day, 2:29:14 ago on Tue Aug  6 17:53:05 2024.
Error: 
 Problem: conflicting requests
  - nothing provides redhat-release >= 7 needed by epel-release-7-14.noarch from epel
(try to add '--skip-broken' to skip uninstallable packages)
(thought_sync_django-channels) [ec2-user@ip-172-31-19-47 thought_sync_django-channels]$ sudo dnf install epel-release
Last metadata expiration check: 1 day, 2:32:09 ago on Tue Aug  6 17:53:05 2024.
Error: 
 Problem: conflicting requests
  - nothing provides redhat-release >= 7 needed by epel-release-7-14.noarch from epel
(try to add '--skip-broken' to skip uninstallable packages)
(thought_sync_django-channels) [ec2-user@ip-172-31-19-47 thought_sync_django-channels]$ 
hollow storm
#

i think it's because you are in centos7

#

and its EOL

heavy knot
gentle solstice
#

You broke your repos

heavy knot
# gentle solstice You broke your repos

how do i fix them?

(thought_sync_django-channels) [ec2-user@ip-172-31-19-47 thought_sync_django-channels]$ sudo yum install epel-release-7-14.noarch
Last metadata expiration check: 1 day, 9:36:12 ago on Tue Aug  6 17:53:05 2024.
Error: 
 Problem: conflicting requests
  - nothing provides redhat-release >= 7 needed by epel-release-7-14.noarch from epel
(try to add '--skip-broken' to skip uninstallable packages)
(thought_sync_django-channels) [ec2-user@ip-172-31-19-47 thought_sync_django-channels]$ sudo dnf install epel-release-7-14.noarch
Last metadata expiration check: 1 day, 9:36:20 ago on Tue Aug  6 17:53:05 2024.
Error: 
 Problem: conflicting requests
  - nothing provides redhat-release >= 7 needed by epel-release-7-14.noarch from epel
(try to add '--skip-broken' to skip uninstallable packages)
(thought_sync_django-channels) [ec2-user@ip-172-31-19-47 thought_sync_django-channels]$ python install epel-release-7-14.noarch
python: can't open file '/home/ec2-user/tsupdate/thought_sync_django-channels/install': [Errno 2] No such file or directory
(thought_sync_django-channels) [ec2-user@ip-172-31-19-47 thought_sync_django-channels]$ python3 install epel-release-7-14.noarch
python3: can't open file '/home/ec2-user/tsupdate/thought_sync_django-channels/install': [Errno 2] No such file or directory
(thought_sync_django-channels) [ec2-user@ip-172-31-19-47 thought_sync_django-channels]$ 
gentle solstice
#

Repos are configured in /etc/yum.repos.d

heavy knot
gentle solstice
#

You are on amazonlinux. No epel for you

heavy knot
gentle solstice
#

Django isn't installed

#

Use a venv

heavy knot
gentle solstice
#

You didn't activate your venv after becoming root

heavy knot
gentle solstice
#

Do it after sudo

#

sudo -s ignores changes to your path

heavy knot
gentle solstice
#

It means pipenv isn't installed for root.

#

Install it globally

heavy knot
#

so cd out of the root?

heavy knot
gentle solstice
#

Stop installing epel

heavy knot
#

what security group am i missing?

#

i thought i opened port 80?

gentle solstice
#

You should provision a new vm

woven phoenix
#

Hey, where should i ask questions regarding Big data like Apache Hadoop or Spark?

heavy knot
gentle solstice
#

it needs to be put out of its misery

heavy knot
gentle solstice
#

delete it

heavy knot
gentle solstice
#

two in the heart, one in the head

heavy knot
gentle solstice
#

do you know the difference between a vm and venv?

heavy knot
#

how do i kill a vm then? i am on a vm? is that not the instance? you mean terminat the instance i make a new instance?

gentle solstice
#

do it in the ec2 console

heavy knot
gentle solstice
#

That's the security groups

#

You want instances

heavy knot
gentle solstice
#

state is for shutdown/startup

#

go ahead and terminate it

heavy knot
#

now is there a specific type of instance i should make?

#

like know that i know more is amazon linux the best option?

gentle solstice
#

just stick to amazonlinux

heavy knot
gentle solstice
#

Using aws dns needs to use port 80

#

Try using the ip

heavy knot
gentle solstice
#

connect to the ip:port

heavy knot
gentle solstice
#

in your web browser

heavy knot
#

wait we should set up elastic ip first!

#

ok till not working

heavy knot
#

it working

#

now we have to get daphne and redis working

#

daphne is up

#

redis is not working

bitter prairie
#

What's the difference between the cloud and the arrows in VS Code? I pushed both branches, and I can see both of them in my GitHub account. When I pushed the master branch I used the -u command (git push -u origin master), and when I pushed ap, I didn't use it.

As I understand, -u makes git remember the branch as the default branch to push future commits to. I didn't want to make ap the default branch, so I didn't use -u.

#

By the way, when I created my first repository through VS Code's GUI, it called the main branch main, and when I used git init in a different repository (the one in the screenshots), it called it master đŸ€”

thorny shell
#

yeah, some code that uses git has changed the name of the default branch from "main" to "master". There's nothing significant about that; it's just a convention

gentle solstice
gentle solstice
stable hearth
#

is there a way to hide config file which includes my API key ( i didnt push the files in yet) in my repository on github? i heard about gitignore but idk how to implement it

bitter prairie
inner pollen
stable hearth
#

Aight

subtle quarry
#

If you want to have that in GitHub or similar there are options to store keys secure in secrets or something like that can't remember exactly the name now. By doing that. These keys are then available to GitHub actions.

dim eagle
#

I wanted help making a dependabot.yml file that would update workflows and also make a pull request when packages need to be updated

where would be ask to this?

#

packages should be specifically pull requested
workflows can be automatically updated

#
version: 2
updates:
  - package-ecosystem: "devcontainers"
    directory: "/"
    schedule:
      interval: "monthly"

  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "monthly"
    groups:
      ci-dependencies:
        patterns:
          - "*"

  - package-ecosystem: "pip"
    directory: "/"
    schedule:
      interval: "monthly"
    groups:
      python-dependencies:
        patterns:
          - "*"

I have this rn but I want it to make a pull request for package updates.
But I want it to update when a workflow is changed

#

The reason why I want dependabot to automatically update workflows is because it's harder for me to update them but package updates is something I myself can do so I tend to do it myself

bitter prairie
#

some people recommend changing the default terminal in VS Code to git bash. why? how is it better than powershell?

astral apex
brazen forge
dim eagle
brazen forge
#

okay
what's automatic in that?
also, isn't that the same Dependabot config you already shared?

alpine horizon
#

how do I trigger a GH actions, on a cronjob or if the commit message contains some word?
I found this to accomplish the latter, but how can I integrate it with my cronjob?

rapid sparrow
#

one that is working on commit, and uses this if condition

#

and second one working on cronjob

#

they both can be reusing same shared workflow code

#
jobs:
  check-translation-fuzzy:
    name: Prevent fuzzy translation
    uses: Orgname/actions/.github/workflows/check-fuzzy.yml@master

as example

#

the reusable workflow will need to have permission being called on workflow_call

name: Checks .po files for fuzzy translations

on:
  workflow_call: {}

jobs:
  lint:
    name: Prevent fuzzy translation
    runs-on: ubuntu-latest
    steps:
      - name: Check out source repository
        uses: actions/checkout@v2
      - uses: Orgname/actions/locales-check-fuzzy/@v4
alpine horizon
#

didnt think about that solution

#

are there any alternatives tho?

rapid sparrow
#

u can do it with a single workflow file

#

if u change your regarding if: "!contains(github.event.head_commit.message, 'build')"
Replace it with stuff like

on:
  release:
    types: [published]

or

on:
  release:
    types: [created]
#

GH has special trigger to run on Github Releases created

#

probably on tag creation exists too

rapid sparrow
#

Then u will be able to merge your conditions into a single workflow file

#
on:
  schedule: your cron schedule
  release:
    types: [published]
alpine horizon
#

I need smth like

on:
  schedule:
    - cron: '0 7 * * *'
  push:
    branches:
      - master

jobs:
  build:
    if: "!contains(github.event.head_commit.message, 'abcd') or is_cronjob(...)"
rapid sparrow
#

use alternative optional triggers

#

through on Git Tags or on Github Release creation instead

#
on:
  push:
    tags:
      - v1.**

Git tags are git native solution that u can create with git alones

alpine horizon
#

oh so smth like on: push: tags: - "trigger actions"

rapid sparrow
#

Alternatively if your optional trigger stuff is not tied to product releases at all... then just use workflow_call, for human allowed CI trigger from GUI (probably usable from gh cli too)

alpine horizon
alpine horizon
#

with git filter-repo, after I run the command to rewrite the history, how do I publish to the remote? (git status says there are no changes )

rapid sparrow
alpine horizon
rapid sparrow
#

git remote add origin git@github.com:browserpass/browserpass-extension.git for example

#

u can clarify what u have set with git remote -v

#

once u configured remote origin, then u can normally use git push (the first one will be with extra flag potentially though)

alpine horizon
rapid sparrow
#

this will overwrite history of remote

#

with also setting remote as its remote target

#

be careful in its usage)

alpine horizon
#

thanks so much it worked

rapid sparrow
#

after u do it once, next time it will be just git push

alpine horizon
#

now I just gotta hope I didnt mess anything up

rapid sparrow
alpine horizon
versed apex
#

Please tell me about your favorite plugins you use in pycharm, I want to customize my workflow

daring ore
#

I'm trying to learn AWS features in prep for an interview, but I don't know how to create a database without costing me. It says it's in free tier, but both options for configuring Dynamo and RDS are saying they'll cost me. Any help?

thorny shell
#

dynamo is so cheap that I wouldn't worry about it.

#

RDS is a whole different story -- I considered using it for a toy project, and the cheapest I could find was I think $70/month

brazen forge
#

!rule ad

rancid schoonerBOT
#

6. Do not post unapproved advertising.

heavy knot
#

I am setting up elastic cache to use redis service, any recommendations on how to change the settings?

rapid sparrow
haughty burrow
#

Hi all, I put together a dead simple pulumi (python flavor) gist to configure daemon sets to multiplex GPUs by configuring the nvidia-device-plugin: https://gist.github.com/MMMarcy/8f8bc3f660e01eb46cf28c654d373a62 .
It's helping me to run several small LLMs and embedding models on the same GPU from my minikube instance. Not sure this is the correct space, but hopefully it's useful for someone messing around with LLMs/K8s like I am doing

Gist

configure nvidia-device-plugin in K8s using pulumi - example.py

heavy knot
pseudo cipher
heavy knot
pseudo cipher
heavy knot
pseudo cipher
#

@heavy knot So, you have Django inside an EC2 instance?

pseudo cipher
# heavy knot yes

If the Redis service is strictly for Django, I would run as a service in your EC2 instance. Then the site can talk to it using localhost. I am not sure how the cost would compare. I would think just a service on the EC2 instance would be less expensive than the Redis service offering. Have you considered that as an option? https://serverfault.com/questions/1127483/how-to-install-and-configure-redis-server-on-amazon-linux-2023-al2023

heavy knot
pseudo cipher
# heavy knot the whole point of getting redis service to work is so that the websocket works ...

You would need to edit the redis config after installation. You could set permissions and access rules in it. Once you have that defined, you can use whatever tool you want to verify that the endpoint is reachable. https://stackoverflow.com/questions/19091087/open-redis-port-for-remote-connections

pseudo cipher
heavy knot
pseudo cipher
heavy knot
pseudo cipher
heavy knot
pseudo cipher
pseudo cipher
heavy knot
pseudo cipher
pseudo cipher
#

So, /usr/bin/redis-server /path/to/config.file, something like that.

heavy knot
# pseudo cipher

darn, what did i do wrong with my settings?

#Redis will listen on this port
port 6379

#Bind to all network interfaces. For better security, consider binding to specific interfaces.
bind 0.0.0.0

#Enable or disable TCP keepalive
tcp-keepalive 300

# Number of databases. By default, Redis has 16 databases.
databases 16

# Maximum memory usage. Redis will start evicting keys if this limit is reached.
# Uncomment and set the value to a specific amount of memory.
# maxmemory 2gb
#
# Eviction policy when memory limit is reached. Options: noeviction, allkeys-lru, volatile-lru, allkeys-random, volatile-random, volatile-ttl
# Uncomment and set the value as needed.
# maxmemory-policy noeviction

# Save the database on disk every 900 seconds if at least 1 key changed
save 900 1

# Save the database on disk every 300 seconds if at least 10 keys changed
save 300 10

# Save the database on disk every 60 seconds if at least 10000 keys changed
save 60 10000

# Append only file (AOF) configuration
# Enable AOF persistence (recommended for durability)
appendonly yes
# AOF rewrite policy, options: always, everysec
appendfsync everysec

# Set the name of the AOF file
appendfilename "appendonly.aof"

# Enable Redis to write a disk snapshot every time it is saved
rdbcompression yes

# Enable Redis to use rdb files for persistence
rdbchecksum yes

# Log level: debug, verbose, notice, warning
loglevel notice

# Path to the log file
logfile "/var/log/redis/redis-server.log"

# Daemonize the Redis server (run in the background)
daemonize yes

# Set the Redis server PID file
pidfile /var/run/redis/redis-server.pid

# Security configurations
# Require clients to authenticate with a password (uncomment to enable)
# requirepass yourpassword

# Use a Unix socket for local connections (optional, enable if needed)
# unixsocket /var/run/redis/redis.sock
# unixsocketperm 700

# Enable protected mode (recommended for security)
protected-mode yes

# Disable commands that could be harmful if exposed to the public
# Uncomment the following to disable dangerous commands
# rename-command CONFIG ""
# rename-command SHUTDOWN ""
# rename-command FLUSHDB ""
# rename-command FLUSHALL ""

# Specify the server's time zone (optional)
# time-zone "UTC"

# Include additional configuration files (optional)
# include /etc/redis/redis-user.conf

# Path to the Redis server binaries
/usr/bin/redis-server /path/to/config.file
./redis-server /path/to/redis.conf
pseudo cipher
pseudo cipher
heavy knot
heavy knot
pseudo cipher
heavy knot
astral apex
#

Sudo changes the currently logged in account from your user to the root account, and then executes the command you gave it

#

If the redis user doesn't exist, you will need to create it

#

I'm surprised the installation didn't create it, which makes me wonder if it was installed correctly

pseudo cipher
pseudo cipher
pseudo cipher
# heavy knot survey says: "no". hmmm what user besides sudo would there be?

Command to view contents of file is sudo cat /usr/lib/systemd/system/redis.service

Contents will look something like this, showing the user. You can view users on the system with sudo cat /etc/shadow This gives info on adding a user. https://www.geeksforgeeks.org/useradd-command-in-linux-with-examples/

heavy knot
pseudo cipher
pseudo cipher
heavy knot
pseudo cipher
heavy knot
#

my user is redis?

#

should i change that?

pseudo cipher
# heavy knot

Try editing that file and change it to redis6, then run sudo systemctl daemon-reload , then restart the service again.

pseudo cipher
# heavy knot

Edit with sudo nano /etc/systemd/system/redis.service or whatever text editor you like to use.

heavy knot
#

is there something else wrong with my settings

pseudo cipher
heavy knot
pseudo cipher
heavy knot
#

why can i not exit?

#

i sudo nano in?

pseudo cipher
# heavy knot

Your service file /etc/systemd/system/redis.service is pointed at /etc/redis/redis.conf, but your config is /etc/redis6/redis6.conf. You could copy the file or update the service, I think I would update the service definition. It seems the installer package had some settings from redis6 and some from a previous version??

pseudo cipher
pseudo cipher
#

sudo systemctl stop redis && sudo sytemctl disable redis

#

sudo systemctl enable --now redis6 && sudo systemctl status redis6

heavy knot
#

we have green?

pseudo cipher
# heavy knot we have green?

Maybe there was a different version installed by default. not sure, but it looks like you have two versions installed, but that's fine, the other one is disabled now.

heavy knot
heavy knot
#

if this does not work back to the chair (coding) for me

heavy knot
#

what should be my daphne settings, my websocket is not connecting?

#

we need to connect websocket

pseudo cipher
heavy knot
#

wait

#

let me run daphne

#

oh no

#

i get an html error

#

lmk get a paste bin

pseudo cipher
heavy knot
heavy knot
#

the error is large

#

i could not fit it all on in the paste bin

#

but you get the idea

#

html stuff for daphne?

#

nani?

pseudo cipher
heavy knot
#

the portal to hell closed itself?

pseudo cipher
heavy knot
#

if it would work this would say "Connected"

pseudo cipher
pseudo cipher
# heavy knot

I got you, so we are getting ahead of ourselves. Is the app configured to only respond to certain requests? I mean if you were on the computer that is running the app, should you be able to load the web page? I am trying to make sure it loads locally before I connect over a public IP.

heavy knot
pseudo cipher
heavy knot
pseudo cipher
heavy knot
pseudo cipher
pseudo cipher
pseudo cipher
pseudo cipher
pseudo cipher
heavy knot
pseudo cipher
# heavy knot

That should add port 8001 to firewall exceptions. I believe you are running on port 8001 so you should be trying to connect on http://127.0.0.1:8001 with lynx, not 8000.

heavy knot
#

? am I snytaxing wrong

pseudo cipher
pseudo cipher
#

Have you registered that domain name?

#

Did you add an allow rule to your security group in AWS?

#

If you know where you are connecting from, you can add an exclusion just for your IP, so you don't open to the whole world.

#

If you add the security group exception, the next test would be attempting to connect via https://3.217.114.187:8001/auth or whatever page for the last part.

#

If that works, then you can check if your domain name is correct by doing a lookup of the IP for harmonyapp.org

#

The domain does look correct.

heavy knot
craggy mesa
#

Hey peeps, sharing with you my Pixi, Flask, Jupyter, and Docker template for your new project https://github.com/mshaaban0/pixi-docker-template.git
(should get you started with one command if you have docker installed) hope it helps someone đŸȘ“

GitHub

A Python project boilerplate template for new projects with Pixi, Flask, Jupyter Notebook and Docker Compose. - GitHub - mshaaban0/pixi-docker-template: A Python project boilerplate template for n...

pseudo cipher
pseudo cipher
# heavy knot

There should be a spot in the console where you can make exceptions for inbound traffic. It should look something like this.

pseudo cipher
# heavy knot what should the source be?

Well, you could set it to 0.0.0.0. That will let the world access that port, or for testing, it's often better to narrow that so you don't get many unwelcome visitors. You can usually determine the IP you use on the public internet by visiting https://ipchicken.com and refreshing it a few times to see if your IP is fairly predictable.

pseudo cipher
# heavy knot what should the source be?

Also, I'm pretty sure you are hosting on port 8001. If you are unsure, you can also enter a port range. You use the hyphen to denote a range like this. Eventually, you will want to configure SSL and possibly limit to relevant IP ranges, as well as monitor for any security vulnerabilities in Daphne/Django, etc.

heavy knot
pseudo cipher
pseudo cipher
heavy knot
#

wait does "active running" mean i should run a command like daphne?

#

or maybe it is not the problem

heavy knot
pseudo cipher
heavy knot
pseudo cipher
heavy knot
pseudo cipher
# heavy knot like this?

Yep, that should definitely open it up. Run the daphne command that starts the service. daphne -b 0.0.0.0 -p 8001 whatever

pseudo cipher
pseudo cipher
# heavy knot like this?

You are going to want to restrict that soon. People are going to start trying to hack at it before too long if you leave that open like that.

heavy knot
pseudo cipher
# heavy knot but somehow the websocket does not work?

Is the websocket an internal connection? Is the app supposed to connect to a service running on the same server? Should it be pointed at localhost? Maybe the API doesn't need to be exposed? It depends on how the application is architected. Also, what is the UI you are using to test? Is that Postman? I am not that familiar with Postman.

heavy knot
pseudo cipher
pseudo cipher
pseudo cipher
pseudo cipher
pseudo cipher
heavy knot
# pseudo cipher It looks like you need to configure a secure connection if you want to use Webso...

new information: www.google or https.google ar enot websockets. websockets are essentialy connections that need to be made betwene users witihn the app using their user ids: their format is:
ws://IPorDOMAIN:PORT/ws/home/94be4db4-c018-43e7-9c44-c0bb8854129d/

therefore they should look like:
ws://3.217.114.187:8001/ws/home/94be4db4-c018-43e7-9c44-c0bb8854129d/

or

ws://harmonyapp.org:8001/ws/home/94be4db4-c018-43e7-9c44-c0bb8854129d/

pseudo cipher
heavy knot
heavy knot
#

how do i make nginx publicly accessible?

olive cipher
#

Any apps, programs or scripts that can export a USDX format txt file to a midi or kar file?
https://youtu.be/RsPDDozg_PA?si=B4glvmjzgj7Ut49J

"I think it would be fairly easy for someone to make it. "
Says someone who only knows html, php

Any apps, programs or scripts that can export a USDX format txt file to a midi or kar file?
USDX - UltraStar Deluxe
USDX, My Little Karaoke, Performous, Vocaluxe
Might be a more universal name for the format.
Many goes from midi to the proper format but not the other way.
Part of txt file..

#COVER:cover.jpg
#BPM:320
#GAP:35200
F 0 0 0
F 8 6 6...

▶ Play video
gentle solstice
#

and port 443 if you use https

heavy knot