├── .github ├── buildkitd.toml └── workflows │ └── docker.yml.off ├── Dockerfile ├── LICENSE ├── README.md └── docker ├── gunicorn-events.py ├── gunicorn.py ├── init_zou.sh ├── nginx.conf ├── pg_ctl.conf ├── postgresql-log.conf ├── start_zou.sh └── supervisord.conf /.github/buildkitd.toml: -------------------------------------------------------------------------------- 1 | [worker.oci] 2 | max-parallelism = 1 3 | -------------------------------------------------------------------------------- /.github/workflows/docker.yml.off: -------------------------------------------------------------------------------- 1 | name: Docker 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | 7 | permissions: 8 | contents: read 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check out repository 15 | uses: actions/checkout@v3 16 | - name: Set up QEMU 17 | uses: docker/setup-qemu-action@v3 18 | - name: Set up Docker Buildx 19 | uses: docker/setup-buildx-action@v3 20 | with: 21 | config: .github/buildkitd.toml 22 | - name: Extract Kitsu & Zou versions 23 | id: versions 24 | run: | 25 | echo "ZOU_VERSION=$(grep 'ARG ZOU_VERSION' Dockerfile | sed 's/.*=//')" >> $GITHUB_OUTPUT 26 | echo "KITSU_VERSION=$(grep 'ARG KITSU_VERSION' Dockerfile | sed 's/.*=//')" >> $GITHUB_OUTPUT 27 | - name: Extract metadata (tags, labels) for Docker 28 | id: meta 29 | uses: docker/metadata-action@v5 30 | with: 31 | images: cgwire/cgwire 32 | tags: | 33 | type=raw,value=latest,enable={{is_default_branch}} 34 | type=raw,value=${{ steps.versions.outputs.KITSU_VERSION}} 35 | type=raw,value=${{ steps.versions.outputs.KITSU_VERSION }}-${{ steps.versions.outputs.ZOU_VERSION }} 36 | type=sha,prefix={{branch}}- 37 | type=ref,event=branch 38 | type=ref,event=tag 39 | - name: Build Docker image 40 | uses: docker/build-push-action@v5 41 | with: 42 | context: . 43 | file: ./Dockerfile 44 | platforms: linux/amd64,linux/arm64 45 | tags: ${{ steps.meta.outputs.tags }} 46 | labels: ${{ steps.meta.outputs.labels }} 47 | cache-from: type=gha 48 | cache-to: type=gha,mode=max 49 | 50 | # amd64 51 | - name: Load Docker amd64 image 52 | uses: docker/build-push-action@v5 53 | with: 54 | context: . 55 | file: ./Dockerfile 56 | platforms: linux/amd64 57 | load: true 58 | tags: ${{ steps.meta.outputs.tags }} 59 | labels: ${{ steps.meta.outputs.labels }} 60 | cache-from: type=gha 61 | cache-to: type=gha,mode=max 62 | - name: Test docker amd64 image 63 | run: | 64 | export CONTAINER_ARCH=arm64 65 | export CONTAINER_NAME=cgwire-${CONTAINER_ARCH} 66 | export LOCAL_PORT=8001 67 | 68 | > docker-${CONTAINER_ARCH}.env 69 | echo "KITSU_VERSION=${{ steps.versions.outputs.KITSU_VERSION }}" >> docker-${CONTAINER_ARCH}.env 70 | echo "ZOU_VERSION=${{ steps.versions.outputs.ZOU_VERSION }}" >> docker-${CONTAINER_ARCH}.env 71 | 72 | docker container run --platform=linux/amd64 -d --init -p ${LOCAL_PORT}:80 --rm --name ${CONTAINER_NAME} cgwire/cgwire:latest 73 | echo "KITSU_URL=http://$(docker inspect ${CONTAINER_NAME} | jq -r '.[0]["NetworkSettings"]["IPAddress"]')" >> docker-${CONTAINER_ARCH}.env 74 | sleep 10 75 | docker container run --env-file docker-${CONTAINER_ARCH}.env cgwire/kitsu-checker:latest 76 | docker kill ${CONTAINER_NAME} 77 | 78 | # arm64 79 | - name: Load Docker arm64 image 80 | uses: docker/build-push-action@v5 81 | with: 82 | context: . 83 | file: ./Dockerfile 84 | platforms: linux/arm64 85 | load: true 86 | tags: ${{ steps.meta.outputs.tags }} 87 | labels: ${{ steps.meta.outputs.labels }} 88 | cache-from: type=gha 89 | cache-to: type=gha,mode=max 90 | - name: Test docker arm64 image 91 | run: | 92 | export CONTAINER_ARCH=arm64 93 | export CONTAINER_NAME=cgwire-${CONTAINER_ARCH} 94 | export LOCAL_PORT=8002 95 | 96 | > docker-${CONTAINER_ARCH}.env 97 | echo "KITSU_VERSION=${{ steps.versions.outputs.KITSU_VERSION }}" >> docker-${CONTAINER_ARCH}.env 98 | echo "ZOU_VERSION=${{ steps.versions.outputs.ZOU_VERSION }}" >> docker-${CONTAINER_ARCH}.env 99 | 100 | docker container run --platform=linux/arm64 -d --init -p ${LOCAL_PORT}:80 --rm --name ${CONTAINER_NAME} cgwire/cgwire:latest 101 | echo "KITSU_URL=http://$(docker inspect ${CONTAINER_NAME} | jq -r '.[0]["NetworkSettings"]["IPAddress"]')" >> docker-${CONTAINER_ARCH}.env 102 | sleep 30 103 | docker container run --env-file docker-${CONTAINER_ARCH}.env cgwire/kitsu-checker:latest 104 | docker kill ${CONTAINER_NAME} 105 | 106 | - name: Login to Docker Hub 107 | uses: docker/login-action@v3 108 | with: 109 | username: ${{ secrets.DOCKER_USERNAME }} 110 | password: ${{ secrets.DOCKER_PASSWORD }} 111 | - name: Push Docker image 112 | if: github.event_name != 'pull_request' 113 | uses: docker/build-push-action@v5 114 | with: 115 | context: . 116 | file: ./Dockerfile 117 | platforms: linux/amd64,linux/arm64 118 | push: true 119 | tags: ${{ steps.meta.outputs.tags }} 120 | labels: ${{ steps.meta.outputs.labels }} 121 | cache-from: type=gha 122 | cache-to: type=gha,mode=max 123 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:jammy 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | ENV PG_VERSION=14 5 | ENV DB_USERNAME=root DB_HOST= 6 | # https://github.com/cgwire/zou/tags 7 | ARG ZOU_VERSION=0.20.51 8 | # https://github.com/cgwire/kitsu/tags 9 | ARG KITSU_VERSION=0.20.64 10 | 11 | USER root 12 | 13 | # hadolint ignore=DL3008 14 | RUN mkdir -p /opt/zou/zou /var/log/zou /opt/zou/previews && \ 15 | apt-get update && \ 16 | apt-get install --no-install-recommends -q -y \ 17 | bzip2 \ 18 | build-essential \ 19 | ffmpeg \ 20 | git \ 21 | gcc \ 22 | nginx \ 23 | postgresql \ 24 | postgresql-client \ 25 | python3 \ 26 | python3-dev \ 27 | python3-pip \ 28 | python3-venv \ 29 | libjpeg-dev \ 30 | libpq-dev \ 31 | redis-server \ 32 | software-properties-common \ 33 | supervisor \ 34 | xmlsec1 \ 35 | wget && \ 36 | apt-get clean && \ 37 | rm -rf /var/lib/apt/lists/* 38 | 39 | # Create database 40 | USER postgres 41 | 42 | # hadolint ignore=DL3001 43 | RUN service postgresql start && \ 44 | createuser root && createdb -T template0 -E UTF8 --owner root root && \ 45 | createdb -T template0 -E UTF8 --owner root zoudb && \ 46 | service postgresql stop 47 | 48 | # hadolint ignore=DL3002 49 | USER root 50 | 51 | # Wait for the startup or shutdown to complete 52 | COPY --chown=postgres:postgres --chmod=0644 ./docker/pg_ctl.conf /etc/postgresql/${PG_VERSION}/main/pg_ctl.conf 53 | COPY --chown=postgres:postgres --chmod=0644 ./docker/postgresql-log.conf /etc/postgresql/${PG_VERSION}/main/conf.d/postgresql-log.conf 54 | # hadolint ignore=DL3013 55 | RUN sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis/redis.conf && \ 56 | git config --global --add advice.detachedHead false && \ 57 | wget -q -O /tmp/kitsu.tgz https://github.com/cgwire/kitsu/releases/download/v${KITSU_VERSION}/kitsu-${KITSU_VERSION}.tgz && \ 58 | mkdir -p /opt/zou/kitsu && tar xvzf /tmp/kitsu.tgz -C /opt/zou/kitsu && rm /tmp/kitsu.tgz && \ 59 | python3 -m venv /opt/zou/env && \ 60 | /opt/zou/env/bin/pip install --no-cache-dir --upgrade pip setuptools wheel && \ 61 | /opt/zou/env/bin/pip install --no-cache-dir zou==${ZOU_VERSION} && \ 62 | pip install --no-cache-dir sendria && \ 63 | rm /etc/nginx/sites-enabled/default 64 | 65 | WORKDIR /opt/zou 66 | 67 | COPY ./docker/gunicorn.py /etc/zou/gunicorn.py 68 | COPY ./docker/gunicorn-events.py /etc/zou/gunicorn-events.py 69 | COPY ./docker/nginx.conf /etc/nginx/sites-enabled/zou 70 | COPY docker/supervisord.conf /etc/supervisord.conf 71 | COPY --chmod=0755 ./docker/init_zou.sh /opt/zou/ 72 | COPY --chmod=0755 ./docker/start_zou.sh /opt/zou/ 73 | 74 | RUN echo Initialising Zou... && \ 75 | /opt/zou/init_zou.sh 76 | 77 | EXPOSE 80 78 | EXPOSE 1080 79 | VOLUME ["/var/lib/postgresql", "/opt/zou/previews"] 80 | CMD ["/opt/zou/start_zou.sh"] 81 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kitsu Docker 2 | 3 | Docker container for [Kitsu](https://kitsu.cg-wire.com/). 4 | 5 | If you like the project, please add a star to the [Kitsu repository](https://github.com/cgwire/kitsu). 6 | 7 | It is not recommended to use this image in production. It is intended for Kitsu 8 | testing. 9 | 10 | For this purpose, to simplify email testing, we include an email catch-all 11 | application to intercept all emails sent by Kitsu. These can be viewed in an 12 | included webmail. 13 | 14 | [![Build badge](https://app.travis-ci.com/cgwire/cgwire.svg?branch=master)](https://app.travis-ci.com/cgwire/cgwire) 15 | 16 | ### Usage 17 | 18 | ```bash 19 | $ docker build -t cgwire/cgwire . # or sudo docker pull cgwire/cgwire 20 | $ docker run --init -ti --rm -p 80:80 -p 1080:1080 --name cgwire cgwire/cgwire 21 | ``` 22 | 23 | In order to enable data persistence, use a named volume for the database and thumbnails: 24 | 25 | ```bash 26 | $ docker run --init -ti --rm -p 80:80 -p 1080:1080 --name cgwire -v zou-storage:/var/lib/postgresql -v zou-storage:/opt/zou/previews cgwire/cgwire 27 | ``` 28 | 29 | To run the image as a daemon, add the `-d` flag: 30 | 31 | ```bash 32 | $ docker run --init -d --rm -p 80:80 -p 1080:1080 --name cgwire cgwire/cgwire 33 | ``` 34 | 35 | Kitsu credentials: 36 | 37 | * login: admin@example.com 38 | * password: mysecretpassword 39 | 40 | URL: 41 | 42 | Kitsu: [http://127.0.0.1:80/](http://127.0.0.1:80/) 43 | 44 | Internal webmail: [http://127.0.0.1:1080/](http://127.0.0.1:1080/) 45 | 46 | ### Update 47 | 48 | After updating the image, you have to update the database schema. For that run: 49 | 50 | ```bash 51 | $ docker exec -ti cgwire sh -c "/opt/zou/env/bin/zou upgrade-db" 52 | ``` 53 | 54 | ### Docker Compose 55 | 56 | `docker-compose.yml` 57 | --- 58 | ```yml 59 | services: 60 | cgwire: 61 | image: cgwire/cgwire:latest 62 | container_name: kitsu 63 | init: true 64 | tty: true 65 | stdin_open: true 66 | ports: 67 | - 8012:80 # Change the port 8012 to your desired port. 68 | - 1080:1080 69 | volumes: 70 | - zou-storage:/var/lib/postgresql 71 | - zou-storage:/opt/zou/previews 72 | 73 | volumes: 74 | zou-storage: 75 | driver: local 76 | driver_opts: 77 | type: 'none' 78 | o: 'bind' 79 | device: './zou-storage' 80 | ``` 81 | * Save this in a file and name it `docker-compose.yml`. 82 | * Create the folder `zou-storage` in the same folder as the `docker-compose.yml`. 83 | * Open the terminal in the same folder. 84 | * Run `docker compose up-d`. 85 | * Done...... (Hopefully 🤞🤞) 86 | 87 | Please test if the data is persisting after reboot or recreation. (Only tested in windows.) 88 | 89 | Also [an implementation by Mathieu Bouzard](https://gitlab.com/mathbou/docker-cgwire) 90 | is available. 91 | 92 | ### About authors 93 | 94 | This Dockerfile is written by CGWire, a company based in France. We help 95 | animation and VFX studios to collaborate better through efficient tooling. 96 | 97 | More than 100 studios around the world use Kitsu for their projects. 98 | 99 | Visit [cg-wire.com](https://cg-wire.com) for more information. 100 | 101 | [![CGWire Logo](https://zou.cg-wire.com/cgwire.png)](https://cgwire.com) 102 | -------------------------------------------------------------------------------- /docker/gunicorn-events.py: -------------------------------------------------------------------------------- 1 | accesslog = "/var/log/zou/gunicorn_events_access.log" 2 | errorlog = "/var/log/zou/gunicorn_events_error.log" 3 | workers = 1 4 | worker_class = "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" 5 | -------------------------------------------------------------------------------- /docker/gunicorn.py: -------------------------------------------------------------------------------- 1 | accesslog = "/var/log/zou/gunicorn_access.log" 2 | errorlog = "/var/log/zou/gunicorn_error.log" 3 | workers = 3 4 | worker_class = "gevent" 5 | timeout = 600 6 | -------------------------------------------------------------------------------- /docker/init_zou.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export LC_ALL=C.UTF-8 3 | export LANG=C.UTF-8 4 | 5 | service postgresql start 6 | service redis-server start 7 | 8 | . /opt/zou/env/bin/activate 9 | 10 | zou upgrade-db 11 | zou init-data 12 | zou create-admin admin@example.com --password mysecretpassword 13 | 14 | service postgresql stop 15 | service redis-server stop 16 | -------------------------------------------------------------------------------- /docker/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name 0.0.0.0; 4 | 5 | location /api { 6 | proxy_set_header X-Real-IP $remote_addr; 7 | proxy_set_header Host $host; 8 | proxy_pass http://localhost:5000/; 9 | 10 | client_max_body_size 1G; 11 | } 12 | 13 | location /socket.io { 14 | proxy_http_version 1.1; 15 | proxy_set_header Host $host; 16 | proxy_set_header X-Real-IP $remote_addr; 17 | proxy_set_header Upgrade $http_upgrade; 18 | proxy_set_header Connection "Upgrade"; 19 | proxy_pass http://localhost:5001; 20 | } 21 | 22 | location / { 23 | autoindex on; 24 | root /opt/zou/kitsu; 25 | try_files $uri $uri/ /index.html; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /docker/pg_ctl.conf: -------------------------------------------------------------------------------- 1 | # This configuration file contains cluster specific options to be passed to 2 | # pg_ctl(1). 3 | 4 | pg_ctl_options = '-w' 5 | -------------------------------------------------------------------------------- /docker/postgresql-log.conf: -------------------------------------------------------------------------------- 1 | # Keep 7 logs at the most 2 | log_directory = '/var/log/postgresql/' 3 | logging_collector = on 4 | log_filename = 'postgresql-%u.log' 5 | log_truncate_on_rotation = on 6 | -------------------------------------------------------------------------------- /docker/start_zou.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # create /var/run/postgresql 4 | . /usr/share/postgresql-common/init.d-functions 5 | create_socket_directory 6 | 7 | echo Running Zou... 8 | supervisord -c /etc/supervisord.conf 9 | -------------------------------------------------------------------------------- /docker/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon = True 3 | umask = 022 4 | 5 | [program:sendria] 6 | command=/usr/local/bin/sendria --smtp-ip 0.0.0.0 --smtp-port 25 --http-ip 0.0.0.0 --foreground --no-quit --no-clear --db /var/lib/sendria.sqlite 7 | user=root 8 | autostart=true 9 | autorestart=true 10 | stdout_logfile=/var/log/redis/sendria.log 11 | redirect_stderr=true 12 | priority=100 13 | 14 | [program:redis] 15 | # let supervisord handle logs, don't daemonize 16 | command=/usr/bin/redis-server /etc/redis/redis.conf --logfile '' --daemonize no 17 | user=root 18 | autostart=true 19 | autorestart=true 20 | stdout_logfile=/var/log/redis/redis-server.log 21 | redirect_stderr=true 22 | priority=100 23 | 24 | [program:postgresql] 25 | command=/usr/lib/postgresql/%(ENV_PG_VERSION)s/bin/postmaster --config-file=/etc/postgresql/%(ENV_PG_VERSION)s/main/postgresql.conf 26 | user=postgres 27 | autostart=true 28 | autorestart=true 29 | # forcefully disconnect all clients 30 | stopsignal=SIGINT 31 | stdout_logfile=/var/log/supervisor/postgresql.log 32 | redirect_stderr=true 33 | priority=100 34 | 35 | [program:nginx] 36 | command = nginx -g "daemon off;" 37 | autostart = true 38 | autorestart = true 39 | stopwaitsecs = 5 40 | stdout_logfile=/var/log/supervisor/nginx.log 41 | redirect_stderr=true 42 | 43 | [program:gunicorn] 44 | environment=PREVIEW_FOLDER=/opt/zou/previews,DB_USERNAME=root,DB_PASSWORD='' 45 | command=/opt/zou/env/bin/gunicorn -c /etc/zou/gunicorn.py -b 127.0.0.1:5000 --chdir /opt/zou/zou zou.app:app 46 | directory=/opt/zou 47 | autostart=true 48 | autorestart=true 49 | stdout_logfile=NONE 50 | stderr_logfile=NONE 51 | 52 | [program:gunicorn-events] 53 | command=/opt/zou/env/bin/gunicorn -c /etc/zou/gunicorn-events.py -b 127.0.0.1:5001 zou.event_stream:app 54 | directory=/opt/zou 55 | autostart=true 56 | autorestart=true 57 | stdout_logfile=NONE 58 | stderr_logfile=NONE 59 | 60 | [group:zou-processes] 61 | programs=gunicorn,gunicorn-events 62 | priority=5 63 | 64 | [unix_http_server] 65 | file=/tmp/supervisor.sock 66 | 67 | [supervisorctl] 68 | serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket 69 | 70 | [rpcinterface:supervisor] 71 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 72 | --------------------------------------------------------------------------------