Skip to content

Commit 6768501

Browse files
authored
Merge e66f9ee into 3ab9e1d
2 parents 3ab9e1d + e66f9ee commit 6768501

40 files changed

+1050
-1137
lines changed

.github/workflows/docker-build.yml

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,53 @@ on:
66
- master
77

88
env:
9-
ONECHAN_IMAGE_NAME: 1chan
9+
APP_IMAGE_NAME: app
1010
TORGATE_IMAGE_NAME: torgate
1111
I2PGATE_IMAGE_NAME: i2pgate
12-
YGGDRASILGATE_IMAGE_NAME: yggdrasil
12+
YGGDRASILGATE_IMAGE_NAME: yggdrasilgate
1313

1414
jobs:
15-
1615
buildDocker:
1716
runs-on: ubuntu-latest
1817
permissions:
1918
pull-requests: read
2019
packages: write
2120
steps:
22-
-
23-
name: Checkout
21+
- name: Checkout
2422
uses: actions/checkout@v4
25-
-
26-
name: Filter
23+
- name: Filter
2724
uses: tj-actions/changed-files@v46.0.5
2825
id: filter
2926
with:
3027
files_yaml: |
31-
onechan:
28+
app:
3229
- 'frontend/**'
3330
torgate:
3431
- 'torgate/**'
3532
i2pgate:
3633
- 'i2pgate/**'
3734
yggdrasilgate:
38-
- 'yggdrasil/**'
39-
-
40-
name: Set up QEMU
35+
- 'yggdrasilgate/**'
36+
- name: Set up QEMU
4137
uses: docker/setup-qemu-action@v3
42-
-
43-
name: Set up Docker Buildx
38+
- name: Set up Docker Buildx
4439
uses: docker/setup-buildx-action@v3
45-
-
46-
name: Log in to registry
40+
- name: Log in to registry
4741
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
4842

49-
-
50-
name: Build 1chan
43+
- name: Build 1chan
5144
uses: docker/build-push-action@v5
52-
if: steps.filter.outputs.onechan_any_changed == 'true'
45+
if: steps.filter.outputs.app_any_changed == 'true'
5346
with:
5447
context: frontend/.
5548
file: frontend/Dockerfile
5649
platforms: linux/amd64,linux/arm64
5750
push: true
58-
tags: ghcr.io/${{ github.repository }}/${{ env.ONECHAN_IMAGE_NAME }}:latest
51+
tags: ghcr.io/${{ github.repository }}/${{ env.APP_IMAGE_NAME }}:latest
5952
cache-from: type=gha
6053
cache-to: type=gha,mode=max
6154

62-
-
63-
name: Build torgate
55+
- name: Build torgate
6456
uses: docker/build-push-action@v5
6557
if: steps.filter.outputs.torgate_any_changed == 'true'
6658
with:
@@ -72,8 +64,7 @@ jobs:
7264
cache-from: type=gha
7365
cache-to: type=gha,mode=max
7466

75-
-
76-
name: Build i2pgate
67+
- name: Build i2pgate
7768
uses: docker/build-push-action@v5
7869
if: steps.filter.outputs.i2pgate_any_changed == 'true'
7970
with:
@@ -85,13 +76,12 @@ jobs:
8576
cache-from: type=gha
8677
cache-to: type=gha,mode=max
8778

88-
-
89-
name: Build yggdrasilgate
79+
- name: Build yggdrasilgate
9080
uses: docker/build-push-action@v5
9181
if: steps.filter.outputs.yggdrasilgate_any_changed == 'true'
9282
with:
93-
context: yggdrasil/.
94-
file: yggdrasil/Dockerfile
83+
context: yggdrasilgate/.
84+
file: yggdrasilgate/Dockerfile
9585
platforms: linux/amd64,linux/arm64
9686
push: true
9787
tags: ghcr.io/${{ github.repository }}/${{ env.YGGDRASILGATE_IMAGE_NAME }}:latest

.gitignore

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
!frontend
3-
!i2pgate
4-
!k8s
5-
!torgate
6-
!yggdrasil
7-
!.github
8-
!docker-compose.yaml
9-
!LICENSE
10-
!README.md
11-
!README_OLD.md
12-
!.env-dist
13-
!.gitignore
2+
!/frontend
3+
!/i2pgate
4+
!/k8s
5+
!/torgate
6+
!/yggdrasilgate
7+
!/.github
8+
!/docker-compose.yaml
9+
!/LICENSE
10+
!/README.md
11+
!/README_OLD.md
12+
!/.env-dist
13+
!/.gitignore

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,41 @@
99
### Docker compose way
1010

1111
#### 1. Prepare `.env`
12+
1213
```console
1314
cp .env-dist .env
1415
```
16+
1517
Then fill fields in `.env` by your text editor with needed values
1618

