libertysoft3 / saidit

The reddit open source fork powering SaidIt
https://saidit.net
Other
226 stars 40 forks source link

Create Ubuntu 14 Docker Image #91

Closed libertysoft3 closed 2 years ago

libertysoft3 commented 4 years ago

This will allow installation on an Ubuntu 18 host and more. It's the easiest path to longevity.

Is it supposed to be one container per service? If so, we will need like 10 or 20 containers.

8secz-johndpope commented 3 years ago

it seems that inside the https://github.com/libertysoft3/saidit/blob/master/.drone.yml file there is the docker compose related code. I didn't use drone before - would prefer to discontinue that to start with.

this docker image is still live docker pull reddit/cassandra:single-1.2.19-v1

need to check this jplock/zookeeper:3.4.6

FROM openjdk:8-jre-alpine

ARG MIRROR=http://apache.mirrors.pair.com
ARG VERSION=3.5.5

LABEL name="zookeeper" version=$VERSION

RUN apk add --no-cache wget bash \
    && mkdir -p /opt/zookeeper \
    && wget -q -O - $MIRROR/zookeeper/zookeeper-$VERSION/apache-zookeeper-$VERSION-bin.tar.gz \
      | tar -xzC /opt/zookeeper --strip-components=1 \
    && cp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg \
    && mkdir -p /tmp/zookeeper

# Enable additional four-letter word commands
# see https://zookeeper.apache.org/doc/r3.5.5/zookeeperAdmin.html#sc_clusterOptions
RUN echo "4lw.commands.whitelist=*" >> /opt/zookeeper/conf/zoo.cfg

EXPOSE 2181 2888 3888

WORKDIR /opt/zookeeper

# Only checks if server is up and listening, not quorum. 
# See https://zookeeper.apache.org/doc/r3.5.5/zookeeperAdmin.html#sc_zkCommands
HEALTHCHECK CMD [ $(echo ruok | nc 127.0.0.1:2181) == "imok" ] || exit 1

VOLUME ["/opt/zookeeper/conf", "/tmp/zookeeper"]

ENTRYPOINT ["/opt/zookeeper/bin/zkServer.sh"]
CMD ["start-foreground"]

https://hub.docker.com/layers/reddit/reddit-py/latest/images/sha256-b04df34a673e264aa31c665d6f44f3c571ef6eb294688fc4f78c5741650b38ae?context=explore

Reddit-py Dockerfile

ADD file:ada91758a31d8de3c78ea0065fbc866430a71eb58bf5c4cb403d47052b1cade0 in /
/bin/sh -c set -xe      && echo '#!/bin/sh' > /usr/sbin/policy-rc.d     && echo 'exit 101' >> /usr/sbin/policy-rc.d     && chmod +x /usr/sbin/policy-rc.d       && dpkg-divert --local --rename --add /sbin/initctl     && cp -a /usr/sbin/policy-rc.d /sbin/initctl    && sed -i 's/^exit.*/exit 0/' /sbin/initctl         && echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup         && echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean   && echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean   && echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean      && echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages      && echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes       && echo 'Apt::AutoRemove::SuggestsImportant "false";' > /etc/apt/apt.conf.d/docker-autoremove-suggests
/bin/sh -c rm -rf /var/lib/apt/lists/*
/bin/sh -c sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
/bin/sh -c mkdir -p /run/systemd && echo 'docker' > /run/systemd/container
CMD ["/bin/bash"]
ENV DEBIAN_FRONTEND=noninteractive
/bin/sh -c apt-get update &&     apt-get install -y curl software-properties-common python-software-properties &&     apt-add-repository -y ppa:reddit/ppa && apt-get update
/bin/sh -c apt-get install -y netcat-openbsd git-core gunicorn python-dev     python-setuptools python-routes python-pylons python-boto python-tz     python-crypto python-babel python-numpy python-dateutil cython     python-sqlalchemy python-beautifulsoup python-chardet python-psycopg2     python-pycassa python-httpagentparser python-imaging python-pycaptcha     python-pylibmc=1.2.2-1~trusty5 python-amqplib python-bcrypt python-snappy     python-snudown python-l2cs python-lxml python-kazoo python-stripe     python-tinycss2 python-unidecode python-mock python-yaml     python-baseplate python-flask geoip-bin geoip-database     python-geoip nodejs node-less node-uglify gettext make optipng jpegoptim     libpcre3-dev python-gevent python-gevent-websocket python-haigha     python-redis python-pyramid python-advocate
/bin/sh -c apt-get install -y mcrouter memcached postgresql postgresql-client     rabbitmq-server haproxy nginx gunicorn redis-server
/bin/sh -c easy_install pip && pip install -U pip wheel setuptools coverage pep8
CMD [""]

compose:

Some of these aren't actively used, but are required in that import

side-effects cause connections to services (regardless of whether

the services are interacted with in the tests). Each service is addressable

via 'localhost' through whatever ports the image exposes.

postgres:

Temporarily needed for this image + Docker-in-Docker. Expected to

# be removed when we upgrade to Drone 0.5.
# https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities
privileged: true
image: postgres:9.3.12
environment:
  POSTGRES_USER: reddit
  POSTGRES_PASSWORD: password
  POSTGRES_DB: reddit

cassandra: privileged: true

Cassandra 1.x is old enough not to have any official Docker images.

# In the meantime, we've got a custom image configured specifically for r2:
# https://github.com/reddit/docker-cassandra
# We'll move over to the official images when we upgrade to C* 2.x.
image: reddit/cassandra:single-1.2.19-v1

rabbitmq:

NOTE: Using 3.4.x instead of 3.2.4 due to tag availability.

image: rabbitmq:3.4
environment:
  RABBITMQ_DEFAULT_VHOST: /
  RABBITMQ_DEFAULT_USER: reddit
  RABBITMQ_DEFAULT_PASS: reddit

memcached:

NOTE: Using 1.4.21 instead of 1.4.17 due to tag availability.

image: memcached:1.4.21

zookeeper: image: jplock/zookeeper:3.4.6

libertysoft3 commented 3 years ago

Nice, thanks for pointing this out. It looks like all of the Docker pieces are there and it just needs to be decoupled from Drone CI like you said. saidit could make updated versions of https://hub.docker.com/r/reddit/reddit-py and https://hub.docker.com/r/reddit/cassandra and be fully decoupled from Reddit it looks like.

libertysoft3 commented 2 years ago

Resolved with 2881b3c8ec9e5929cdcc74ca9db25fa9151ce373