Skip to content

Thread parse script #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 235 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
7f18cc1
Merge pull request #1 from epochtalk/main
crod951 Nov 3, 2023
5f8945d
Merge remote-tracking branch 'origin/main' into btct_proxy
crod951 Nov 3, 2023
5ec8ebf
Merge pull request #2 from epochtalk/main
crod951 Dec 21, 2023
ebdc4ef
Merge remote-tracking branch 'origin/main' into btct_proxy
crod951 Dec 21, 2023
91f2d85
feat(proxy): Setting up proxy repo, supervisor and conversion code; A…
crod951 Dec 21, 2023
a6df7b4
feat(proxy): Use proxy to handle by_board route in threads controller
crod951 Dec 21, 2023
4f52451
feat(proxy): Use proxy to handle slug_to_id route in board controller
crod951 Dec 21, 2023
e5722f3
refactor(proxy): mix format updates
crod951 Dec 21, 2023
ad9ce95
feat(proxy-posts): Use proxy to handle slug_to_id route in thread con…
crod951 Dec 22, 2023
b66786f
feat(proxy-pagination): Added pagination handling for threads_by_boar…
crod951 Jan 9, 2024
e1c8cfd
Merge pull request #3 from slickage/btct_proxy
crod951 Jan 9, 2024
132311d
fix(format): Running mix format and removing any unused code
crod951 Jan 9, 2024
072b10d
Merge pull request #4 from slickage/btct_proxy
crod951 Jan 9, 2024
506cb0f
feat(smfrepo-config): Adding config info for smfrepo
crod951 Jan 9, 2024
2c48656
ci(docker.secret): add frontend configs
unenglishable Dec 19, 2023
de2f451
ci(docker.secret): configure redis and endpoint
unenglishable Dec 19, 2023
18ff5f4
ci(config/runtime): configure frontend
unenglishable Dec 20, 2023
01c5cc0
ci(config/docker): remove docker config
unenglishable Dec 20, 2023
39b9662
ci(config/runtime): fix ||
unenglishable Dec 20, 2023
04c9501
ci(config/runtime): set configurations for ses
unenglishable Dec 20, 2023
120ef18
style(config/runtime.exs): mix format
unenglishable Jan 9, 2024
d49c285
feat(runtime): setup config for smfrepo in runtime.exs to use environ…
crod951 Jan 9, 2024
7c43053
Merge pull request #6 from slickage/btct_proxy
crod951 Jan 9, 2024
e6239a0
fix(runtime): show sensitive data set to false
crod951 Jan 10, 2024
f75c42f
Merge remote-tracking branch 'origin/main' into btct_proxy
crod951 Jan 10, 2024
2c53a19
fix(smfrepo-supervisor): removed proxy supervisor call, moved startin…
crod951 Jan 10, 2024
f48f5fa
Merge pull request #7 from slickage/btct_proxy
crod951 Jan 10, 2024
a090366
fix(proxy-conversion): Added is_proxy flag to threads; Removed unused…
crod951 Jan 10, 2024
33ffd22
refactor(proxy-conversion): removed unused genserver code
crod951 Jan 10, 2024
e97fac8
Merge pull request #8 from slickage/btct_proxy
crod951 Jan 10, 2024
ddd04f5
refactor(smfrepo): Removed SmfRepo from application.ex; Added ProxySu…
crod951 Jan 10, 2024
747b084
Merge pull request #9 from slickage/btct_proxy
crod951 Jan 10, 2024
2377786
fix(runtime): pipe String.to_integer() for port env
crod951 Jan 11, 2024
269cc1a
refactor(env): Use application.get_env for board and thread seq env v…
crod951 Jan 11, 2024
13bae3e
Merge pull request #10 from slickage/btct_proxy
crod951 Jan 11, 2024
c7554da
fix(dev): Parse port env variable as integer
crod951 Jan 12, 2024
30be85f
fix(runtime): Increased pool_size for smf_repo to help with connectio…
crod951 Jan 12, 2024
a28bf1a
Merge remote-tracking branch 'origin/main' into btct_proxy
crod951 Jan 12, 2024
2215475
refactor(proxy): Added .env to gitignore; Added moduledocs to new mod…
crod951 Jan 12, 2024
3012aaa
refactor(config): Set all SmfRepo config values to pull from env vari…
crod951 Jan 12, 2024
91c85b0
refactor(post-controller): Use application.get_env for threads_seq en…
crod951 Jan 12, 2024
7783b09
Merge pull request #11 from slickage/btct_proxy
unenglishable Jan 16, 2024
d6b532a
fix(config/dev.exs): set default values for PORT and POOL_SIZE
unenglishable Jan 17, 2024
dfaf0f2
ci(Dockerfile): only add mix deps/lock before running mix deps.get
unenglishable Jan 17, 2024
ec48acb
fix(config/runtime.exs): set default values for PORT and POOL_SIZE
unenglishable Jan 25, 2024
3b4c551
refactor(config/runtime): configure port and pool size inside of Stri…
unenglishable Jan 26, 2024
413ada3
feat(helpers/proxy_conversion): blacklist boards
unenglishable Jan 26, 2024
93d48c1
refactor(helpers/proxy_conversion): omit posterEmail from query
unenglishable Feb 2, 2024
7c9c702
feat(proxy_conversion.build_threads): integrate first/last post query…
unenglishable Feb 20, 2024
135ff86
feat(proxy_conversion.build_threads_by_board): integrate first/last p…
unenglishable Feb 20, 2024
4871f44
Merge branch 'query-performance'
unenglishable Feb 20, 2024
39fd2f6
fix(proxy_conversion): re-add is_proxy to build_threads_by_board
unenglishable Feb 20, 2024
d9e8712
Merge branch 'query-performance'
unenglishable Feb 20, 2024
4cf4024
ci(config/runtime): allow logger level definition in env
unenglishable Feb 21, 2024
e11dc8b
fix(helpers/proxy_conversion): use return_tuple in by_thread
unenglishable Feb 23, 2024
931797e
Merge branch 'query-performance'
unenglishable Feb 23, 2024
395041e
feat(porcelain): add porcelain as dependency to run external command …
akinsey May 16, 2024
3c830a7
feat(bbcode-parse-route): add skeleton route for bbcode parser
akinsey May 17, 2024
9b000f9
refactor(bbcode-parser): wip test porcelain shell attempting to run p…
akinsey May 17, 2024
5f647fa
feat(bbcode-parser): add skeleton to run php script for bbcode parser…
akinsey May 21, 2024
4ec5927
refactor(bbcode-parser): wip port bbcode parser
akinsey May 22, 2024
5088ca0
refactor(bbcode-parser): wip comment out code until parser runs
akinsey May 24, 2024
65a9ecb
refactor(wip-bbcode): partially working bbcode parser
akinsey May 28, 2024
d13c167
Merge remote-tracking branch 'origin/main' into legacy-bbcode-parser
akinsey May 28, 2024
f6ef7c9
refactor(wip-bbcode): escape single quote for php bbcode script input
akinsey May 28, 2024
9eb8e30
fix(bbcode): no auth for bbcode parser
akinsey May 29, 2024
60829c6
Merge remote-tracking branch 'real/main'
unenglishable May 30, 2024
2ed644f
Merge remote-tracking branch 'real/legacy-bbcode-parser'
unenglishable May 30, 2024
af54a8e
refactor(wip-parser): wip implement parser for legacy bbcode
akinsey Jun 11, 2024
d7a3a69
Merge remote-tracking branch 'real/legacy-bbcode-parser'
unenglishable Jun 11, 2024
2c381e7
ci(dockerfile): install php
unenglishable Jun 11, 2024
6b82b5f
Merge remote-tracking branch 'real/legacy-bbcode-parser'
unenglishable Jun 11, 2024
9018fd2
ci(dockerfile): -y tho
unenglishable Jun 11, 2024
d62e949
Merge remote-tracking branch 'real/legacy-bbcode-parser'
unenglishable Jun 11, 2024
9f6f4d8
fix(json/post:by_thread_proxy): convert singular post to list
unenglishable Jun 12, 2024
c89b329
fix(json/post:by_thread_proxy): remove !
unenglishable Jun 12, 2024
b5dbccb
fix(bbcode-parser): use smileys and increase max input length
akinsey Jun 13, 2024
b00dbe7
Merge remote-tracking branch 'real/legacy-bbcode-parser'
unenglishable Jun 13, 2024
0b40270
fix(json/post:by_thread_proxy): add else case for post list conversion
unenglishable Jun 13, 2024
33d37ee
refactor(parser): move parsing code out of controller/route and direc…
akinsey Jun 17, 2024
247a3c3
Merge pull request #15 from slickage/parser
unenglishable Jun 26, 2024
b489577
fix(config/runtime): cast system env values to bool
unenglishable Jul 18, 2024
a1cf2ec
Merge remote-tracking branch 'real/main'
unenglishable Aug 16, 2024
1da71dd
yolo(config/runtime): add issuer to prod config
unenglishable Aug 16, 2024
e3453e9
Merge remote-tracking branch 'real/main'
unenglishable Aug 26, 2024
4184009
Merge branch 'epochtalk:main' into main
unenglishable Sep 10, 2024
24a061c
Merge pull request #17 from epochtalk/main
unenglishable Sep 24, 2024
2240cb1
feat(smf_loader): add smf_loader
unenglishable Sep 18, 2024
029e7cd
refactor(smf_loader): trim lines before splitting them
unenglishable Sep 18, 2024
f590b8f
feat(smf_loader): map boards from smf to epochtalk format
unenglishable Sep 24, 2024
ad1c071
feat(smf_loader): implement tabulate_boards_map
unenglishable Sep 24, 2024
4c917be
feat(smf_loader): write data to tsv file
unenglishable Sep 24, 2024
b719af7
feat(smf_loader): use tsv file parser/converter/writer in convert_smf…
unenglishable Sep 24, 2024
c615bdd
feat(mix): add recase to deps
unenglishable Sep 24, 2024
180fd2b
feat(smf_loader): process board mappings with boards and return
unenglishable Sep 24, 2024
6de12cf
fix(smf_loader): switch file import mode for boards from Stream to Fi…
unenglishable Sep 25, 2024
7b24ef8
fix(smf_loader): decode html entities in board name and description
unenglishable Sep 25, 2024
431bc7a
feat(smf_loader): implement categories mappings
unenglishable Sep 25, 2024
7e94c0b
refactor(smf_loader): remove recase as dependency
unenglishable Sep 25, 2024
bd595d8
Merge remote-tracking branch 'boka/smf'
unenglishable Sep 25, 2024
80d48a8
feat(recent-thread-proxy): implement proxy for recent threads
akinsey Sep 27, 2024
120605d
fix(config): Fix error with missing id_board_blacklist
crod951 Sep 27, 2024
ef30629
refactor(dev): Refactored port and pool_size function
crod951 Sep 27, 2024
564b290
feat(user-avatars): Added functionality to pull user-avatars from pro…
crod951 Sep 27, 2024
40f42a2
Merge pull request #18 from slickage/user-avatars
akinsey Sep 27, 2024
69d28f7
fix(recent-threads): add json for recent threads, remove unneeded params
akinsey Sep 27, 2024
507571f
Merge pull request #19 from slickage/recent-threads
crod951 Sep 27, 2024
73dac84
feat(smf_loader): replace "/" in board slug with "-"
unenglishable Oct 2, 2024
85e1e6d
feat(smf-polls): query poll data from smf with threads
akinsey Oct 3, 2024
b134fd7
fix(long-post-query): order by id_msg instead of poster time to speed…
akinsey Oct 3, 2024
14fa2e2
fix(parser-variables): add missing brower check variables for bbcode …
akinsey Oct 3, 2024
974bcec
refactor(polls): update variable name
akinsey Oct 3, 2024
be491f0
Merge remote-tracking branch 'origin/polls' into signatures
akinsey Oct 3, 2024
2c98405
feat(helpers/proxy_conversion): build board counts from smf data
unenglishable Oct 4, 2024
7fcbce7
feat(controllers/board): implement proxy_by_category and use board_co…
unenglishable Oct 4, 2024
d19ac53
feat(json/board): stitch in board thread/post counts on render in pro…
unenglishable Oct 4, 2024
6c8e768
style(json/thread): lastest -> latest
unenglishable Oct 4, 2024
6698019
feat(helpers/proxy_conversion): build board_last_post_info from smf q…
unenglishable Oct 4, 2024
d59639c
feat(controllers/board): load board_last_post_info
unenglishable Oct 4, 2024
8cb3eda
refactor(json/board): extract functionality to map query return to mo…
unenglishable Oct 4, 2024
2cf1d78
refactor(json/board): use map merge instead of loading by key
unenglishable Oct 4, 2024
7c2feb1
feat(json/board): append smf proxy last post info to boards
unenglishable Oct 4, 2024
93e8fb7
feat(signatures): implement signatures and merit and activity
akinsey Oct 4, 2024
57abab3
Merge pull request #20 from slickage/polls
unenglishable Oct 4, 2024
7ecf630
Merge pull request #21 from slickage/typo-fix
akinsey Oct 4, 2024
2058c98
Merge remote-tracking branch 'origin/main' into signatures
akinsey Oct 4, 2024
9678119
Merge pull request #24 from slickage/signatures
unenglishable Oct 4, 2024
b504365
Merge pull request #22 from slickage/smf
akinsey Oct 4, 2024
56e07a2
Merge pull request #23 from slickage/board-metadata
akinsey Oct 4, 2024
d41750c
fix(post-avatars): Fixed avatars not loading for last post on thread …
crod951 Oct 10, 2024
f18e58d
refactor(breadcrumbs): use proxy to build breadcrumbs for threads
crod951 Oct 10, 2024
23f0cc8
refactor(proxy-conversion): refactored some proxy_conversion function…
crod951 Oct 11, 2024
13ee899
refactor(child-boards): refactored proxy_by_board() and proxy_by_thre…
crod951 Oct 11, 2024
8a91cf3
Merge pull request #25 from slickage/avatars
akinsey Oct 11, 2024
255b0f8
Merge pull request #26 from slickage/breadcrumbs
akinsey Oct 11, 2024
1f7b491
Merge pull request #27 from slickage/child-boards
akinsey Oct 11, 2024
ebad48b
fix(breadcrumbs): fixing errors with breadcrumbs after child-boards m…
crod951 Oct 11, 2024
a7524a0
fix(breadcrumbs): refactor thread breadcrumbs
crod951 Oct 11, 2024
594e029
Merge remote-tracking branch 'real/main'
unenglishable Oct 15, 2024
7241ee4
ci(github/workflows/main): remove test and release tasks
unenglishable Oct 17, 2024
7b73724
style(): mix format
unenglishable Oct 17, 2024
1b23033
refactor(smf_loader): add module doc
unenglishable Oct 17, 2024
6f6c3c2
refactor(controllers/thread): split check_proxy, match on action
unenglishable Oct 17, 2024
d2e7ce7
style(controllers/thread): mix format
unenglishable Oct 17, 2024
1bce199
refactor(config): re-consolidate proxy configs
unenglishable Oct 17, 2024
ec3eb15
refactor(application): remove smf repo from supervisor tree in :test env
unenglishable Oct 17, 2024
0a6fe89
style(): mix format
unenglishable Oct 17, 2024
327bb1b
Merge branch 'refactor-configs' into ci
unenglishable Oct 18, 2024
9392713
refactor(config/dev): remove config for smf repo
unenglishable Oct 18, 2024
dec9e3a
Merge branch 'refactor-configs' into ci
unenglishable Oct 18, 2024
8d82eb4
refactor(config/runtime): use convenience methods for loading env var…
unenglishable Oct 18, 2024
41633e7
Merge branch 'refactor-configs' into ci
unenglishable Oct 18, 2024
a969a71
refactor(config/runtime): modify board/thread seq to start at -10 for…
unenglishable Oct 18, 2024
ff97c47
refactor(controllers/board): check boards seq in proxy :by_category
unenglishable Oct 18, 2024
b5a6d91
fix(json/board_json): remove proxy options from non proxy :by_category
unenglishable Oct 18, 2024
645a364
Merge remote-tracking branch 'real/main'
akinsey Oct 18, 2024
6cea787
Merge remote-tracking branch 'real/main'
akinsey Oct 21, 2024
1a8bfe7
fix(static-testing): resolve issues with credo and formatting for tes…
akinsey Oct 22, 2024
fa6bfe5
feat(user-find): initial db query for user find, updated to query by …
akinsey Oct 22, 2024
f11ff6e
feat(user-find-route): implement initial route for user find proxy
akinsey Oct 23, 2024
d698369
ci(github/workflows/main): add build and push image step
unenglishable Oct 23, 2024
96a165e
ci(github/workflows/main): depend on static analysis before pushing t…
unenglishable Oct 23, 2024
fe66fd8
ci(github/workflows/main): update action versions (add v)
unenglishable Oct 23, 2024
a1ff657
fix(helpers/breadcrumbs): return correctly for nonexistant thread
unenglishable Oct 24, 2024
31da5bd
style(helpers/breadcrumbs): mix format
unenglishable Oct 24, 2024
12d4d06
ci(github/workflows/main): re-enable test job
unenglishable Oct 24, 2024
18cd1bc
Merge commit '6cea787' into ci
unenglishable Oct 24, 2024
718cca8
Revert "fix(static-testing): resolve issues with credo and formatting…
unenglishable Oct 24, 2024
ffd6975
ci(github/workflows/main): depend on test before build and push
unenglishable Oct 24, 2024
30a4e19
feat(profile): bring back user id in last post info for linking to pr…
akinsey Oct 24, 2024
ebdb77c
feat(posts-by-username): implement db query for posts by username proxy
akinsey Oct 25, 2024
727bf89
Merge pull request #28 from slickage/ci
akinsey Oct 25, 2024
9c4a64a
Merge remote-tracking branch 'origin/main' into profile
akinsey Oct 28, 2024
bd247d8
feat(post-by-username): route for post by username
akinsey Oct 28, 2024
e9a3a74
Revert "fix(json/board_json): remove proxy options from non proxy :by…
unenglishable Oct 29, 2024
aa16630
fix(json/board): handle base case for test
unenglishable Oct 29, 2024
f141bdf
refactor(post-by-username): remove unneeded error check
akinsey Oct 29, 2024
6f414bc
feat(thread-by-username): initial implementation of thread by usernam…
akinsey Oct 29, 2024
3dd381d
Merge pull request #29 from slickage/boards-last-post-fix
akinsey Oct 29, 2024
e48300b
Merge remote-tracking branch 'origin/main' into profile
akinsey Oct 29, 2024
bf3d726
yolo(parser): poolboy parser implementation wip
akinsey Oct 31, 2024
b043e7a
fix(bbcode_parser): check for empty string before running bbcode parser
unenglishable Oct 31, 2024
e271bf8
feat(upgrade-elixir): upgrade to latest elixir
akinsey Nov 1, 2024
b3de482
refactor(bbc-parser): clean up bbcode parser gen server
akinsey Nov 1, 2024
e8bddb4
refactor(general): update code syntax for latest elixir updatE
akinsey Nov 1, 2024
163ad43
style(format): run mix format
akinsey Nov 1, 2024
3d18378
fix(user-find): bring back missing user avatar
akinsey Nov 4, 2024
9f94b85
fix(last-post-user-id): bring back last post user id for linking to u…
akinsey Nov 4, 2024
e282db0
fix(proxy-pagination): fix for prev/next style pagination when there …
akinsey Nov 4, 2024
144b3a4
feat(parser): user async parser for signature, code cleanup
akinsey Nov 4, 2024
4a80097
fix(parser): add missing settings that were causing portuguese charac…
akinsey Nov 4, 2024
c0cb6db
feat(credo): upgrade credo to latest
akinsey Nov 4, 2024
7a41e9a
fix(credo): resolve credo issues in bbc parser
akinsey Nov 4, 2024
8cde747
Merge remote-tracking branch 'origin/bbc-parser' into user-find
akinsey Nov 4, 2024
f618c32
feat(last-active): bring back last post date for last active in user …
akinsey Nov 5, 2024
9bace91
refactor(cleanup): use BBCParser Gen Server for parsing user signatur…
akinsey Nov 7, 2024
8af4e0a
feat(gender): calculate gender for user find proxy
akinsey Nov 7, 2024
94157d7
feat(dob): calculate dob for user find proxy
akinsey Nov 7, 2024
ea39654
feat(thread-view): load metadata for child boards
unenglishable Nov 11, 2024
a0948d9
fix(thread-view): re-add original format_board_data_for_find
unenglishable Nov 11, 2024
d9213e6
style(board_json): mix format
unenglishable Nov 12, 2024
72e7857
Merge pull request #30 from slickage/thread-view-board-meta
akinsey Nov 12, 2024
a5af549
test(static): resolve dialyzer errors after upgrade of elixir/erlang
akinsey Nov 12, 2024
d8dbf14
feat(user-find): convert gender and dob into human readable format
akinsey Nov 12, 2024
42f7e3d
Merge remote-tracking branch 'origin/main' into user-find
akinsey Nov 12, 2024
e09340f
test(warnings): resolve test warnings
akinsey Nov 12, 2024
b9cefea
feat(last-active): implement last active, respecting flag showOnline …
akinsey Nov 14, 2024
dfd0a30
fix(last-login): use users last login instead of test value, resolve …
akinsey Nov 14, 2024
0068cf4
refactor(user-find): move manipulation of user object into user_json …
akinsey Nov 14, 2024
1bdd8b6
fix(credo): resolve credo error with user_json
akinsey Nov 14, 2024
99ab836
feat(docker): upgrade elixir version in docker file
akinsey Nov 14, 2024
755640e
feat(board-moderators): Added query to get moderators for all boards …
crod951 Nov 15, 2024
1741f4e
feat(helpers/proxy_conversion): load board last post user avatar
unenglishable Nov 15, 2024
015ac7f
Merge pull request #33 from slickage/board-last-post-avatar
akinsey Nov 15, 2024
40044b4
refactor(config): poolboy_config -> bbc_parser_poolboy_config
unenglishable Nov 15, 2024
dc41123
refactor(bbc_parser): reduce bbc parser php call timeout to 1 second
unenglishable Nov 15, 2024
d0f1a03
style(application): mix format
unenglishable Nov 15, 2024
393278e
Merge branch 'main' into user-find
unenglishable Nov 15, 2024
17baed6
Merge pull request #31 from slickage/user-find
unenglishable Nov 15, 2024
92640e3
Merge remote-tracking branch 'origin/main' into board-moderators
crod951 Nov 15, 2024
e1a8e05
Merge pull request #32 from slickage/board-moderators
akinsey Nov 15, 2024
d976b9d
fix(moderators): Changed to inner join to return only matched values …
crod951 Nov 15, 2024
2b31633
Merge pull request #34 from slickage/moderators-fix
akinsey Nov 15, 2024
2f01aa0
refactor(bbc_parser): async_parse -> parse
unenglishable Nov 18, 2024
2f0d80c
refactor(bbc_parser): return unparsed bbcode on poolboy error
unenglishable Nov 18, 2024
e811005
fix(bbc_parser): handle hanging in genserver parse call
unenglishable Nov 18, 2024
d911e38
fix(bbc_parser): use {:ok, data} format for empty string case
unenglishable Nov 18, 2024
a0e701d
refactor(config/runtime): increase bbcode parser pool size to 50
unenglishable Nov 18, 2024
6e48d6d
style(bbc_parser): mix format
unenglishable Nov 18, 2024
19445ab
fix(parser): resolve issue with with posts ending in backslashes caus…
akinsey Nov 22, 2024
bf28bb0
fix(format): run formatter
akinsey Nov 22, 2024
22fa521
Merge remote-tracking branch 'real/main'
unenglishable Dec 6, 2024
e73fffc
fix(controllers/user): remove {:auth, false} case from logout
unenglishable Dec 6, 2024
288e215
feat(script): implement script to sequentially hit by thread route an…
akinsey Dec 13, 2024
8f51391
fix(format): resolve error caused by format
akinsey Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 84 additions & 39 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
branches:
- main