1719
You can create your own css themes or edit existing ones. Script will copy all css files which ends with `.example`. See in [/www/css/themes](https://github.com/katzterd/1chan-docker/tree/master/www/css/themes)
1820

1921
#### 2. Deploy
22+
2023
```console
2124
docker compose up -d
2225
```
2326

2427
#### 3. Setup db and admin account
28+
2529
```console
26-
docker exec -t onechan /docker-entrypoint.sh install
30+
docker exec -t app /docker-entrypoint.sh install
2731
```
2832

29-
#### 4. Restart `onechan` container to run indexer properly after db setup
33+
#### 4. Restart `app` container to run indexer properly after db setup
34+
3035
```console
31-
docker compose restart onechan
36+
docker compose restart app
3237
```
3338

3439
frontend will appear on `http://localhost:80`
3540

36-
37-
3841
#### (Optional) Get yggdrasil node address (if enabled)
42+
3943
```console
40-
docker exec -t yggdrasil /docker-entrypoint.sh getaddr
44+
docker exec -t yggdrasilgate /docker-entrypoint.sh getaddr
4145
```
4246

4347
### K8S way
48+
4449
See in [/k8s](https://github.com/katzterd/1chan/tree/master/k8s)

docker-compose.yaml

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
1-
services:
2-
3-
db:
4-
image: mariadb:11.6
5-
container_name: db
6-
ports:
7-
- "3306:3306"
8-
env_file:
9-
- .env
10-
environment:
11-
MARIADB_RANDOM_ROOT_PASSWORD: 1
12-
restart: always
13-
volumes:
14-
- mariadb_data:/var/lib/mysql
15-
networks:
16-
- 1chan
17-
18-
onechan:
1+
services:
2+
app:
193
build: ./frontend
20-
container_name: onechan
4+
container_name: app
215
restart: always
226
env_file:
237
- .env
@@ -27,7 +11,7 @@ services:
2711
SRV_HOST: "127.0.0.1"
2812
SRV_PORT: "9393"
2913
SRV_LOCAL_HOST: "127.0.0.1"
30-
REDIS_HOST: "redis"
14+
REDIS_HOST: "cache"
3115
REDIS_PORT: "6379"
3216
SPHINX_HOST: "127.0.0.1"
3317
SPHINX_PORT: "3312"
@@ -52,37 +36,63 @@ services:
5236
- 1chan
5337
depends_on:
5438
- db
55-
- redis
39+
- cache
40+
41+
db:
42+
image: mariadb:11.6
43+
container_name: db
44+
ports:
45+
- "3306:3306"
46+
env_file:
47+
- .env
48+
environment:
49+
MARIADB_RANDOM_ROOT_PASSWORD: 1
50+
restart: always
51+
volumes:
52+
- mariadb_data:/var/lib/mysql
53+
networks:
54+
- 1chan
55+
56+
cache:
57+
image: redis:7-alpine
58+
container_name: cache
59+
ports:
60+
- "6379:6379"
61+
restart: always
62+
volumes:
63+
- cache_data:/data
64+
networks:
65+
- 1chan
5666

5767
torgate:
5868
build: ./torgate
5969
container_name: torgate
6070
depends_on:
61-
onechan:
71+
app:
6272
condition: service_started
6373
restart: false
6474
env_file:
6575
- .env
6676
networks:
6777
- 1chan
68-
78+
6979
i2pgate:
7080
build: ./i2pgate
7181
container_name: i2pgate
7282
depends_on:
73-
onechan:
83+
app:
7484
condition: service_started
7585
restart: false
7686
env_file:
7787
- .env
7888
networks:
7989
- 1chan
80-
81-
yggdrasil:
82-
build: ./yggdrasil
83-
container_name: yggdrasil
90+
91+
yggdrasilgate:
92+
build: ./yggdrasilgate
93+
container_name: yggdrasilgate
8494
depends_on:
85-
onechan:
95+
app:
8696
condition: service_started
8797
restart: false
8898
env_file:
@@ -96,20 +106,9 @@ services:
96106
sysctls:
97107
- "net.ipv6.conf.all.disable_ipv6=0"
98108

99-
redis:
100-
image: redis:7-alpine
101-
container_name: redis
102-
ports:
103-
- "6379:6379"
104-
restart: always
105-
volumes:
106-
- redis_data:/data
107-
networks:
108-
- 1chan
109-
110109
volumes:
111110
mariadb_data:
112-
redis_data:
111+
cache_data:
113112
www-smilies:
114113
www-homeboards:
115114
www-uploads:

frontend/app/views/markup/index.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@
7272
</dd>
7373
</dl>
7474
<p>
75-
Кроме перечисленных тут кодов существуют еще несколько, но пускай это будет сюрпризом.
76-
Например, можно попробовать использовать списки.
75+
Кроме перечисленных тут кодов существуют еще <a href="https://texy.info/en/syntax-full">несколько</a>, но пускай это будет сюрпризом.
7776
</p>
7877
<p>
79-
Все смайлики: <?php echo $this -> getParameter('smilies'); ?>
78+
<h4>Все смайлики:</h4>
79+
<p>
80+
<?php echo $this -> getParameter('smilies'); ?>
81+
</p>
8082
</p>
8183
</div>
8284
</div>

i2pgate/supervisord.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ stdout_logfile_maxbytes=0
1010
stderr_logfile=/dev/stderr
1111
stderr_logfile_maxbytes=0
1212

13-
[program:onechan-forward]
14-
command=socat TCP4-LISTEN:8080,fork,forever,reuseaddr TCP4:onechan:80
13+
[program:app-forward]
14+
command=socat TCP4-LISTEN:8080,fork,forever,reuseaddr TCP4:app:80

k8s/.gitignore

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
*
2-
!examples
3-
!helm
4-
!README.md
5-
!.cr.yaml
6-
!encrypted_secrets.yaml
7-
!pub-sealed-secrets.pem
8-
!.env-dist
9-
!.gitignore
1+
/*
2+
!/helm
3+
!/README.md
4+
!/.cr.yaml
5+
!/.env-dist
6+
!/.gitignore

0 commit comments

Comments
 (0)