Skip to content

Commit

Permalink
prepare growi
Browse files Browse the repository at this point in the history
  • Loading branch information
outductor committed Jan 13, 2024
1 parent 808bc80 commit 7fa6136
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build_growi_elasticsearch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI
on:
push:
paths:
- ".github/workflows/build_growi_elasticsearch.yaml"
- "docker-images/growi/elasticsearch/**"

env:
IMAGE: ghcr.io/giganticminecraft/growi-elasticsearch

jobs:
lint-and-test:
name: Lint and test application
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

build-image:
name: Build docker image (and publish on master)
needs: [lint-and-test]
runs-on: ubuntu-22.04
defaults:
run:
working-directory: docker-images/mod-downloader
steps:
- name: checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=sha,prefix=sha-,suffix=,format=short
type=schedule,pattern={{date 'YYYYMMDD'}}
- name: Build (and push if on main)
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./docker-images/growi/elasticsearch
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
# すべてのビルドステージのすべてのレイヤーをキャッシュして欲しいのでmode=max
cache-to: type=gha,mode=max
61 changes: 61 additions & 0 deletions .github/workflows/build_growi_hackmd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI
on:
push:
paths:
- ".github/workflows/build_growi_hackmd.yaml"
- "docker-images/growi/hackmd/**"

env:
IMAGE: ghcr.io/giganticminecraft/growi-hackmd

jobs:
lint-and-test:
name: Lint and test application
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

build-image:
name: Build docker image (and publish on master)
needs: [lint-and-test]
runs-on: ubuntu-22.04
defaults:
run:
working-directory: docker-images/mod-downloader
steps:
- name: checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=sha,prefix=sha-,suffix=,format=short
type=schedule,pattern={{date 'YYYYMMDD'}}
- name: Build (and push if on main)
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./docker-images/growi/hackmd
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
# すべてのビルドステージのすべてのレイヤーをキャッシュして欲しいのでmode=max
cache-to: type=gha,mode=max
9 changes: 9 additions & 0 deletions docker-images/growi/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# syntax=docker/dockerfile:1.6
ARG version=8.7.0
FROM docker.elastic.co/elasticsearch/elasticsearch:${version}
LABEL org.opencontainers.image.authors="outductor <[email protected]>"
LABEL org.opencontainers.image.url="https://github.com/GiganticMinecraft/seichi_infra"
LABEL org.opencontainers.image.source="https://github.com/GiganticMinecraft/seichi_infra/blob/main/docker-images/growi/elasticsearch/Dockerfile"

RUN bin/elasticsearch-plugin install analysis-kuromoji
RUN bin/elasticsearch-plugin install analysis-icu
19 changes: 19 additions & 0 deletions docker-images/growi/hackmd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1.6
FROM hackmdio/hackmd:1.3.0-alpine
LABEL org.opencontainers.image.authors="outductor <[email protected]>"
LABEL org.opencontainers.image.url="https://github.com/GiganticMinecraft/seichi_infra"
LABEL org.opencontainers.image.source="https://github.com/GiganticMinecraft/seichi_infra/blob/main/docker-images/growi/hackmd/Dockerfile"

# copy script to apply GROWI agent
COPY apply-growi-agent.sh /codimd/apply-growi-agent.sh
# run the script
RUN /codimd/apply-growi-agent.sh

# overwrite HackMD config file
RUN rm -f /files/config.json && rm -f /codimd/config.json
COPY config.json /files/
RUN ln -s /files/config.json /codimd/config.json

# create sqlite data dir
RUN mkdir /files/sqlite && chown codimd /files/sqlite
RUN ln -s /files/sqlite /codimd/sqlite
4 changes: 4 additions & 0 deletions docker-images/growi/hackmd/apply-growi-agent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

echo '<script src="<%= process.env.GROWI_URI %>/_hackmd/load-styles"></script>' >> /codimd/public/views/codimd/head.ejs
echo '<script src="<%= process.env.GROWI_URI %>/_hackmd/load-agent" defer></script>' >> /codimd/public/views/codimd/foot.ejs
8 changes: 8 additions & 0 deletions docker-images/growi/hackmd/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"production": {
"urlAddPort": true,
"email": true,
"imageUploadType": "imgur",
"sessionName": "connect.codimd.sid"
}
}
6 changes: 6 additions & 0 deletions terraform/onp_cluster_namespaces.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ resource "kubernetes_namespace" "minio" {
name = "minio"
}
}

resource "kubernetes_namespace" "growi-system" {
metadata {
name = "growi-system"
}
}

0 comments on commit 7fa6136

Please sign in to comment.