Skip to content

[$250] Deployment Docker #1

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
rootelement opened this issue Mar 5, 2020 · 19 comments
Closed

[$250] Deployment Docker #1

rootelement opened this issue Mar 5, 2020 · 19 comments

Comments

@rootelement
Copy link
Contributor

Create a docker file to:

  1. Pull in the latest LTS minor revision of Vanilla Forums. The best example of format and process would possibly be https://github.com/topcoder-platform/av-scanner-service but don't be limited to this
  2. Set up a plugin structure for vanilla in this repo: https://github.com/topcoder-platform/forums-plugins This should be pulled in, installed and configured by docker (for now, cloning it into the plugins directory is fine)
@rootelement rootelement added the enhancement New feature or request label Mar 5, 2020
@rootelement rootelement self-assigned this Mar 5, 2020
@jmgasper jmgasper added tcx_OpenForPickup and removed enhancement New feature or request labels Apr 13, 2020
@jmgasper jmgasper changed the title WIP - Deployment Docker [$150] Deployment Docker Apr 13, 2020
@jmgasper
Copy link
Collaborator

Contest https://www.topcoder.com/challenges/30122181 has been created for this ticket.

This is an automated message for ghostar via Topcoder X

@atelomycterus atelomycterus self-assigned this Apr 13, 2020
@jmgasper
Copy link
Collaborator

Contest https://www.topcoder.com/challenges/30122181 has been updated - it has been assigned to obog.

This is an automated message for ghostar via Topcoder X

@atelomycterus
Copy link
Collaborator

@jmgasper What default plugins should be enabled by default?

image

@jmgasper
Copy link
Collaborator

  • Topcoder plugin
  • Advanced Editor
  • Emoji Sets
  • OAuth2 SSO
  • Quotes
  • reCAPTCHA support
  • Rich editor
  • Syntax Prettifier

@atelomycterus
Copy link
Collaborator

@jmgasper Done. It's ready for your review. I think I should create a PR , not push it immediately. Sorry about that.

  • Let me know about default plugins.
  • I attached a default Vanilla config if we need to change some default parameters (disable plugins. or so on). We can keep our config in the repo and overwrite a default config in a docker.

config-defaults.php.txt

@atelomycterus
Copy link
Collaborator

  • Topcoder plugin
  • Advanced Editor
  • Emoji Sets
  • OAuth2 SSO
  • Quotes
  • reCAPTCHA support
  • Rich editor
  • Syntax Prettifier

@jmgasper Oauth2 SSO don't have default settings. Enabling without settings doesn't make sense.
image

@atelomycterus atelomycterus mentioned this issue Apr 13, 2020
@atelomycterus
Copy link
Collaborator

atelomycterus commented Apr 13, 2020

