デプロイ方法をユーザーに任せる

This commit is contained in:
yuuki 2024-05-09 19:23:23 +00:00
parent e4719b8f07
commit 9e62130598
5 changed files with 17 additions and 67 deletions

View File

@ -1,11 +1,4 @@
/.git /.git
/.gitignore
/Dockerfile
/.dockerignore
/__pycache__ /__pycache__
/README.md
/public/songs /public/songs

View File

@ -14,16 +14,16 @@ pip install -r requirements.txt
```bash ```bash
docker run --detach \ docker run --detach \
--name taiko-mongo-debug \ --name taiko-web-mongo-debug \
--volume taiko-mongo-debug:/data/db \ --volume taiko-web-mongo-debug:/data/db \
--publish 27017:27017 \ --publish 27017:27017 \
mongo mongo
``` ```
```bash ```bash
docker run --detach \ docker run --detach \
--name taiko-redis-debug \ --name taiko-web-redis-debug \
--volume taiko-redis-debug:/data \ --volume taiko-web-redis-debug:/data \
--publish 6379:6379 \ --publish 6379:6379 \
redis redis
``` ```
@ -36,49 +36,6 @@ flask run
## デプロイ ## デプロイ
Dockerイメージをビルドします
```bash
docker build -t taiko .
```
データベースを起動します
```bash
docker run --detach \
--name taiko-mongo \
--volume taiko-mongo:/data/db \
mongo
```
```bash
docker run --detach \
--name taiko-redis \
--volume taiko-redis:/data \
redis
```
今すぐデプロイ! 今すぐデプロイ!
- https://taikoapp.uk/ - https://taikoapp.uk/
```bash
docker run --detach \
--name taiko \
--link taiko-mongo \
--link taiko-redis \
--env TAIKO_WEB_MONGO_HOST=taiko-mongo \
--env TAIKO_WEB_REDIS_HOST=taiko-redis \
--volume songs:/app/public/songs \
--env LETSENCRYPT_HOST=taikoapp.uk \
--env VIRTUAL_HOST=taikoapp.uk \
--env VIRTUAL_PORT=8000 \
taiko
```
終了するには
```bash
docker stop taiko-mongo taiko-redis taiko
docker rm -f taiko-mongo taiko-redis taiko
```

View File

@ -4,8 +4,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>太鼓ウェブあっぷろーだー</title> <title>太鼓ウェブあっぷろーだー</title>
<link rel="stylesheet" href="./style.css"> <link rel="stylesheet" href="style.css">
<script src="./upload.js"></script> <script src="upload.js"></script>
</head> </head>
<body> <body>
<h1>太鼓ウェブあっぷろーだー</h1> <h1>太鼓ウェブあっぷろーだー</h1>

View File

@ -15,9 +15,9 @@ body * {
body { body {
margin: 0; margin: 0;
padding: 3rem; padding: 2rem;
} }
body > *:not(:last-child) { body > :not(:last-child) {
margin-bottom: 3rem; margin-bottom: 2rem;
} }

View File

@ -1,27 +1,27 @@
function uploadFiles() { function uploadFiles() {
const form = document.getElementById('upload-form'); const form = document.querySelector("#upload-form");
const formData = new FormData(form); const formData = new FormData(form);
fetch('/upload', { fetch("/upload", {
method: 'POST', method: "POST",
body: formData, body: formData,
}) })
.then(res => { .then((res) => {
if (res.ok) { if (res.ok) {
return res.json(); return res.json();
} else { } else {
throw new Error(res.url + " で " + res.status.toString() + " が発生しました。"); throw new Error(res.url + " で " + res.status.toString() + " が発生しました。");
} }
}) })
.then(data => { .then((data) => {
if (data.success) { if (data.success) {
alert("おめでとう!ファイルの投稿に成功しました!"); alert("おめでとう!ファイルの投稿に成功しました!");
} else { } else {
throw new Error(data.error); throw new Error(data.error);
} }
}) })
.catch(error => { .catch((error) => {
console.error('エラー:', error); console.error("エラー:", error);
document.getElementById("error-view").textContent = error; document.querySelector("#error-view").textContent = error;
}); });
} }