Skip to content
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

Docker issue #139

Closed
stuartmaxwell opened this issue Jul 17, 2019 · 9 comments · Fixed by #407
Closed

Docker issue #139

stuartmaxwell opened this issue Jul 17, 2019 · 9 comments · Fixed by #407

Comments

@stuartmaxwell
Copy link

Describe the bug

Hi there - I followed the Docker instructions properly but after running docker-compose up -d I am unable to run the setup script since the web container never launches properly. A look at the docker logs shows the following errors:

2019/07/17 08:22:30 Loading config.ini configuration...
ERROR: 2019/07/17 08:22:30 log.go:26: Unable to load configuration: open config.ini: no such file or directory

I've checked the docker-compose file to make sure that the config.ini.example file is mapped properly: - "./config.ini.example:/go/src/app/config.ini"

Not sure what to check next?

Thanks for open-sourcing this - keen to check it out.

Steps to reproduce (if necessary)

Steps to reproduce the behavior:

  1. Follow the docker instructions
  2. Run docker-compose up -d
  3. Attempt to run the ./docker-setup.sh command

Expected behavior

Setup script should run

Application configuration

  • Single mode or Multi-user mode? - haven't got this far yet
  • Database? [mysql/sqlite] - The docker-compose file uses mysql by default - the database container starts up fine
  • Open registration? [yes/no] - haven't got this far yet
  • Federation enabled? [yes/no] - haven't got this far yet

Version or last commit:
Checked out the latest GitHub code: Latest commit 71fb635 9 days ago

@thebaer
Copy link
Member

thebaer commented Jul 17, 2019

Thanks for the report. It looks like the app isn't finding a config.ini file in the directory writefreely is running from. But I don't actually have any experience with Docker -- this part of WriteFreely is maintained entirely by the community -- so I'll have to defer this to anyone else with experience there. Any help would be much appreciated!

@ghost
Copy link

ghost commented Aug 10, 2019

I can check this out

@ghost ghost self-assigned this Aug 10, 2019
@thebaer
Copy link
Member

thebaer commented Aug 10, 2019

Sounds great.

@ghost
Copy link

ghost commented Aug 12, 2019

@stuartmaxwell sorry about this, I tried to build the docker file and run the compose script with no luck either. Both fail to build.

I will start by writing a working docker file and we can iterate on a production level compose after that.

@stuartmaxwell
Copy link
Author

Thanks for looking into this, I'm keen to help too but have been short on time recently and have no experience with Go. Let me know if I can help with any testing though.

@ghost
Copy link

ghost commented Sep 14, 2019

@stuartmaxwell if you are keen to try out writefreely before we get these things sorted out on master here. I have some images built from https://github.com/writeas/writefreely/tree/docker on my personal docker hub https://cloud.docker.com/u/robjloranger/repository/docker/robjloranger/writefreely.

There are instructions there and two compose files as well, but they may change.

@adamelliotfields
Copy link

adamelliotfields commented Nov 16, 2019

The instructions are incorrect. The working directory is /go, so that means config.ini must be mounted at /go/config.ini, not /go/src/app/config.ini.

Here is how I got writefreely up manually using Docker. In the future, these steps could be moved to docker-entrypoint.sh inside the container so a user could simply run docker run.

Create config.ini:

cat <<EOF > config.ini
[server]
port                 = 8080
bind                 = 0.0.0.0

[database]
type     = sqlite3
filename = writefreely.db

[app]
site_name          = Our Community
site_description   = A place to write freely.
host               = http://localhost:8080
disable_js         = false
webfonts           = true
single_user        = true
open_registration  = false
min_username_len   = 1
max_blogs          = 1
federation         = false
public_stats       = false
private            = false
local_timeline     = true
user_invites       = admin
landing            = /
default_visibility = public
EOF

Create writefreely.db:

touch writefreely.db

Create /go/keys volume:

docker volume create writefreely

Initial database migration:

docker run \
-i \
-v writefreely:/go/keys \
-v $(pwd)/config.ini:/go/config.ini \
-v $(pwd)/writefreely:/go/writefreely.db \
--rm \
writeas/writefreely:0.9.1 \
-init-db

Create Admin user (see author.go for a list of reserved user names):

docker run \
-i \
-v writefreely:/go/keys \
-v $(pwd)/config.ini:/go/config.ini \
-v $(pwd)/writefreely:/go/writefreely.db \
--rm \
writeas/writefreely:0.9.1 \
-create-admin \
adam:adam

Start the server:

docker run \
-d \
-p 8080:8080 \
-v writefreely:/go/keys \
-v $(pwd)/config.ini:/go/config.ini \
-v $(pwd)/writefreely:/go/writefreely.db \
--name=writefreely \
writeas/writefreely:0.9.1

@ghost ghost removed their assignment Jan 7, 2020
@thebaer
Copy link
Member

thebaer commented Jul 23, 2020

Sorry this issue went unattended. Would anyone be interested in submitting a fix here, as a pull request?

@thebaer
Copy link
Member

thebaer commented Sep 2, 2020

@shleeable is any of this addressed in #357?

@thebaer thebaer linked a pull request Dec 8, 2020 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants