DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

Where can I host PostgreSQL with custom extensions for cheap (or free)?

Of course, I can easily host on DigitalOcean, but there will be price per month; and at least half a hundred USD per year.

I can host on Heroku, but not only that there are limited 10k rows, but also no custom extensions.

I open-sourced the repo, anyway; and one can use it to make Anki. But I want to service further, and get more audience. (But I won't want to cost my wallet too much.)

GitHub logo patarapolw / cjclub

Chinese-Japanese Character and Vocabulary club

What extensions? You can see my Dockerfile.

# Based on debian-slim
FROM postgres:12

RUN mkdir -p /app
RUN apt-get update

# pgroonga extension
# Does not officially support alpine
RUN apt-get install -y wget
RUN wget
RUN apt install -y -V ./groonga-apt-source-latest-buster.deb
RUN echo "deb buster-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - | apt-key add -
RUN apt-get update
RUN apt-get install -y -V postgresql-12-pgdg-pgroonga
RUN apt-get install -y -V groonga-tokenizer-mecab
RUN apt-get install -y -V groonga-token-filter-stem

RUN apt-get install -y git make

# postgres-json-schema extension
RUN git clone --depth 1
RUN cd postgres-json-schema && make install

# groonga-tokenizer-friso extension
# WORKDIR /app
# RUN apt-get install -y build-essential automake libtool libgroonga-dev
# RUN git clone --depth 1
# RUN wget -c -O - | tar -xz
# RUN cd friso-1.6.4-release/src && make && make install
# RUN cd groonga-tokenizer-friso && ./ && ./configure --with-friso=/usr --with-friso-ini=../friso-1.6.4-release/friso.ini && make && make install

# pg_jieba extension
RUN apt-get install -y cmake build-essential postgresql-server-dev-12
RUN git clone --depth 1
WORKDIR /app/pg_jieba
RUN git submodule update --init --recursive
RUN mkdir build && cd build && cmake -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/12/server .. && make && make install
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

scalegridio profile image

You can check out ScaleGrid's PostgreSQL hosting - it supports all PostgreSQL extensions and is available on DigitalOcean, Linode, AWS, Azure, GCP and OCI.