@jmgasper Implemented. Please apply PR (#7).

  1. All plugins except 'OAuth2 SSO' are enabled successfully. I tried to setup plugin settings with default values but it didn't work. So Admin/User has to configure them manually.
    image

  2. Unfortunately we can't enable OAuth2 SSO by default because Vanilla Installer doesn't start:
    image

Thanks!

P.S. Known issue: if you enter a wrong email, click on "continue". Vanilla Installer displays an invalid email. After, fixing it, Vanilla Installer doesn't work. So with a docker we need to execute docker-compose down and run again.
image

@jmgasper
Copy link
Collaborator

@atelomycterus - For the OAuth SSO, if we provide some details, can we use those details to auto-populate the database directly to try to work around the issue above?

@atelomycterus
Copy link
Collaborator

@atelomycterus - For the OAuth SSO, if we provide some details, can we use those details to auto-populate the database directly to try to work around the issue above?

@jmgasper Vanilla Forums Installer generates config.php from config-defaults.php during installation. All settings (connection db, plugins, and so on) are saved in config.php.
Some details about Vanilla configuration files.
I found in docs yesterday that there are hooks in bootstrap.

bootstrap.before is good for overriding functions or constants. Nothing is available.
bootstrap.early is good for overriding config settings during initial install. Config values, functions, and constants are available.
bootstrap.late has loaded the plugin, app, and theme managers, as well as loaded individual app configs. Validation functions are also loaded just before this. It's the last chance to turn on Debug via config.
bootstrap.after has loaded the entire framework except the render functions. You could theoretically use all of Vanilla to do some logic on what render functions to use or do some prep before processing the user's request.

A file named conf/bootstrap.early.php can be created and used with the 'saveToConfig' function. Plan to implement today. Keep you updated. Don't close the ticket.

@atelomycterus
Copy link
Collaborator

atelomycterus commented Apr 14, 2020

@jmgasper bootstrap.early works for any plugins which keep all settings in config.php.
So we can auto-populate with default values some plugins during initial install. It works for the next plugins:

  • Topcoder
  • Emoji Sets
  • Syntax Prettifier.

OAuth2 SSO

All authentication providers save some parameters in the table 'UserAuthenticationProvider'.
Enabling OAuth2 SSO alters the table 'UserAuthenticationProvider' by adding some columns.
So I need to know what parameters/values will be used in OAuth2 SSO plugins.
It'd be good if you provide it and I can test it.

@atelomycterus
Copy link
Collaborator

@jmgasper Implemented. Please apply PR. I couldn't check OAuth2 SSO Topcoder locally because I got "Callback URL mismatch.The provided redirect_uri is not in the list of allowed callback URLs.". So I tested with ngrok and configured google OAuth settings

The Vanilla url 'https://<vanilla_host>/entry/oauth2' should be added in Authorised redirect URIs.

What host should be used in /etc/hosts to get response from topcoder-dev.com? I tried topcoder-dev.com, dev.topcoder.com but it didn't work for me.

@jmgasper
Copy link
Collaborator

@atelomycterus - I think vanilla.topcoder-dev.com should work, but if not let me know.

@atelomycterus
Copy link
Collaborator

atelomycterus commented Apr 14, 2020

@jmgasper Yes, it works without any issues if it's deployed on vanilla.topcoder-dev.com and vanilla.topcoder-dev.com is added in Authorized redirect URIs.
But using OAuth 2 SSO with docker on (127.0.0.1 or others) has an issue.
After getting a callback it redirects to the vanilla.topcoder-dev.com, not your docker vanilla host.
if use a localhost or another URL not from a list of Authorized redirect URIs , then get "Callback URL mismatch.The provided redirect_uri is not in the list of allowed callback URLs."

@jmgasper
Copy link
Collaborator

@atelomycterus - I think that's fine. Normally, for other Topcoder services, we ask folks to add a local redirect to their hosts file for the targeted URL.

@jmgasper
Copy link
Collaborator

@atelomycterus - One question:

Can we move things from the bootstrap.early.php file into environmental variables please?

Things like:

  • Plugins.Topcoder.BaseApiURL
  • Plugins.Topcoder.MemberApiURI
  • Plugins.Topcoder.MemberProfileURL
  • UserAuthenticationProvider / AssociationSecret
  • UserAuthenticationProvider / SignInUrl
  • UserAuthenticationProvider / Attributes

The secret and attributes especially need to be moved because we can't keep those values in Git.

@jmgasper jmgasper changed the title [$150] Deployment Docker [$175] Deployment Docker Apr 15, 2020
@atelomycterus
Copy link
Collaborator

atelomycterus commented Apr 15, 2020

@atelomycterus - One question:

Can we move things from the bootstrap.early.php file into environmental variables please?

Things like:

  • Plugins.Topcoder.BaseApiURL
  • Plugins.Topcoder.MemberApiURI
  • Plugins.Topcoder.MemberProfileURL
  • UserAuthenticationProvider / AssociationSecret
  • UserAuthenticationProvider / SignInUrl
  • UserAuthenticationProvider / Attributes

The secret and attributes especially need to be moved because we can't keep those values in Git.

@jmgasper Yes, I've checked Vanilla code, we can implement

 saveToConfig('<Key>', getenv('<Key>'), false);

If this is false then only the in-memory config is set.

Importanta Notes: After an admin makes a change in the dashboard, Vanilla will rewrite
config.php and put the plaintext version of the env var.

After installation db settings as plaint text in config.php.
I think the additional values should be fixed:

  • Database.Host

  • Database.Name

  • Database.User

  • Database.Password

  • Garden.Email.SupportName

  • Garden.Email.SupportAddress

  • Garden.Email.SmtpHost

  • Garden.Email.SmtpUser

  • Garden.Email.SmtpPassword

  • Garden.Email.SmtpPort

  • Garden.Email.SmtpSecurity

  • Recaptcha.PrivateKey

  • Recaptcha.PublicKey

I'll add these params as env params in a docker-compose file

@jmgasper jmgasper changed the title [$175] Deployment Docker [$250] Deployment Docker Apr 15, 2020
@jmgasper
Copy link
Collaborator

jmgasper commented Apr 15, 2020

@atelomycterus - Yeah, we'll need to set those additional values from the environment those as well, thanks. I'm not too worried about having them in plaintext on the server, but I don't want them in plaintext in Git.

@atelomycterus
Copy link
Collaborator

@jmgasper Fixed. Please apply PR. I'll send mysql.env and vanilla.env with values by email. Thanks!

@jmgasper
Copy link
Collaborator

Payment task has been updated: https://software.topcoder.com/review/actions/ViewProjectDetails?pid=30122181

This is an automated message for ghostar via Topcoder X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants