2023년 테스트 됨. Ory Hydra v2.2.0-rc.3 바이너리를 /opt/hydra 에 두고 PostgreSQL 로 띄운 기록이다. 현행 절차는 Ory Hydra v26.2.0 설치 가이드 에 있다.
위 버전과 저장소는 오래된 것이라 저장소가 존재하지 않을 수 있다.
PostgreSQL 9.4 이상이 필요하다.
useradd -s /bin/false -m -d /opt/hydra hydra
mkdir /opt/hydra/bin
mkdir /opt/hydra/config
cd /opt/hydra/bin
# Download a new version of Ory Hydra (참조 https://github.com/ory/hydra)
wget https://github.com/ory/hydra/releases/download/v2.2.0-rc.3/hydra_2.2.0-rc.3-linux_64bit.tar.gz
# Extract contents
tar xfvz hydra_2.2.0-rc.3-linux_64bit.tar.gz
# Remove redundant files
rm *md
rm LICENSE
cd ../config
wget https://raw.githubusercontent.com/ory/hydra/v2.2.0-rc.3/contrib/quickstart/5-min/hydra.yml
serve:
cookies:
same_site_mode: Lax
dsn: postgres://hydra:${REDACTED}@hydra.haedongg.net/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
urls:
self:
issuer: https://oauth2.example.com
consent: http://127.0.0.1:3000/consent
login: http://127.0.0.1:3000/login
logout: http://127.0.0.1:3000/logout
secrets:
system:
- youReallyNeedToChangeThis
oidc:
subject_identifiers:
supported_types:
- pairwise
- public
pairwise:
salt: youReallyNeedToChangeThis
/opt/hydra/bin/hydra -c /opt/hydra/config/hydra.yml migrate sql -y postgres://hydra:${REDACTED}@hydra.haedongg.net:5432/hydra?sslmode=disable
/opt/hydra/bin/hydra -c /opt/hydra/config/hydra.yml serve all
chown -R hydra /opt/hydra/
/etc/systemd/system/hydra.service
[Unit]
Description=Hydra Service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=hydra
Environment=SERVE_ADMIN_HOST=127.0.0.1
Environment=SERVE_PUBLIC_HOST=127.0.0.1
ExecStart=/opt/hydra/bin/hydra -c /opt/hydra/config/hydra.yml serve all
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now hydra