arpakitlib 1.5.19__py3-none-any.whl → 1.5.21__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of arpakitlib might be problematic. Click here for more details.
- arpakitlib/ar_datetime_util.py +1 -1
- arpakitlib/{ar_sqlalchemy_util.py → ar_easy_sqlalchemy_util.py} +8 -39
- arpakitlib/ar_sqlalchemy_model_util.py +42 -0
- arpakitlib-1.5.21.dist-info/METADATA +84 -0
- {arpakitlib-1.5.19.dist-info → arpakitlib-1.5.21.dist-info}/RECORD +8 -7
- arpakitlib-1.5.19.dist-info/METADATA +0 -365
- {arpakitlib-1.5.19.dist-info → arpakitlib-1.5.21.dist-info}/LICENSE +0 -0
- {arpakitlib-1.5.19.dist-info → arpakitlib-1.5.21.dist-info}/NOTICE +0 -0
- {arpakitlib-1.5.19.dist-info → arpakitlib-1.5.21.dist-info}/WHEEL +0 -0
arpakitlib/ar_datetime_util.py
CHANGED
|
@@ -1,49 +1,15 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from datetime import timedelta
|
|
2
|
+
from datetime import timedelta
|
|
3
3
|
from typing import Any
|
|
4
4
|
from uuid import uuid4
|
|
5
5
|
|
|
6
|
-
from sqlalchemy import create_engine, QueuePool, text, func
|
|
7
|
-
from sqlalchemy.orm import sessionmaker
|
|
6
|
+
from sqlalchemy import create_engine, QueuePool, text, func
|
|
7
|
+
from sqlalchemy.orm import sessionmaker
|
|
8
8
|
from sqlalchemy.orm.session import Session
|
|
9
9
|
|
|
10
|
-
from arpakitlib.ar_datetime_util import now_utc_dt
|
|
11
|
-
from arpakitlib.ar_json_util import safely_transfer_to_json_str
|
|
12
|
-
|
|
13
10
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
|
14
11
|
|
|
15
12
|
|
|
16
|
-
class BaseDBM(DeclarativeBase):
|
|
17
|
-
__abstract__ = True
|
|
18
|
-
_bus_data: dict[str, Any] | None = None
|
|
19
|
-
|
|
20
|
-
@property
|
|
21
|
-
def bus_data(self) -> dict[str, Any]:
|
|
22
|
-
if self._bus_data is None:
|
|
23
|
-
self._bus_data = {}
|
|
24
|
-
return self._bus_data
|
|
25
|
-
|
|
26
|
-
def simple_dict(self) -> dict[str, Any]:
|
|
27
|
-
return {c.key: getattr(self, c.key) for c in inspect(self).mapper.column_attrs}
|
|
28
|
-
|
|
29
|
-
def simple_json(self) -> str:
|
|
30
|
-
return safely_transfer_to_json_str(self.simple_dict())
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class SimpleDBM(BaseDBM):
|
|
34
|
-
__abstract__ = True
|
|
35
|
-
|
|
36
|
-
id: Mapped[int] = mapped_column(
|
|
37
|
-
INTEGER, primary_key=True, autoincrement=True, nullable=False
|
|
38
|
-
)
|
|
39
|
-
long_id: Mapped[str] = mapped_column(
|
|
40
|
-
TEXT, insert_default=uuid4, unique=True, nullable=False
|
|
41
|
-
)
|
|
42
|
-
creation_dt: Mapped[datetime] = mapped_column(
|
|
43
|
-
TIMESTAMP(timezone=True), insert_default=now_utc_dt, index=True, nullable=False
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
47
13
|
class EasySQLAlchemyDB:
|
|
48
14
|
def __init__(self, *, db_url: str, echo: bool = False):
|
|
49
15
|
self._logger = logging.getLogger(self.__class__.__name__)
|
|
@@ -73,14 +39,17 @@ class EasySQLAlchemyDB:
|
|
|
73
39
|
self._logger.info("celery tables data were removed")
|
|
74
40
|
|
|
75
41
|
def init(self):
|
|
42
|
+
from arpakitlib.ar_sqlalchemy_model_util import BaseDBM
|
|
76
43
|
BaseDBM.metadata.create_all(bind=self.engine, checkfirst=True)
|
|
77
44
|
self._logger.info("db was inited")
|
|
78
45
|
|
|
79
46
|
def drop(self):
|
|
47
|
+
from arpakitlib.ar_sqlalchemy_model_util import BaseDBM
|
|
80
48
|
BaseDBM.metadata.drop_all(bind=self.engine, checkfirst=True)
|
|
81
49
|
self._logger.info("db was dropped")
|
|
82
50
|
|
|
83
51
|
def reinit(self):
|
|
52
|
+
from arpakitlib.ar_sqlalchemy_model_util import BaseDBM
|
|
84
53
|
BaseDBM.metadata.drop_all(bind=self.engine, checkfirst=True)
|
|
85
54
|
BaseDBM.metadata.create_all(bind=self.engine, checkfirst=True)
|
|
86
55
|
self._logger.info("db was reinited")
|
|
@@ -101,14 +70,14 @@ class EasySQLAlchemyDB:
|
|
|
101
70
|
return False
|
|
102
71
|
return True
|
|
103
72
|
|
|
104
|
-
def generate_unique_id(self, *, class_dbm:
|
|
73
|
+
def generate_unique_id(self, *, class_dbm: Any):
|
|
105
74
|
with self.new_session() as session:
|
|
106
75
|
res: int = session.query(func.max(class_dbm.id)).scalar()
|
|
107
76
|
while session.query(class_dbm).filter(class_dbm.id == res).first() is not None:
|
|
108
77
|
res += 1
|
|
109
78
|
return res
|
|
110
79
|
|
|
111
|
-
def generate_unique_long_id(self, *, class_dbm:
|
|
80
|
+
def generate_unique_long_id(self, *, class_dbm: Any):
|
|
112
81
|
with self.new_session() as session:
|
|
113
82
|
res: str = str(uuid4())
|
|
114
83
|
while session.query(class_dbm).filter(class_dbm.long_id == res).first() is not None:
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Any
|
|
3
|
+
from uuid import uuid4
|
|
4
|
+
|
|
5
|
+
from sqlalchemy import inspect, INTEGER, TEXT, TIMESTAMP
|
|
6
|
+
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
|
7
|
+
|
|
8
|
+
from arpakitlib.ar_datetime_util import now_utc_dt
|
|
9
|
+
from arpakitlib.ar_json_util import safely_transfer_to_json_str
|
|
10
|
+
|
|
11
|
+
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class BaseDBM(DeclarativeBase):
|
|
15
|
+
__abstract__ = True
|
|
16
|
+
_bus_data: dict[str, Any] | None = None
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def bus_data(self) -> dict[str, Any]:
|
|
20
|
+
if self._bus_data is None:
|
|
21
|
+
self._bus_data = {}
|
|
22
|
+
return self._bus_data
|
|
23
|
+
|
|
24
|
+
def simple_dict(self) -> dict[str, Any]:
|
|
25
|
+
return {c.key: getattr(self, c.key) for c in inspect(self).mapper.column_attrs}
|
|
26
|
+
|
|
27
|
+
def simple_json(self) -> str:
|
|
28
|
+
return safely_transfer_to_json_str(self.simple_dict())
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class SimpleDBM(BaseDBM):
|
|
32
|
+
__abstract__ = True
|
|
33
|
+
|
|
34
|
+
id: Mapped[int] = mapped_column(
|
|
35
|
+
INTEGER, primary_key=True, autoincrement=True, nullable=False
|
|
36
|
+
)
|
|
37
|
+
long_id: Mapped[str] = mapped_column(
|
|
38
|
+
TEXT, insert_default=uuid4, unique=True, nullable=False
|
|
39
|
+
)
|
|
40
|
+
creation_dt: Mapped[datetime] = mapped_column(
|
|
41
|
+
TIMESTAMP(timezone=True), insert_default=now_utc_dt, index=True, nullable=False
|
|
42
|
+
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: arpakitlib
|
|
3
|
+
Version: 1.5.21
|
|
4
|
+
Summary: arpakitlib
|
|
5
|
+
Home-page: https://github.com/ARPAKIT-Company/arpakitlib
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Author: arpakit
|
|
8
|
+
Author-email: arpakit@gmail.com
|
|
9
|
+
Requires-Python: >=3.12,<4.0
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Dist: aiogram (>=3.15.0,<4.0.0)
|
|
15
|
+
Requires-Dist: aiohttp-socks (>=0.9.1,<0.10.0)
|
|
16
|
+
Requires-Dist: alembic (>=1.14.0,<2.0.0)
|
|
17
|
+
Requires-Dist: asyncpg (>=0.30.0,<0.31.0)
|
|
18
|
+
Requires-Dist: asyncssh (>=2.18.0,<3.0.0)
|
|
19
|
+
Requires-Dist: bs4 (>=0.0.2,<0.0.3)
|
|
20
|
+
Requires-Dist: cachetools (>=5.5.0,<6.0.0)
|
|
21
|
+
Requires-Dist: celery (>=5.4.0,<6.0.0)
|
|
22
|
+
Requires-Dist: cryptography (>=44.0.0,<45.0.0)
|
|
23
|
+
Requires-Dist: fastapi (>=0.115.5,<0.116.0)
|
|
24
|
+
Requires-Dist: gunicorn (>=23.0.0,<24.0.0)
|
|
25
|
+
Requires-Dist: openai (>=1.55.3,<2.0.0)
|
|
26
|
+
Requires-Dist: pandas (>=2.2.3,<3.0.0)
|
|
27
|
+
Requires-Dist: paramiko (>=3.5.0,<4.0.0)
|
|
28
|
+
Requires-Dist: psycopg-binary (>=3.2.3,<4.0.0)
|
|
29
|
+
Requires-Dist: psycopg2-binary (>=2.9.10,<3.0.0)
|
|
30
|
+
Requires-Dist: pydantic-settings (>=2.6.1,<3.0.0)
|
|
31
|
+
Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
|
|
32
|
+
Requires-Dist: pymongo (>=4.10.1,<5.0.0)
|
|
33
|
+
Requires-Dist: pytz (>=2024.2,<2025.0)
|
|
34
|
+
Requires-Dist: pyzabbix (>=1.3.1,<2.0.0)
|
|
35
|
+
Requires-Dist: redis (>=5.2.0,<6.0.0)
|
|
36
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
37
|
+
Requires-Dist: sqladmin (>=0.20.1,<0.21.0)
|
|
38
|
+
Requires-Dist: sqlalchemy (>=2.0.36,<3.0.0)
|
|
39
|
+
Requires-Dist: twine (>=6.0.1,<7.0.0)
|
|
40
|
+
Requires-Dist: uvicorn (>=0.32.1,<0.33.0)
|
|
41
|
+
Project-URL: Repository, https://github.com/ARPAKIT-Company/arpakitlib
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# arpakitlib
|
|
45
|
+
|
|
46
|
+
## 🚀 Simplify Your Development Workflow
|
|
47
|
+
|
|
48
|
+
A collection of lightweight and convenient development tools by Arpakit, designed to simplify and accelerate your
|
|
49
|
+
workflow
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### Supported python version
|
|
54
|
+
- Python ^3.12
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### Installation with Poetry
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
poetry add arpakitlib
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Installation with pip
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
pip install arpakitlib
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### Links
|
|
73
|
+
|
|
74
|
+
- https://pypi.org/project/arpakitlib/
|
|
75
|
+
- https://test.pypi.org/project/arpakitlib/
|
|
76
|
+
- https://github.com/ARPAKIT-Company/arpakitlib
|
|
77
|
+
- https://t.me/arpakit (author telegram)
|
|
78
|
+
- arpakit@gmail.com (author email)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## ❤️ Made with Care by Arpakit ❤️
|
|
83
|
+
|
|
84
|
+
|
|
@@ -11,9 +11,10 @@ arpakitlib/ar_arpakitlib_info.py,sha256=WwssAURbohdFcrJbU-uWPcLg3C-A564gWiS1ovIo
|
|
|
11
11
|
arpakitlib/ar_base64_util.py,sha256=jrxR9_tCf1_4EnY7we-NZW-IjTJ1EiJkDsaoDRD0Xmk,665
|
|
12
12
|
arpakitlib/ar_base_worker.py,sha256=LSgjxLyv_snasX_O9l47BgCwuvW9Q8l7wGCDCvPorLI,2419
|
|
13
13
|
arpakitlib/ar_cache_file.py,sha256=zgSIFGMcet4Lcmh4LSJvOKhffFiv7ENy2ni9pnM-f9Q,3460
|
|
14
|
-
arpakitlib/ar_datetime_util.py,sha256=
|
|
14
|
+
arpakitlib/ar_datetime_util.py,sha256=Gz5NoZH-zzFqFqGvCcxNqqczPTmq2M657aI2Cr1OefQ,960
|
|
15
15
|
arpakitlib/ar_dict_util.py,sha256=82gl7RS9BJiLgZmihrRfrakdeE0wxhhKUNTbRY9G-uQ,408
|
|
16
16
|
arpakitlib/ar_dream_ai_api_client.py,sha256=KF17_0s-bAVO6TnyWex2_KCpB_USKU_hV5jk1o332mQ,3979
|
|
17
|
+
arpakitlib/ar_easy_sqlalchemy_util.py,sha256=O4EXM-j8C95urv2weK8bBOaIuBrnihYx74AgIL4Dm7M,3213
|
|
17
18
|
arpakitlib/ar_encrypt_and_decrypt_util.py,sha256=DTvqD1Gk1qiewmrRZFYQUJJjg9c5dvZ_ZDOPTvt7hqk,509
|
|
18
19
|
arpakitlib/ar_enumeration.py,sha256=1JduJgFfygA_8zY48SmNac_WwH99F25xSvvB5YnqGWA,2243
|
|
19
20
|
arpakitlib/ar_fastapi_static/redoc/redoc.standalone.js,sha256=WCuodUNv1qVh0oW5fjnJDwb5AwOue73jKHdI9z8iGKU,909365
|
|
@@ -55,14 +56,14 @@ arpakitlib/ar_postgresql_util.py,sha256=bsnp5ylMvi7qJaj5fA3QZdQ4wUtrCZxElNikMWNs
|
|
|
55
56
|
arpakitlib/ar_run_cmd.py,sha256=2Cs1xn3jS3xfAbgIHthtLCKQC-qr1k7w15rID2Zya3A,1061
|
|
56
57
|
arpakitlib/ar_safe_sleep.py,sha256=fxJIe85G62qmcHeujqu8FfHOKYfuZPz315ZW-BO_w0Q,398
|
|
57
58
|
arpakitlib/ar_schedule_uust_api_client.py,sha256=bK79j0EAqQKnSYlr0Rqp2vz84hNlBrmjmjp7FADK3PU,6783
|
|
58
|
-
arpakitlib/
|
|
59
|
+
arpakitlib/ar_sqlalchemy_model_util.py,sha256=RPv5lzqCuX2_TM3gtbqXlWWUDzPrYjwlq_rRN7ANmVA,1264
|
|
59
60
|
arpakitlib/ar_ssh_runner.py,sha256=-VL1RjQRVDjlnIFQfl_TTpQP05OehNxmvkfoQNgvNYw,6785
|
|
60
61
|
arpakitlib/ar_str_util.py,sha256=y1KQ5q9WPMhQdmLqqL1R1GrPEEEj_Jo4dxbAPCgW780,1874
|
|
61
62
|
arpakitlib/ar_type_util.py,sha256=9fSSJKWsHtXOjGcFHgfEI_1ezrHfjF_o3y1RAJvMX9c,1750
|
|
62
63
|
arpakitlib/ar_yookassa_api_client.py,sha256=jCoeK9WfwGK4IUPYYsRgxWEqkNfUV5-ZJQg0b2evtTc,6438
|
|
63
64
|
arpakitlib/ar_zabbix_util.py,sha256=BvtqIT4PnUw4OzzRKPpdu-nLyYZ5cMatYUDeSdXPgGw,6302
|
|
64
|
-
arpakitlib-1.5.
|
|
65
|
-
arpakitlib-1.5.
|
|
66
|
-
arpakitlib-1.5.
|
|
67
|
-
arpakitlib-1.5.
|
|
68
|
-
arpakitlib-1.5.
|
|
65
|
+
arpakitlib-1.5.21.dist-info/LICENSE,sha256=1jqWIkbnMxDfs_i0SXP5qbV6PHjBr1g8506oW7uPjfg,11347
|
|
66
|
+
arpakitlib-1.5.21.dist-info/METADATA,sha256=3LbycxcxLLsUJXQfFRLk-V-GGxhVve5HydTV8ZRP1aY,2323
|
|
67
|
+
arpakitlib-1.5.21.dist-info/NOTICE,sha256=wHwmiq3wExfFfgMsE5U5TOBP9_l72ocIG82KurEels0,43
|
|
68
|
+
arpakitlib-1.5.21.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
69
|
+
arpakitlib-1.5.21.dist-info/RECORD,,
|
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: arpakitlib
|
|
3
|
-
Version: 1.5.19
|
|
4
|
-
Summary: arpakitlib
|
|
5
|
-
License: Apache-2.0
|
|
6
|
-
Author: arpakit
|
|
7
|
-
Author-email: arpakit@gmail.com
|
|
8
|
-
Requires-Python: >=3.12,<4.0
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
Requires-Dist: aiogram (>=3.15.0,<4.0.0)
|
|
14
|
-
Requires-Dist: aiohttp-socks (>=0.9.1,<0.10.0)
|
|
15
|
-
Requires-Dist: alembic (>=1.14.0,<2.0.0)
|
|
16
|
-
Requires-Dist: asyncpg (>=0.30.0,<0.31.0)
|
|
17
|
-
Requires-Dist: asyncssh (>=2.18.0,<3.0.0)
|
|
18
|
-
Requires-Dist: bs4 (>=0.0.2,<0.0.3)
|
|
19
|
-
Requires-Dist: cachetools (>=5.5.0,<6.0.0)
|
|
20
|
-
Requires-Dist: celery (>=5.4.0,<6.0.0)
|
|
21
|
-
Requires-Dist: cryptography (>=44.0.0,<45.0.0)
|
|
22
|
-
Requires-Dist: fastapi (>=0.115.5,<0.116.0)
|
|
23
|
-
Requires-Dist: gunicorn (>=23.0.0,<24.0.0)
|
|
24
|
-
Requires-Dist: openai (>=1.55.3,<2.0.0)
|
|
25
|
-
Requires-Dist: pandas (>=2.2.3,<3.0.0)
|
|
26
|
-
Requires-Dist: paramiko (>=3.5.0,<4.0.0)
|
|
27
|
-
Requires-Dist: psycopg-binary (>=3.2.3,<4.0.0)
|
|
28
|
-
Requires-Dist: psycopg2-binary (>=2.9.10,<3.0.0)
|
|
29
|
-
Requires-Dist: pydantic-settings (>=2.6.1,<3.0.0)
|
|
30
|
-
Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
|
|
31
|
-
Requires-Dist: pymongo (>=4.10.1,<5.0.0)
|
|
32
|
-
Requires-Dist: pytz (>=2024.2,<2025.0)
|
|
33
|
-
Requires-Dist: pyzabbix (>=1.3.1,<2.0.0)
|
|
34
|
-
Requires-Dist: redis (>=5.2.0,<6.0.0)
|
|
35
|
-
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
36
|
-
Requires-Dist: sqladmin (>=0.20.1,<0.21.0)
|
|
37
|
-
Requires-Dist: sqlalchemy (>=2.0.36,<3.0.0)
|
|
38
|
-
Requires-Dist: twine (>=6.0.1,<7.0.0)
|
|
39
|
-
Requires-Dist: uvicorn (>=0.32.1,<0.33.0)
|
|
40
|
-
Description-Content-Type: text/markdown
|
|
41
|
-
|
|
42
|
-
# ARPAKITLIB
|
|
43
|
-
|
|
44
|
-
## 🚀 Simplify Your Development Workflow
|
|
45
|
-
|
|
46
|
-
A collection of lightweight and convenient development tools by Arpakit, designed to simplify and accelerate your
|
|
47
|
-
workflow
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
### Links
|
|
52
|
-
|
|
53
|
-
- https://pypi.org/project/arpakitlib/
|
|
54
|
-
- https://test.pypi.org/project/arpakitlib/
|
|
55
|
-
- https://github.com/ARPAKIT-Company/arpakitlib
|
|
56
|
-
- https://t.me/arpakit (author telegram)
|
|
57
|
-
- arpakit@gmail.com (author email)
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Below is a set of information to assist with development at Arpakit Company
|
|
62
|
-
|
|
63
|
-
Note: This is not related to ArpakitLib, it is just a collection of helpful information
|
|
64
|
-
|
|
65
|
-
### Emoji
|
|
66
|
-
|
|
67
|
-
- https://www.prosettings.com/emoji-list/
|
|
68
|
-
|
|
69
|
-
### Timezones
|
|
70
|
-
|
|
71
|
-
- https://gist.github.com/heyalexej/8bf688fd67d7199be4a1682b3eec7568
|
|
72
|
-
|
|
73
|
-
### Docker help
|
|
74
|
-
|
|
75
|
-
- https://www.ionos.com/digitalguide/server/configuration/install-docker-on-ubuntu-2204/
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
sudo apt update
|
|
79
|
-
sudo apt upgrade
|
|
80
|
-
sudo apt install ca-certificates curl gnupg lsb-release
|
|
81
|
-
sudo mkdir -p /etc/apt/keyrings
|
|
82
|
-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
83
|
-
echo \
|
|
84
|
-
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
|
85
|
-
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
86
|
-
sudo apt update
|
|
87
|
-
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
88
|
-
sudo groupadd docker
|
|
89
|
-
sudo usermod -aG docker $USER
|
|
90
|
-
|
|
91
|
-
docker ps -a
|
|
92
|
-
docker stop $(docker ps -a -q)
|
|
93
|
-
docker container rm $(docker ps -a -q)
|
|
94
|
-
docker rmi $(docker images -a -q)
|
|
95
|
-
docker stop $(docker ps -a -q) && docker container rm $(docker ps -a -q)
|
|
96
|
-
docker stop $(docker ps -a -q) && docker container rm $(docker ps -a -q) && docker rmi $(docker images -a -q)
|
|
97
|
-
docker build -p 8080:8080 -t tagname -f Dockerfile .
|
|
98
|
-
docker stats
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
docker rm ...
|
|
102
|
-
docker run --name ... -d -p ...:5432 -e POSTGRES_USER=... -e POSTGRES_PASSWORD=... -e POSTGRES_DB=... postgres:16 -c max_connections=100
|
|
103
|
-
docker start ...
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Systemd help
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
[Unit]
|
|
110
|
-
Description=...
|
|
111
|
-
After=network.target
|
|
112
|
-
|
|
113
|
-
[Service]
|
|
114
|
-
User=...
|
|
115
|
-
WorkingDirectory=...
|
|
116
|
-
ExecStart=...
|
|
117
|
-
RestartSec=5
|
|
118
|
-
Restart=always
|
|
119
|
-
|
|
120
|
-
[Install]
|
|
121
|
-
WantedBy=multi-user.target
|
|
122
|
-
|
|
123
|
-
sudo systemctl start ...
|
|
124
|
-
sudo systemctl stop ...
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
[Unit]
|
|
128
|
-
Description=divar_site
|
|
129
|
-
|
|
130
|
-
[Service]
|
|
131
|
-
User=divar_site
|
|
132
|
-
WorkingDirectory=/home/divar_site/divar_site
|
|
133
|
-
Environment=PATH=/home/divar_site/.nvm/versions/node/v18.16.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
|
|
134
|
-
ExecStart=/bin/bash -c "npm run start"
|
|
135
|
-
RestartSec=5
|
|
136
|
-
Restart=always
|
|
137
|
-
|
|
138
|
-
[Install]
|
|
139
|
-
WantedBy=multi-user.target
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Nginx help
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
sudo apt update
|
|
146
|
-
sudo apt install nginx
|
|
147
|
-
systemctl start nginx
|
|
148
|
-
systemctl stop nginx
|
|
149
|
-
systemctl restart nginx
|
|
150
|
-
|
|
151
|
-
server {
|
|
152
|
-
listen 80;
|
|
153
|
-
listen [::]:80;
|
|
154
|
-
|
|
155
|
-
server_name ...;
|
|
156
|
-
|
|
157
|
-
location / {
|
|
158
|
-
proxy_set_header Host $host;
|
|
159
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
160
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
161
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
162
|
-
proxy_pass http://127.0.0.1:...;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Poetry help
|
|
168
|
-
|
|
169
|
-
- https://python-poetry.org/docs/
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
curl -sSL https://install.python-poetry.org | python3 -
|
|
173
|
-
# After downloading u should update .profile, bashrc etc...
|
|
174
|
-
exec "$SHELL"
|
|
175
|
-
# export PATH="$HOME/.local/bin:$PATH"
|
|
176
|
-
poetry config virtualenvs.in-project true
|
|
177
|
-
poetry self add poetry-plugin-export
|
|
178
|
-
poetry self update
|
|
179
|
-
|
|
180
|
-
poetry env use ...
|
|
181
|
-
poetry install
|
|
182
|
-
poetry update
|
|
183
|
-
|
|
184
|
-
pyproject.toml
|
|
185
|
-
package-mode = false
|
|
186
|
-
|
|
187
|
-
poetry config repositories.testpypi https://test.pypi.org/legacy/
|
|
188
|
-
poetry config pypi-token.testpypi ...
|
|
189
|
-
poetry publish --build --repository testpypi
|
|
190
|
-
poetry source add --priority=explicit testpypi https://test.pypi.org/legacy/
|
|
191
|
-
poetry config pypi-token.pypi <your-pypi-token>
|
|
192
|
-
|
|
193
|
-
poetry export -f requirements.txt --without-hashes --output requirements.txt
|
|
194
|
-
|
|
195
|
-
poetry cache clear pypi --all
|
|
196
|
-
|
|
197
|
-
export TWINE_HTTP_TIMEOUT=60
|
|
198
|
-
poetry publish
|
|
199
|
-
|
|
200
|
-
poetry cache clear --all PyPI
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### Pyenv help
|
|
204
|
-
|
|
205
|
-
- https://kfields.me/blog/pyenv_on_ubuntu_22
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
sudo apt update
|
|
209
|
-
sudo apt install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
|
|
210
|
-
curl https://pyenv.run | bash
|
|
211
|
-
# After downloading u should update .profile, bashrc etc...
|
|
212
|
-
# export PYENV_ROOT="$HOME/.pyenv"
|
|
213
|
-
# [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
|
214
|
-
# eval "$(pyenv init -)"
|
|
215
|
-
exec "$SHELL"
|
|
216
|
-
pyenv install ...
|
|
217
|
-
pyenv versions
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Certbot help
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
sudo apt install snapd -y
|
|
224
|
-
sudo snap install --classic certbot
|
|
225
|
-
su - root
|
|
226
|
-
|
|
227
|
-
certbot --nginx -d "a.domain.com" -d "b.domain.com"
|
|
228
|
-
sudo certbot certificates
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### Proxy example help
|
|
232
|
-
|
|
233
|
-
```
|
|
234
|
-
socks5://user:passwd@hostname:port
|
|
235
|
-
https://user:passwd@hostname:port
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### PostgreSQL help
|
|
239
|
-
|
|
240
|
-
- https://selectel.ru/blog/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04/
|
|
241
|
-
|
|
242
|
-
```
|
|
243
|
-
# install postgresql
|
|
244
|
-
sudo apt install postgresql postgresql-contrib
|
|
245
|
-
sudo apt install postgresql-client
|
|
246
|
-
sudo systemctl start postgresql.service
|
|
247
|
-
sudo systemctl status postgresql.service
|
|
248
|
-
sudo -i -u postgres
|
|
249
|
-
psql
|
|
250
|
-
\conninfo - info
|
|
251
|
-
\q - exit
|
|
252
|
-
\list - databases
|
|
253
|
-
\du - users
|
|
254
|
-
createuser --interactive --pwprompt
|
|
255
|
-
createdb -U postgres ...
|
|
256
|
-
ALTER ROLE username WITH PASSWORD 'newpassword';
|
|
257
|
-
sudo nano /etc/postgresql/<версия>/main/pg_hba.conf
|
|
258
|
-
host all all 0.0.0.0/0 md5
|
|
259
|
-
sudo nano /etc/postgresql/<версия>/main/postgresql.conf
|
|
260
|
-
listen_addresses = '*'
|
|
261
|
-
#port = 5432
|
|
262
|
-
CREATE USER ... WITH PASSWORD '...';
|
|
263
|
-
ALTER USER ... WITH SUPERUSER;
|
|
264
|
-
CREATE DATABASE ... OWNER '...';
|
|
265
|
-
|
|
266
|
-
# postgresql db url, db_url
|
|
267
|
-
postgresql://username:password@host:port/database_name
|
|
268
|
-
|
|
269
|
-
# postgresql pg_dump
|
|
270
|
-
pg_dump -U postgres -h localhost -t <имя_таблицы> mydb > table_dump.sql
|
|
271
|
-
pg_dump -U ... -h ... ... -p ... > ...
|
|
272
|
-
|
|
273
|
-
# postgresql db_restore
|
|
274
|
-
pg_restore -U ... -h ... -p ... -d ... ....dump
|
|
275
|
-
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Install Python from apt help
|
|
279
|
-
|
|
280
|
-
```
|
|
281
|
-
sudo apt install software-properties-common -y
|
|
282
|
-
sudo add-apt-repository ppa:deadsnakes/ppa
|
|
283
|
-
sudo apt install python3.12
|
|
284
|
-
sudo apt install python3.12-venv
|
|
285
|
-
|
|
286
|
-
# create venv with python
|
|
287
|
-
python3 -m venv .venv
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Git help
|
|
291
|
-
|
|
292
|
-
```
|
|
293
|
-
git remote -v
|
|
294
|
-
git remote remove origin_name
|
|
295
|
-
git remote add origin_name URL
|
|
296
|
-
git remote set-url origin_name URL
|
|
297
|
-
git remote rename old new
|
|
298
|
-
git fetch --all
|
|
299
|
-
git branch -r
|
|
300
|
-
git branch -a
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Linux help
|
|
304
|
-
|
|
305
|
-
```
|
|
306
|
-
free -h проверка оперативной памяти
|
|
307
|
-
df -h - проверка постоянной памяти
|
|
308
|
-
nano /etc/apt/sources.list.d
|
|
309
|
-
deluser --remove-home user
|
|
310
|
-
adduser user
|
|
311
|
-
usermode -aG sudo user
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
### Swagger-ui, /docs help
|
|
315
|
-
|
|
316
|
-
- https://github.com/swagger-api/swagger-ui (folder dist for download static docs)
|
|
317
|
-
|
|
318
|
-
### npm, nvm help
|
|
319
|
-
|
|
320
|
-
- https://github.com/nvm-sh/nvm
|
|
321
|
-
- https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04
|
|
322
|
-
|
|
323
|
-
```
|
|
324
|
-
# install nvm, npm, node (https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04)
|
|
325
|
-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
|
326
|
-
source ~/.bashrc
|
|
327
|
-
exec "$SHELL"
|
|
328
|
-
npm -v
|
|
329
|
-
nvm current
|
|
330
|
-
nvm ls
|
|
331
|
-
nvm list-remote
|
|
332
|
-
nvm install --lts
|
|
333
|
-
nvm use ...
|
|
334
|
-
npm install
|
|
335
|
-
npm run build
|
|
336
|
-
npm run start
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Xray help
|
|
340
|
-
|
|
341
|
-
- https://github.com/XTLS/Xray-install
|
|
342
|
-
|
|
343
|
-
```
|
|
344
|
-
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
|
|
345
|
-
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install-geodata
|
|
346
|
-
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ remove
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
### Celery help
|
|
350
|
-
|
|
351
|
-
```
|
|
352
|
-
celery -A app worker --loglevel=info -Q queue_name -c 1 -n worker_name &
|
|
353
|
-
celery -A app beat --loglevel=info &
|
|
354
|
-
wait
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
### Licence help
|
|
358
|
-
|
|
359
|
-
- https://choosealicense.com/
|
|
360
|
-
|
|
361
|
-
---
|
|
362
|
-
|
|
363
|
-
## ❤️ Made with Care by Arpakit ❤️
|
|
364
|
-
|
|
365
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|