# env settings for github releases
# docker image push
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
dependencies:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -162,44 +168,83 @@ jobs:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
release:
needs: [test, static_code_analysis]
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.6.0
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4.0.0
with:
branches: |
[
'main',
{
name: 'prerelease',
prerelease: true
},
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
elixir_docs:
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/elixir-docs' }}
name: Generate project documentation
# release:
# needs: [test, static_code_analysis]
# name: Release
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3.6.0
# - name: Semantic Release
# uses: cycjimmy/semantic-release-action@v4.0.0
# with:
# branches: |
# [
# 'main',
# {
# name: 'prerelease',
# prerelease: true
# },
# ]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# elixir_docs:
# if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/elixir-docs' }}
# name: Generate project documentation
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3.6.0
# - name: Sets up an Erlang/OTP environment
# uses: erlef/setup-beam@v1
# with:
# version-file: .tool-versions
# version-type: strict
# - name: Build docs
# uses: lee-dohm/generate-elixir-docs@v1.0.1
# - name: Publish to Pages
# uses: peaceiris/actions-gh-pages@v3.9.3
# with:
# deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
# external_repository: epochtalk/server.epochtalk.github.io
# publish_dir: ./doc
# publish_branch: gh-pages

# build and push image to github container registry
build-and-push-image:
needs: [static_code_analysis, test]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3.6.0
- name: Sets up an Erlang/OTP environment
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- name: Build docs
uses: lee-dohm/generate-elixir-docs@v1.0.1
- name: Publish to Pages
uses: peaceiris/actions-gh-pages@v3.9.3
with:
deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
external_repository: epochtalk/server.epochtalk.github.io
publish_dir: ./doc
publish_branch: gh-pages
- name: Checkout repository
uses: actions/checkout@v4.2.1
- name: Log in to the Container registry
uses: docker/login-action@v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6.9.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1.4.3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ priv/repo/seeds/permissions.json

# Ignore secret config files
config/*.secret.exs

#Ignore env file
/.env
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
elixir 1.17.3-otp-27
erlang 27.1.2
php 8.3.7
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
FROM elixir:1.14.0
FROM elixir:1.17.3
# install php
RUN curl -sSL https://packages.sury.org/php/README.txt | bash -x
RUN apt update
RUN apt install -y php8.3

# work in /app instead of /
RUN mkdir -p /app
WORKDIR /app
RUN mix local.hex --force
RUN mix local.rebar --force
ADD . .
RUN mix deps.get

# compile for production
ENV MIX_ENV=prod
COPY mix.exs .
COPY mix.lock .
RUN mix deps.get
COPY . .
RUN mix compile

CMD until mix ecto.setup; do sleep 1; done
4 changes: 4 additions & 0 deletions bbcode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
var_dump($argc); //number of arguments passed
var_dump($argv); //the arguments passed
?>
3 changes: 3 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import Config
# Set ecto repos
config :epochtalk_server, ecto_repos: [EpochtalkServer.Repo]

# Configure Porcelain
config :porcelain, driver: Porcelain.Driver.Basic

# Set Guardian.DB to GuardianRedis
config :guardian, Guardian.DB, repo: GuardianRedis.Repo

Expand Down
121 changes: 121 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,124 @@ if config_env() == :prod do
port: get_env_cast_integer_with_default.("EMAILER_SMTP_PORT", "465")
end
end

##### PROXY REPO CONFIGURATIONS #####

bbc_parser_poolboy_config = [
name: {:local, :bbc_parser},
worker_module: EpochtalkServer.BBCParser,
size: 50,
max_overflow: 2,
strategy: :fifo
]

config :epochtalk_server, bbc_parser_poolboy_config: bbc_parser_poolboy_config

# conditionally show debug logs in prod
if config_env() == :prod do
logger_level =
System.get_env("LOGGER_LEVEL")
|> case do
"DEBUG" -> :debug
_ -> :info
end

config :logger, level: logger_level
end

# Configure proxy sequences and boards blacklist
proxy_config =
case config_env() do
:prod ->
id_board_blacklist =
get_env_or_raise_with_message.(
"ID_BOARD_BLACKLIST",
"environment variable ID_BOARD_BLACKLIST is missing."
)

id_board_blacklist =
id_board_blacklist
|> String.split()
|> Enum.map(&String.to_integer(&1))

%{
threads_seq: System.get_env("THREADS_SEQ") || "6000000",
boards_seq: System.get_env("BOARDS_SEQ") || "500",
id_board_blacklist: id_board_blacklist
}

:dev ->
%{
threads_seq: "6000000",
boards_seq: "500",
id_board_blacklist: []
}

# default thread/board seq and empty blacklist
_ ->
%{
threads_seq: "-10",
boards_seq: "-10",
id_board_blacklist: []
}
end

config :epochtalk_server, proxy_config: proxy_config

# Configure SmfRepo for proxy
# - do not configure for testing
if config_env() != :test do
smf_repo_username =
get_env_or_raise_with_message.(
"SMF_REPO_USERNAME",
"environment variable SMF_REPO_USERNAME is missing."
)

smf_repo_password =
get_env_or_raise_with_message.(
"SMF_REPO_PASSWORD",
"environment variable SMF_REPO_PASSWORD is missing."
)

smf_repo_hostname =
get_env_or_raise_with_message.(
"SMF_REPO_HOSTNAME",
"environment variable SMF_REPO_HOSTNAME is missing."
)

smf_repo_database =
get_env_or_raise_with_message.(
"SMF_REPO_DATABASE",
"environment variable SMF_REPO_DATABASE is missing."
)

proxy_repo_config =
case config_env() do
:prod ->
[
username: smf_repo_username,
password: smf_repo_password,
hostname: smf_repo_hostname,
database: smf_repo_database,
port: get_env_cast_integer_with_default.("SMF_REPO_PORT", "3306"),
stacktrace: get_env_cast_bool_with_default.("SMF_REPO_STACKTRACE", "TRUE"),
show_sensitive_data_on_connection_error:
get_env_cast_bool_with_default.("SMF_REPO_SENSITIVE_DATA_ON_ERROR", "FALSE"),
pool_size: get_env_cast_integer_with_default.("SMF_REPO_POOL_SIZE", "10")
]

_ ->
[
username: smf_repo_username,
password: smf_repo_password,
hostname: smf_repo_hostname,
database: smf_repo_database,
port: get_env_cast_integer_with_default.("SMF_REPO_PORT", "3306"),
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: get_env_cast_integer_with_default.("SMF_REPO_POOL_SIZE", "10")
]
end

config :epochtalk_server, EpochtalkServer.SmfRepo, proxy_repo_config
end
25 changes: 17 additions & 8 deletions lib/epochtalk_server/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ defmodule EpochtalkServer.Application do
{Redix, host: redix_config()[:host], name: redix_config()[:name]},
# Start the Ecto repository
EpochtalkServer.Repo,
# Start the Smf repository
EpochtalkServer.SmfRepo,
# Start the BBC Parser
:poolboy.child_spec(:bbc_parser, bbc_parser_poolboy_config()),
# Start Role Cache
EpochtalkServer.Cache.Role,
# Warm frontend_config variable (referenced by api controllers)
Expand All @@ -38,15 +42,17 @@ defmodule EpochtalkServer.Application do
# {EpochtalkServer.Worker, arg}
]

# don't run config_warmer during tests
# adjust supervised processes for testing
children =
if Application.get_env(:epochtalk_server, :env) == :test,
do:
List.delete(
children,
{Task, &EpochtalkServer.Models.Configuration.warm_frontend_config/0}
),
else: children
if Application.get_env(:epochtalk_server, :env) == :test do
children
# don't run config warmer during tests
|> List.delete({Task, &EpochtalkServer.Models.Configuration.warm_frontend_config/0})
# don't run SmfRepo during tests
|> List.delete(EpochtalkServer.SmfRepo)
else
children
end

# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
Expand All @@ -64,4 +70,7 @@ defmodule EpochtalkServer.Application do

# fetch redix config
defp redix_config(), do: Application.get_env(:epochtalk_server, :redix)

defp bbc_parser_poolboy_config,
do: Application.get_env(:epochtalk_server, :bbc_parser_poolboy_config)
end
Loading
Loading