Closed pthoelken closed 6 months ago
Hi @pthoelken ,
Unfortunately the installer.sh
script has not been maintained for a long time, and is not really in a working state.
If your goal is to just get kcapp
up and running to start playing, I would recommend you just use the kcapp/api and kcapp/frontend docker images, via the
docker compose file to get quickly up and running.
A more detailed guide can be found on the wiki (make sure you follow the Initialize
steps)
If you would like more control of how things are running, and possibly want to contribute something back to the project, setting it up manually is also feasible!
Make sure you have node
, npm
, go
, and mysql
installed
# Install goose (https://pressly.github.io/goose/installation/)
$ curl -fsSL https://raw.githubusercontent.com/pressly/goose/master/install.sh | sh
# Clone database repository
$ git clone https://github.com/kcapp/database.git
$ cd database/migrations
# Run migrations
# Replace <username>, <password>, <host>, <port>, and <schema>:
# goose mysql "<username>:<password>@tcp(<host>:<port>)/<schema>?parseTime=true" up
# Example:
$ goose mysql "developer:abcd1234@tcp(localhost:3306)/kcapp?parseTime=true" up
# Clone API repository
$ cd $GOPATH/src
$ mkdir -p github.com/kcapp ; cd github.com/kcapp
$ git clone https://github.com/kcapp/api.git
$ cd api
# Build the binary
$ go build
# Edit config file
# Set the same database credentials as used in step 1
$ vim config/config.yaml
# Run the API
$ ./api --config config/config.yaml
2024/03/04 15:37:23 Listening on port 8001
# or to see available commands run
$ ./api --help
# Clone Frontend repository
$ git clone https://github.com/kcapp/frontend.git
$ cd frontend
# Install all frontend dependencies
$ npm install
# Start frontend
# or run with "dev" if you want to develop features and want auto-reload
$ DEBUG=kcapp* npm run prod
> kcapp@2.8.0 prod
> cross-env NODE_ENV=production npm start
> kcapp@2.8.0 start
> node ./bin/www
kcapp:socketio-handler [/active] created +0ms
kcapp:server Listening on port 3000 +0ms
There are also some things which can be changed via configuration if needed
Once up and running, you could also setup other integrations
Let me know if this works for you! Also feel free to join the Slack Channel and ping me directly there if you have any questions, or get stuck. Would love to hear from you and what you think of the project once it's up and running!
Hey @thordy thanks for your quick response. I'll check this out later :-)
Hi @thordy I'm back ... after try to create a production environment with the following files, I've got a error message.
docker-compose.yml
version: '3.6'
services:
db:
image: linuxserver/mariadb:110.4.12mariabionic-ls59
# command: mysqld --sql_mode=""
restart: always
ports:
- "${MYSQL_LISTEN_ADDR}:${MYSQL_LISTEN_PORT}:3306"
expose:
- ${MYSQL_LISTEN_PORT}
volumes:
- db_config:/config
- db:/var/lib/mysql
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
migration:
image: kcapp/api:latest
command: [ "./wait-for-it.sh", "db:3306", "--", "./run_migrations.sh" ]
depends_on:
- db
environment:
DB_CONNECTION: "${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(db:3306)/${MYSQL_DATABASE}?parseTime=true"
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
api:
image: kcapp/api:latest
restart: always
ports:
- "${API_LISTEN_ADDR}:${API_LISTEN_PORT}:8001"
expose:
- ${API_LISTEN_PORT}
depends_on:
- migration
- db
command: [ "./wait-for-it.sh", "db:3306", "--", "/go/bin/api" ]
frontend:
image: kcapp/frontend:latest
restart: always
ports:
- "${KCAPP_FRONTEND_LISTEN_ADDR}:${KCAPP_FRONTEND_LISTEN_PORT}:3000"
expose:
- ${KCAPP_FRONTEND_LISTEN_PORT}
volumes:
- frontend_cache:/.cache
depends_on:
- api
environment:
- DEBUG=kcapp*
- KCAPP_API
- DISK_CACHE
volumes:
db:
db_config:
frontend_cache:
.env file
# .env-dist
# copy to .env and edit to fit your environment
# or if you just hate defaults
# Docker image versions
KCAPP_API_VERSION=2.7.0
KCAPP_FRONTEND_VERSION=2.7.0
# Frontend settings
KCAPP_FRONTEND_LISTEN_PORT=3003
KCAPP_FRONTEND_LISTEN_ADDR=0.0.0.0
# API settings
KCAPP_API=http://api:8001
DISK_CACHE=false
API_LISTEN_ADDR=0.0.0.0
API_LISTEN_PORT=8001
# Database settings
MYSQL_LISTEN_ADDR=0.0.0.0
MYSQL_LISTEN_PORT=3366
MYSQL_DATABASE=kcapp
MYSQL_USER=kcapp
MYSQL_PASSWORD=abcd1234
MYSQL_ROOT_PASSWORD=abcd1234
Error Message
db_1 | 240304 15:53:48 mysqld_safe Logging to syslog.
db_1 | 240304 15:53:48 mysqld_safe Starting mysqld daemon with databases from /config/databases
migration_1 | wait-for-it.sh: waiting 15 seconds for db:3306
migration_1 | wait-for-it.sh: db:3306 is available after 1 seconds
migration_1 | 2024/03/04 15:53:49 goose run: ERROR 00042_fix_foreign_keys.sql: failed to run SQL migration: failed to execute SQL query "ALTER TABLE `leg` DROP FOREIGN KEY `match_game_id_foreign`;": Error 1091 (42000): Can't DROP FOREIGN KEY `match_game_id_foreign`; check that it exists
I've do it like the steps from the wiki page. Anything what I forget? @thordy
And thanks for great support and work into this app. I'll looking forward for new features and a great open source solution. :)
That's very strange. Could you share with me the full logs outputs you are getting from running the docker compose command?
And could you try to just delete the docker volumes, and try running again from scratch? Sometimes it gets into a weird state if you interrupt the execution when setting up the first time, so it's important to run the pre requisite DB step, as well as not to interrupt when migrations are running to avoid ending up in a incomplete state
Oh lord ... it was my bad. I forget, that docker system prune -af
does not remove turned off volumes. After removing the volumes with docker volume rm kcapp*
it works like charm for me. Sorry for bother you.
Let us keep writing in Slack about new Ideas for kcapp :D
Hello kcapp Team,
When I start the script ./install.sh I get the following error. API and Frontend won't start in this case.
From here the script hangs.