Spaces:
Paused
Paused
Download entrypoint.sh from EgorQwerty/server: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/EgorQwerty/server/resolve/main/entrypoint.sh
- Command line
-
hf download hf://spaces/EgorQwerty/server/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/EgorQwerty/server/resolve/main/entrypoint.sh
1.15 kB
| set -e | |
| # Установка LANG | |
| export LANG=en_US.UTF-8 | |
| # Проверка секретов и установка пароля | |
| if [ -n "$SSH_PASSWORD" ]; then | |
| echo "root:$SSH_PASSWORD" | chpasswd | |
| echo "Пароль root установлен." | |
| else | |
| echo "ВНИМАНИЕ: SSH_PASSWORD не задан!" | |
| fi | |
| # Ключи для SSH | |
| ssh-keygen -A | |
| # Исправленная инициализация PostgreSQL | |
| DB_DIR="/var/lib/postgresql/14/main" | |
| if [ ! -f "$DB_DIR/postgresql.conf" ]; then | |
| echo "База не найдена. Инициализация..." | |
| # Исправлено: разделяем команды | |
| mkdir -p "$DB_DIR" | |
| chown -R postgres:postgres "$DB_DIR" | |
| sudo -u postgres /usr/lib/postgresql/14/bin/initdb -D "$DB_DIR" | |
| echo "listen_addresses = '*'" >> "$DB_DIR/postgresql.conf" | |
| fi | |
| # Права на системные папки | |
| mkdir -p /var/run/postgresql /var/run/sshd /var/log/supervisor | |
| chown -R postgres:postgres /var/run/postgresql | |
| chmod 0755 /var/run/sshd | |
| echo "--- СТАРТ СЕРВИСОВ ---" | |
| exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf |