# 환경 구성

## 설치하기

Docker를 활용하여 서버를 설치하고 실행하는 방법이며, 환경변수를 통해 S3와 DB를 연결합니다.\
<https://docs.docker.com/engine/install/>

{% hint style="info" %}
데이터베이스의 연결이 필요함에 따라서, **postgresql 환경의 설정이 필요할 수 있습니다**.
{% endhint %}

{% tabs %}
{% tab title="Docker로 실행하기" %}

#### 도커 이미지 빌드

```sh
docker build -t pic_origin_image .
```

{% endtab %}
{% endtabs %}

## 도커 컨테이너 실행

{% tabs %}
{% tab title="with env file" %}

```
ACCESS_TOKEN_EXPIRE_MINUTES=300000
REFRESH_TOKEN_EXPIRE_DAYS=7
EXPIRATION_TIME_IN_SECONDS=3600
ALGORITHM="HS256"
SERVICE_NAME="s3"
CLIPDROP_SECRET_KEY={YOUR_CLIPDROP_SECRET_KEY}
SECRET_KEY={YOUR_SECRET_KEY}
BUCKET_NAME={YOUR_S3_BUCKET_KEY}
REGION_NAME={YOUR_S3_REGION_NAME}
AWS_ACCESS_KEY_ID={YOUR_S3_ACCESS_KEY}
AWS_SECRET_ACCESS_KEY={YOUR_S3_SECRET_KEY}
POSTGRE_DATABASE_URL={YOUR_POSTGRES_DATABASE_URL} 
```

{% endtab %}

{% tab title="without env file" %}

```
docker run \
    --name {YOUR_CONTAINER_NAME} \
    -p 8000:80 \
    -v $(pwd):/app \
    -e ACCESS_TOKEN_EXPIRE_MINUTES=300000 \
    -e REFRESH_TOKEN_EXPIRE_DAYS=7 \
    -e EXPIRATION_TIME_IN_SECONDS=3600 \
    -e ALGORITHM="HS256" \
    -e SERVICE_NAME="s3" \
    -e CLIPDROP_SECRET_KEY={YOUR_CLIPDROP_SECRET_KEY} \
    -e SECRET_KEY={YOUR_SECRET_KEY} \
    -e BUCKET_NAME={YOUR_S3_BUCKET_KEY} \
    -e REGION_NAME={YOUR_S3_REGION_NAME} \
    -e AWS_ACCESS_KEY_ID={YOUR_S3_ACCESS_KEY} \
    -e AWS_SECRET_ACCESS_KEY={YOUR_S3_SECRET_KEY} \
    -e POSTGRE_DATABASE_URL={YOUR_POSTGRES_DATABASE_URL} \
    pic_origin_image
```

{% endtab %}
{% endtabs %}

## 작동확인하기

{% tabs %}
{% tab title="Curl" %}

```
curl https://localhost:8000/api/getServerhealth
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pic-origin.com/undefined.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
