diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index f79d6ed..0c12830 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - # dependencies /node_modules /.pnp @@ -8,17 +6,6 @@ # testing /coverage -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - # debug npm-debug.log* yarn-debug.log* @@ -30,16 +17,15 @@ yarn-error.log* .env.test.local .env.production.local -# vercel -.vercel +# build outputs +package-lock.json +dist/ +target/ +# common artifact extensions **/*.trace **/*.zip **/*.tar.gz **/*.tgz **/*.log -package-lock.json **/*.bun - -dist/ -target/ diff --git a/.goosehints b/.goosehints old mode 100644 new mode 100755 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml old mode 100644 new mode 100755 diff --git a/.prettierrc.json b/.prettierrc.json old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/ansible/deploy.yml b/ansible/deploy.yml new file mode 100755 index 0000000..c7b5734 --- /dev/null +++ b/ansible/deploy.yml @@ -0,0 +1,84 @@ +--- +- name: Deploy gomoku project + hosts: all + become: yes + vars: + app_user: 'gomoku' + app_home: '/home/{{ app_user }}' + + tasks: + - name: Ensure user exists + user: + name: '{{ app_user }}' + shell: /bin/bash + create_home: yes + home: '{{ app_home }}' + + - name: Create data directory + file: + path: '{{ app_home }}/public' + state: directory + owner: '{{ app_user }}' + group: '{{ app_user }}' + + - name: Copy binary to target location + copy: + src: ../target/gomoku + dest: '{{ app_home }}/gomoku' + owner: '{{ app_user }}' + group: '{{ app_user }}' + mode: '0755' + + - name: Copy data directory + synchronize: + src: ../public/ + dest: '{{ app_home }}/public/' + recursive: yes + owner: no + group: no + archive: yes + delete: yes + + - name: Ensure Caddy directory exists + file: + path: /etc/caddy/sites + state: directory + + - name: Copy Caddy configuration + copy: + src: gomoku.caddy + dest: /etc/caddy/sites/gomoku.caddy + owner: root + group: root + mode: '0644' + register: caddy_config_copy + + - name: Restart Caddy service if config changed + systemd: + name: caddy + state: restarted + daemon_reload: yes + when: caddy_config_copy.changed + + - name: Ensure Supervisor directory exists + file: + path: /etc/supervisor/conf.d + state: directory + + - name: Copy Supervisor configuration + copy: + src: gomoku.supervisor + dest: /etc/supervisor/conf.d/gomoku.conf + owner: root + group: root + mode: '0644' + + - name: Reload Supervisor + supervisorctl: + name: gomoku + state: present + + - name: Restart the service + supervisorctl: + name: gomoku + state: restarted diff --git a/ansible/gomoku.caddy b/ansible/gomoku.caddy new file mode 100755 index 0000000..794590f --- /dev/null +++ b/ansible/gomoku.caddy @@ -0,0 +1,3 @@ +gomoku.sepiatones.xyz { + reverse_proxy localhost:3002 +} diff --git a/ansible/gomoku.supervisor b/ansible/gomoku.supervisor new file mode 100755 index 0000000..f5e5b3a --- /dev/null +++ b/ansible/gomoku.supervisor @@ -0,0 +1,10 @@ +[program:gomoku] +command=/home/gomoku/gomoku +directory=/home/gomoku +user=gomoku +autostart=true +autorestart=true +startretries=3 +stderr_logfile=/var/log/supervisor/gomoku.err.log +stdout_logfile=/var/log/supervisor/gomoku.out.log +environment=PORT=3002 diff --git a/ansible/hosts.ini b/ansible/hosts.ini new file mode 100755 index 0000000..2a3e189 --- /dev/null +++ b/ansible/hosts.ini @@ -0,0 +1,3 @@ +# It is expected that you have sepiatonesxyz defined in your .ssh/config +[production] +sepiatonesxyz ansible_host=sepiatonesxyz ansible_python_interpreter=/usr/bin/python3.11 diff --git a/justfile b/justfile old mode 100644 new mode 100755 index 601b4af..0e5ff4b --- a/justfile +++ b/justfile @@ -8,7 +8,7 @@ build: bun build --compile --minify --target bun --outfile ./target/gomoku ./src/index.ts deploy: build - rsync -avz target/gomoku sepiatonesxyz:~/gomoku + ansible-playbook -i ansible/hosts.ini ansible/deploy.yml test: bun test diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/public/icons/accept.svg b/public/icons/accept.svg old mode 100644 new mode 100755 diff --git a/public/icons/decline.svg b/public/icons/decline.svg old mode 100644 new mode 100755 diff --git a/public/icons/draw.svg b/public/icons/draw.svg old mode 100644 new mode 100755 diff --git a/public/icons/heart.svg b/public/icons/heart.svg deleted file mode 100755 index 611c11e..0000000 --- a/public/icons/heart.svg +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/public/icons/resign.svg b/public/icons/resign.svg old mode 100644 new mode 100755 diff --git a/public/icons/rotate-right.svg b/public/icons/rotate-right.svg old mode 100644 new mode 100755 diff --git a/public/icons/undo.svg b/public/icons/undo.svg old mode 100644 new mode 100755 diff --git a/public/index.html b/public/index.html old mode 100644 new mode 100755 index 0b99d68..72ad5d7 --- a/public/index.html +++ b/public/index.html @@ -47,11 +47,14 @@
- + + + +